Skip to content

[Ember] Update htmlSafe and isHTMLSafe types to import from '@ember/template' - #50545

Merged
weswigham merged 2 commits into
DefinitelyTyped:masterfrom
eramod:update-htmlSafe-isHTMLSafe-types
Jan 14, 2021
Merged

weswigham merged 2 commits into
DefinitelyTyped:masterfrom
eramod:update-htmlSafe-isHTMLSafe-types

Conversation

@eramod

@eramod eramod commented Jan 12, 2021 •

Copy link
Copy Markdown
Contributor
  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Add or edit tests to reflect the change.
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm test

Updates types for htmlSafe and isHTMLSafe to reflect the fact that you can no longer import these functions from @ember/string and must now import them from @ember/template

Note: it appears that htmlSafe and isHTMLSafe can no longer be imported from @ember/string, but the last version that exported these functions was Ember version 3.7, so I'm not sure why this is showing up now.

@typescript-bot

typescript-bot commented Jan 12, 2021 •

Copy link
Copy Markdown
Contributor

@eramod Thank you for submitting this PR!

This is a live comment which I will keep updated.

2 packages in this PR

Code Reviews

Because this PR edits multiple packages, it can be merged once it's reviewed by a DT maintainer.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ❌ A DT maintainer needs to approve changes which affect more than one package

Once every item on this list is checked, I'll ask you for permission to merge and publish the changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 50545,
  "author": "eramod",
  "headCommitOid": "4a4888089ed8baca0edaf73f712b895ced277bb2",
  "lastPushDate": "2021-01-14T18:19:59.000Z",
  "lastActivityDate": "2021-01-14T20:22:07.000Z",
  "maintainerBlessed": false,
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "popularityLevel": "Well-liked by everyone",
  "pkgInfo": [
    {
      "name": "ember",
      "kind": "edit",
      "files": [
        {
          "path": "types/ember/index.d.ts",
          "kind": "definition"
        }
      ],
      "owners": [
        "jedmao",
        "bttf",
        "dwickern",
        "chriskrycho",
        "theroncross",
        "mfeckie",
        "alexlafroscia",
        "mike-north",
        "BryanCrotaz",
        "jamescdavis",
        "dfreeman"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Well-liked by everyone"
    },
    {
      "name": "ember__string",
      "kind": "edit",
      "files": [
        {
          "path": "types/ember__string/index.d.ts",
          "kind": "definition"
        }
      ],
      "owners": [
        "mike-north",
        "chriskrycho",
        "dfreeman",
        "jamescdavis"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Well-liked by everyone"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "chriskrycho",
      "date": "2021-01-14T19:08:23.000Z",
      "isMaintainer": false
    }
  ],
  "ciResult": "pass"
}

@typescript-bot

Copy link
Copy Markdown
Contributor

🔔 @jedmao @bttf @dwickern @chriskrycho @theroncross @mfeckie @alexlafroscia @mike-north @BryanCrotaz @jamescdavis @dfreeman — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

@typescript-bot typescript-bot added the The CI failed When GH Actions fails label Jan 12, 2021
@typescript-bot

Copy link
Copy Markdown
Contributor

@eramod The CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@typescript-bot

Copy link
Copy Markdown
Contributor

👋 Hi there! I’ve run some quick measurements against master and your PR. These metrics should help the humans reviewing this PR gauge whether it might negatively affect compile times or editor responsiveness for users who install these typings.

Let’s review the numbers, shall we?

Comparison details 📊
master #50545 diff
Batch compilation
Memory usage (MiB) 133.8 145.0 +8.3%
Type count 39099 39100 0%
Assignability cache size 10126 10126 0%
Language service
Samples taken 1008 1008 0%
Identifiers in tests 4531 4531 0%
getCompletionsAtPosition
    Mean duration (ms) 707.1 707.8 +0.1%
    Mean CV 8.3% 7.9%
    Worst duration (ms) 1047.4 1069.2 +2.1%
    Worst identifier get array
getQuickInfoAtPosition
    Mean duration (ms) 715.4 717.1 +0.2%
    Mean CV 8.6% 8.1%
    Worst duration (ms) 1084.9 1041.1 -4.0%
    Worst identifier overridden person

It looks like nothing changed too much. I won’t post performance data again unless it gets worse.

@typescript-bot typescript-bot added the Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. label Jan 12, 2021
@eramod
eramod force-pushed the update-htmlSafe-isHTMLSafe-types branch from 79c93e9 to 5f15dd9 Compare January 12, 2021 18:22
@typescript-bot

Copy link
Copy Markdown
Contributor

@eramod The CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@eramod
eramod force-pushed the update-htmlSafe-isHTMLSafe-types branch 3 times, most recently from 9f98c1d to cb28a7f Compare January 13, 2021 02:03
@typescript-bot

Copy link
Copy Markdown
Contributor

@eramod The CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@eramod
eramod force-pushed the update-htmlSafe-isHTMLSafe-types branch from cb28a7f to 23b4c78 Compare January 13, 2021 18:02
@typescript-bot typescript-bot removed the The CI failed When GH Actions fails label Jan 13, 2021
@dmytro-krekota

Copy link
Copy Markdown
Contributor

I have a build error related to the problem that the PR fixes. Please, approve and merge it 🙏.

@chriskrycho chriskrycho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @eramod!

Note to @dmytro-krekota: the folks who maintain these types do so in our free time. Please remember that. :)

