You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Official documentation indicates we should import htmlSafe from @ember/template #784
What are instructions we can follow to reproduce the issue?
add this line to any ember .ts file:
import{htmlSafe}from'@ember/template';
and you will get a TypeScript error despite the fact that official documentation indicates that this is where the import should come from. Instead, we have to import from @ember/string.
Now about that bug. What did you expect to see?
Clean import with no TS errors.
What happened instead?
TypeScript complains of not being able to find type info for htmlSafe
I'm more than happy to take this on. What's the right thing to do here? Should I create a new package called ember__template or is is there some better approach?
I added a couple of comments to the PR. As far as removing it from @ember/string, the API docs as late as Ember 3.7 are conflicted (and importing from @ember/stringdoes work) so we should probably leave it there for now, but could (and should) change those to just re-export from @ember/template. I'm pretty sure there's no way to tell the TypeScript compiler that something is deprecated, but if you annotate with a JSDoc @deprecated tag, tslint (at least) can detect that and warn.
Activity
chriskrycho commentedon Aug 1, 2019
Thank you for opening this! If you open a PR against DefinitelyTyped adding it (including some tests) we'd be happy to review!
scottkidder commentedon Sep 23, 2019
I'm more than happy to take this on. What's the right thing to do here? Should I create a new package called ember__template or is is there some better approach?
jamescdavis commentedon Sep 23, 2019
That's right! And then once we have that in, we'll need to reference it from @types/ember so it gets installed automatically.
scottkidder commentedon Sep 24, 2019
@jamescdavis Thanks for the confirmation! I put something together here
I was not sure if I should additionally remove or somehow deprecate the @ember/string/htmlSafe export?
jamescdavis commentedon Sep 25, 2019
I added a couple of comments to the PR. As far as removing it from
@ember/string, the API docs as late as Ember 3.7 are conflicted (and importing from@ember/stringdoes work) so we should probably leave it there for now, but could (and should) change those to just re-export from@ember/template. I'm pretty sure there's no way to tell the TypeScript compiler that something is deprecated, but if you annotate with a JSDoc @deprecated tag, tslint (at least) can detect that and warn.mschorsch commentedon Oct 11, 2019
Possible duplicate #342
jamescdavis commentedon Oct 11, 2019
Closed by DefinitelyTyped/DefinitelyTyped#38571