Skip to content

Official documentation indicates we should import htmlSafe from @ember/template #784

Closed

Description

@psbanka

Which package(s) does this problem pertain to?

  • @types/ember__string

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

Activity

  1. chriskrycho commented on Aug 1, 2019

    @chriskrycho
    Member

    Thank you for opening this! If you open a PR against DefinitelyTyped adding it (including some tests) we'd be happy to review!

  2. added
    types:core
    on Aug 1, 2019
  3. scottkidder commented on Sep 23, 2019

    @scottkidder
    Contributor

    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?

  4. jamescdavis commented on Sep 23, 2019

    @jamescdavis
    Contributor

    That's right! And then once we have that in, we'll need to reference it from @types/ember so it gets installed automatically.

  5. scottkidder commented on Sep 24, 2019

    @scottkidder
    Contributor

    @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?

  6. jamescdavis commented on Sep 25, 2019

    @jamescdavis
    Contributor

    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/string does 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.

  7. mschorsch commented on Oct 11, 2019

    @mschorsch

    Possible duplicate #342

  8. jamescdavis commented on Oct 11, 2019

    @jamescdavis
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    types:core

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions