Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide typings #189

Closed
2 of 18 tasks
hirako2000 opened this issue Mar 12, 2017 · 14 comments
Closed
2 of 18 tasks

Provide typings #189

hirako2000 opened this issue Mar 12, 2017 · 14 comments

Comments

@hirako2000
Copy link
Collaborator

hirako2000 commented Mar 12, 2017

Typescript developers would benefit in having typings for whs. There are already some typings for three.js.
See best practice to write type definitions.

Version:
  • v2.x.x
  • v1.x.x
Issue type:
  • Bug
  • Proposal/Enhancement
  • Question

Tested on:
Desktop
  • Chrome
  • Chrome Canary
  • Chrome dev-channel
  • Firefox
  • Opera
  • Microsoft IE
  • Microsoft Edge
Android
  • Chrome
  • Firefox
  • Opera
IOS
  • Chrome
  • Firefox
  • Opera
@sasha240100
Copy link
Member

@hirako2000 how to implement?

@hirako2000
Copy link
Collaborator Author

Creating typings, definitelytyped

@ElectrcNINJA-zz
Copy link

I can help with this; It would be very nice to have with any project I would use WHS in.

@sasha240100
Copy link
Member

@ElectrcNINJA would be awesome cause I am 0 at typescript. Make a fork/branch with a name "#189", work there and do a PR

@thejmazz
Copy link
Contributor

typescript over flow is a good call I think

@thejmazz
Copy link
Contributor

How well does TS handle static properties on a class?

Can it autosuggest a class's static properties in IDEs?

Could maybe annotate components with how they expose bridges with something like

static bridgeTypes = [ ' geometry', 'material', 'mesh', 'onWrap' ]

@hirako2000
Copy link
Collaborator Author

from my little experience with TS, types are perfectly supported, so long as the typings are well defined (and installed) for dep libraries written in JS of course.
IDEs commonly have support for TS autocompletion etc. - excellent support on Atom and VisualCode.

Best is to see int action and appreciate how good it can be to have types available, especially when learning how to use unfamiliar APIs.

If you setup a skeleton typescript project, import a poplar library such as lodash. insteall definitlytyped and lodash's typings.

@sasha240100 sasha240100 modified the milestone: v2.0.0-beta.7 Mar 13, 2017
@sasha240100 sasha240100 added this to Low priority in v2.2 Mar 14, 2017
@sasha240100 sasha240100 modified the milestones: v2.0.0-beta.7, v2.0.0-beta.8 Mar 19, 2017
@sasha240100 sasha240100 moved this from Low priority to Work in progress / Long-term in v2.2 Mar 26, 2017
@zored
Copy link

zored commented Apr 26, 2017

@sasha240100 Waiting for typings. 😄 Have you seen that you can use "types": "./typings/wts.d.ts" in package.json to avoid @types/... dependency?

@hirako2000
Copy link
Collaborator Author

Zored, we do need typings, we've been busy doing other things in the mean time, and would love someone having typings definitions experience or knowledge to take the lead on this.
The typescript boilerplate is set up with typings for other frameworks, including three.js, it would be a nice place to experiment with some basic WHS definitions.

Are you able to give us a hand with this?

@zored
Copy link

zored commented Apr 27, 2017

@hirako2000 ok, I'll write definitions and I'll create pull-request in several days. Currently I try to adapt dts-gen to automate typings generation. Otherwise I'll create them manually. There will be ./typings/*.d.ts in project root similar to @types/three but in project root and without tests for now that are just checking input/output types.

@hirako2000
Copy link
Collaborator Author

I'v started adding type definitions, starting with Core.
Would it make sense to fork DefinitelyTyped under WhitestormJS and contribute there?
We can then make pull requests, it will publish to npm once they get merged by the dt team.

@d-ph
Copy link

d-ph commented May 29, 2017

@hirako2000 Please don't contribute to DT. Instead add the types directly to this project's repo (as @zored said). This is the recommended way of providing typings for js projects.

See vuejs for reference:

  1. types/index.d.ts: link
  2. In package.json mention the types/index.d.ts in the typings field: link

This way:

  1. Devs of whitestorm.js don't need to wait for DT to merge and publish typings changes.
  2. Typescript users of whitestorm.js will get the typings automagically after they npm install whs
  3. Typings are easier to be kept in sync with the project's codebase.

TS declaration files docs

@hirako2000
Copy link
Collaborator Author

thanks a lot for the input @d-ph, will do that

hirako2000 added a commit that referenced this issue Jun 20, 2017
hirako2000 added a commit that referenced this issue Jun 21, 2017
hirako2000 added a commit that referenced this issue Jun 21, 2017
hirako2000 added a commit that referenced this issue Jun 21, 2017
hirako2000 added a commit that referenced this issue Jun 21, 2017
hirako2000 added a commit that referenced this issue Jun 21, 2017
hirako2000 added a commit that referenced this issue Jun 21, 2017
hirako2000 added a commit that referenced this issue Jun 21, 2017
hirako2000 added a commit that referenced this issue Jun 21, 2017
hirako2000 added a commit that referenced this issue Jun 21, 2017
hirako2000 added a commit that referenced this issue Jun 21, 2017
sasha240100 added a commit that referenced this issue Jun 22, 2017
sasha240100 added a commit that referenced this issue Jun 22, 2017
hirako2000 added a commit that referenced this issue Jun 22, 2017
@hirako2000
Copy link
Collaborator Author

hirako2000 commented Jul 2, 2017

A few types are added and this Issue became a snowball as it included jsDoc setup etc.
Types continued with issue #267
We will have multiple issues to get all types provided by whs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
v2.2
Work in progress / Long-term
Development

No branches or pull requests

6 participants