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

Stop publishing types #217

Closed
chriskrycho opened this issue Oct 15, 2020 · 1 comment · Fixed by #218
Closed

Stop publishing types #217

chriskrycho opened this issue Oct 15, 2020 · 1 comment · Fixed by #218

Comments

@chriskrycho
Copy link
Contributor

chriskrycho commented Oct 15, 2020

We recently discovered internally that the fact that this is publishing types can cause apps and addons which use TypeScript to end up very confused, depending on exactly how they end up resolving the @ember/string types module graph. If they resolve to the types published here, for Ember 3.8, they will always error.

example type error
node_modules/@types/ember/index.d.ts:446:46 - error TS2339: Property 'htmlSafe' does not exist on type 'typeof import("/Users/ckrycho/dev/linkedin/ember-restli-graphql/node_modules/@ember/string/index")'.

446         const htmlSafe: typeof EmberStringNs.htmlSafe;
                                                 ~~~~~~~~

node_modules/@types/ember/index.d.ts:447:48 - error TS2339: Property 'isHTMLSafe' does not exist on type 'typeof import("/Users/ckrycho/dev/linkedin/ember-restli-graphql/node_modules/@ember/string/index")'.

447         const isHTMLSafe: typeof EmberStringNs.isHTMLSafe;
                                                   ~~~~~~~~~~

While it would be nice to fix this simply by fixing the type definitions, we should instead remove the type definitions for now. This will fix the existing issue here, and align us with our current support policy for TypeScript, which is that core Ember addons should not publish types at present: we do not have any stability guarantees around them or their relationship to SemVer!

(I plan to address that with an RFC in the very near future, however, and this repo would be a prime candidate for rolling out support when we do.)

chriskrycho added a commit to chriskrycho/ember-string that referenced this issue Oct 15, 2020
Until Ember has an official support policy for SemVer stability for
types and this addon adopts all associated recommendations from such a
policy, it should not publish types.

Fixes emberjs#217
@chriskrycho
Copy link
Contributor Author

A bit of elaboration: I believe the problem arises in this specific scenario because of how the timeline ended up playing out as regards the @ember/template package and the way this and that one both exported HTMLSafe and isHTMLSafe at times. This is another useful data point into the design for SemVer stability around our ambient types, as we currently publish types in DefinitelyTyped which say that those are available on the namespace for Ember.String, which (if my spelunking is correct) resolves to this module.

cc. @dfreeman @jamescdavis

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

Successfully merging a pull request may close this issue.

1 participant