Skip to content
This repository has been archived by the owner on Sep 29, 2020. It is now read-only.

Typscriptify? #35

Open
robwormald opened this issue Dec 24, 2015 · 11 comments
Open

Typscriptify? #35

robwormald opened this issue Dec 24, 2015 · 11 comments

Comments

@robwormald
Copy link

Following from the twitter discussion -

I'm happy to do a PR to convert, at first pass doesn't look like it would be too much trouble.

Benefits:

  • no manual management / work duplication of type definitions - see https://github.com/Microsoft/TypeScript/wiki/Typings-for-npm-packages for more details on that - no TSD / DefinitelyTyped for consumers.
  • Type definitions for consumers authoring their apps in TS
  • No change for consumers using CJS/ES6 modules (TS transpiles to these formats)
  • Typescript actually supports decorators and class properties (!)

Drawbacks:

  • lose a couple of niceties in the current source - mainly the ES7 Object rest spread which isn't currently supported by Typescript, so that would require a bit o' refactoring.
  • can get a bit hairy with polymorphic typings, but I don't see this as a big issue really.

Discuss?

@jayphelps
Copy link
Owner

I'm definitely down with this assuming the drawbacks listed end up being the only notable ones.

@jayphelps
Copy link
Owner

I think an additional concern is going to be how TypeScript decorators and the final ES decorators will differ since the ES spec has already changed for how they are implemented. I've been waiting for the new spec to be implemented in Babel 6 before moving this lib over to it and investigating backwards compatibility, but something to consider if TypeScript is to be officially support by this lib. #15 is tracking that issue as part of the Road to 1.0 for core-decorators.

@robwormald
Copy link
Author

Noted. I assume since @jonathandturner is involved with Typescript and the spec discussions in wycats/javascript-decorators#36 Typescript will play nice with the specification, but something to track for sure 👍

@robwormald
Copy link
Author

One slight change to the build process (we have the same issue in RxJS, fwiw) would be the jsnext:main field (or whatever it ends up being called) would need to point to the transpiled-to-ES6-from-TS output. Not a big deal really, and in theory nicer as TS's ES6 output wouldn't require any specific Babel options to be enabled (other than decorators, of course)

@sophiajt
Copy link

FWIW, I don't work at MS anymore and haven't been doing any design work for TS. The TS team, wycats, and the Angular team are good contacts for decorator discussions.

@robwormald
Copy link
Author

Or.... not. :D Sorry for the noise!

@jayphelps
Copy link
Owner

wycats confirmed to me that TS will indeed change their implementation to match the ES spec, so when that spec is more solidified and either Babel or TS upgrade their shit to the new spec, we can do so as well and worry then about backwards compatibility or choose not.

@jayphelps
Copy link
Owner

So basically, @robwormald 👍 go for it.

@sophiajt
Copy link

No worries :)

@jayphelps
Copy link
Owner

@robwormald you still up for this?

@felixfbecker
Copy link

Could we at least get the typescript definitions distributed with the package for the meantime? That would only require commiting the ones from DT and adding a typings field to package.json

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants