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
[Ember] Update htmlSafe and isHTMLSafe types to import from '@ember/template' #50545
[Ember] Update htmlSafe and isHTMLSafe types to import from '@ember/template' #50545
Conversation
@eramod Thank you for submitting this PR! This is a live comment which I will keep updated. 2 packages in this PR
Code ReviewsBecause this PR edits multiple packages, it can be merged once it's reviewed by a DT maintainer. Status
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"
} |
🔔 @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 |
@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! |
👋 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 📊
It looks like nothing changed too much. I won’t post performance data again unless it gets worse. |
79c93e9
to
5f15dd9
Compare
@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! |
9f98c1d
to
cb28a7f
Compare
@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! |
cb28a7f
to
23b4c78
Compare
I have a build error related to the problem that the PR fixes. Please, approve and merge it 🙏. |
There was a problem hiding this comment.
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. :)
23b4c78
to
4a48880
Compare
@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? |
Thanks for the double approval @chriskrycho. Some code I'd deleted snuck back in on a rebase. |
No problem! I have been there so very many times! |
I just published |
I just published |
@@ -7,8 +7,6 @@ | |||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | |||
// TypeScript Version: 3.7 | |||
|
|||
export { htmlSafe, isHTMLSafe } from '@ember/template'; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. 😬
There was a problem hiding this comment.
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: emberjs/data#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/ember__string@3.16.1
does not work in this case because ember-data@3.24
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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).
…emplate' (DefinitelyTyped#50545) * [Ember] Update htmlSafe types to import from '@ember/template' * Update htmlSafe and isHTMLSafe types
Updates types for
htmlSafe
andisHTMLSafe
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
andisHTMLSafe
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.