@typescript-bot typescript-bot added the Owner Approved A listed owner of this package signed off on the pull request. label Jan 14, 2021
@eramod
eramod force-pushed the update-htmlSafe-isHTMLSafe-types branch from 23b4c78 to 4a48880 Compare January 14, 2021 18:20
@typescript-bot typescript-bot removed the Owner Approved A listed owner of this package signed off on the pull request. label Jan 14, 2021
@typescript-bot

Copy link
Copy Markdown
Contributor

@chriskrycho Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

@eramod

eramod commented Jan 14, 2021

Copy link
Copy Markdown
Contributor Author

Thanks for the double approval @chriskrycho. Some code I'd deleted snuck back in on a rebase.

@chriskrycho

Copy link
Copy Markdown
Contributor

No problem! I have been there so very many times!

@weswigham
weswigham merged commit 8f093d3 into DefinitelyTyped:master Jan 14, 2021
@typescript-bot

Copy link
Copy Markdown
Contributor

I just published @types/[email protected] to npm.

@typescript-bot

Copy link
Copy Markdown
Contributor

I just published @types/[email protected] to npm.

// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.7

export { htmlSafe, isHTMLSafe } from '@ember/template';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure removing this re-export was actually the right thing. See discussions in: #38571

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gah, I had a vague memory there was something like that but when I went poking around I couldn’t find it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can’t actually find either any public documentation of the @ember/string exports or deprecations thereof, but I believe the issue that spawned this PR was due to @ember/string’s incorrectly publishing types, so presumably they are public? This seems to be a bit of a mess. 😬

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a mess. The@ember/string package is written in TS and does indeed ship types (that don't include htmlSafe and isHTMLSafe because they are not implemented there), but that package is an addon of string utilities extracted from Ember. ember-source also provides @ember/string, which does include htmlSafe and isHTMLSafe as demonstrated in this twiddle (they are added to @ember/string here in ember-source, where htmlSafe is defined here and isHTMLSafe is defined here). The @ember/string package is not a dep of ember-source, but is is a dep of ember-data as of 3.24: warp-drive-data/warp-drive#7356. Twiddle only goes up to 3.18, so I tried the same thing I did there locally with a fresh 3.24 app and it still works (is functional) but fails to typecheck. Just downgrading to @types/[email protected] does not work in this case because [email protected] has installed the @ember/string package and TS is using it's types rather than @types/ember__string. If I remove ember-data (and thus the @ember/string package) with the downgraded @types/ember__string, it typechecks (and is functional). A solution that does work for both cases, however, is using module augmentation here instead of module declaration. I'll open a PR shortly for this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, wait found more info!: emberjs/rfc-tracking#26
IMHO we should leave these in until removed (which I assume won't be until Ember 4.0).

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

Labels

Edits multiple packages Owner Approved A listed owner of this package signed off on the pull request. Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. Untested Change This PR does not touch tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants