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

[@ember/string] augment @ember/string with htmlSafe and isHTMLSafe #50653

Merged

Conversation

jamescdavis
Copy link
Contributor

@jamescdavis jamescdavis commented Jan 15, 2021

#50545 prematurely removed htmlSafe and isHTMLSafe from @ember/string. This adds them back because they continue to be available to be imported from there in addition to @ember/template (this is deprecated, but not removed). I've added them back using module augmentation so that they will augment the types shipped with the external @ember/string package when present (it's a dependency of ember-data starting with ember-data@3.24. Module augmentation does not allow simply re-exporting from @ember/template, but, rather than completely redefine the types for these functions, I grab the parameter and return types from @ember/template and use them here.

I've opened emberjs/ember.js#19339 to actually deprecate this in the Ember codebase.

Please fill in this template.

Select one of these and delete the others:

If changing an existing definition:

  • Provide a URL to documentation or source code which provides context for the suggested changes:
    • htmlSafe and isHTMLSafe are added to @ember/string here
      (Ember.String is importable as @ember/string in Ember)
    • definition of htmlSafe
    • definition of isHTMLSafe
  • If this PR brings the type definitions up to date with a new version of the JS library, update the version number in the header.

@typescript-bot
Copy link
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 #50653 diff
Batch compilation
Memory usage (MiB) 81.1 71.1 -12.3%
Type count 10471 10505 0%
Assignability cache size 3638 3650 0%
Language service
Samples taken 32 40 +25%
Identifiers in tests 32 40 +25%
getCompletionsAtPosition
    Mean duration (ms) 380.9 373.6 -1.9%
    Mean CV 13.3% 11.6%
    Worst duration (ms) 438.5 513.0 +17.0%
    Worst identifier capitalize htmlSafe
getQuickInfoAtPosition
    Mean duration (ms) 373.3 365.1 -2.2%
    Mean CV 12.6% 12.3%
    Worst duration (ms) 434.6 430.1 -1.0%
    Worst identifier w w

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 15, 2021
@jamescdavis
Copy link
Contributor Author

@eramod I'd love it if you could test this on your code.

@typescript-bot typescript-bot added the Author is Owner The author of this PR is a listed owner of the package. label Jan 15, 2021
@typescript-bot typescript-bot added this to Waiting for Code Reviews in New Pull Request Status Board Jan 15, 2021
@typescript-bot
Copy link
Contributor

typescript-bot commented Jan 15, 2021

@jamescdavis Thank you for submitting this PR!

This is a live comment which I will keep updated.

1 package in this PR

Code Reviews

Because you edited one package and updated the tests (👏), I can help you merge this PR once someone else signs off on it.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ✅ Most recent commit is approved by type definition owners, DT maintainers or others

All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 50653,
  "author": "jamescdavis",
  "headCommitOid": "bf56063514bd6294ab082d8dbebd89a4e93c3eee",
  "lastPushDate": "2021-01-15T19:03:44.000Z",
  "lastActivityDate": "2021-01-18T17:03:30.000Z",
  "maintainerBlessed": false,
  "mergeOfferDate": "2021-01-18T17:01:34.000Z",
  "mergeRequestDate": "2021-01-18T17:03:30.000Z",
  "mergeRequestUser": "jamescdavis",
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "popularityLevel": "Well-liked by everyone",
  "pkgInfo": [
    {
      "name": "ember__string",
      "kind": "edit",
      "files": [
        {
          "path": "types/ember__string/ember__string-tests.ts",
          "kind": "test"
        },
        {
          "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": "dfreeman",
      "date": "2021-01-18T17:00:58.000Z",
      "isMaintainer": false
    }
  ],
  "ciResult": "pass"
}

@typescript-bot
Copy link
Contributor

🔔 @mike-north @chriskrycho @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 Owner Approved A listed owner of this package signed off on the pull request. Self Merge This PR can now be self-merged by the PR author or an owner labels Jan 18, 2021
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Waiting for Author to Merge in New Pull Request Status Board Jan 18, 2021
@typescript-bot
Copy link
Contributor

@jamescdavis Everything looks good here. Great job! I am ready to merge this PR (at bf56063) on your behalf.

If you'd like that to happen, please post a comment saying:

Ready to merge

and I'll merge this PR almost instantly. Thanks for helping out! ❤️

(@mike-north, @chriskrycho, @dfreeman: you can do this too.)

@jamescdavis
Copy link
Contributor Author

Ready to merge

@typescript-bot typescript-bot moved this from Waiting for Author to Merge to Recently Merged in New Pull Request Status Board Jan 18, 2021
@typescript-bot typescript-bot merged commit 0662102 into DefinitelyTyped:master Jan 18, 2021
@jamescdavis jamescdavis deleted the augment_ember__string branch January 18, 2021 17:05
@typescript-bot
Copy link
Contributor

I just published @types/ember__string@3.16.3 to npm.

@typescript-bot typescript-bot removed this from Recently Merged in New Pull Request Status Board Jan 18, 2021
kaznovac pushed a commit to kaznovac/DefinitelyTyped that referenced this pull request Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author is Owner The author of this PR is a listed owner of the package. 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. Self Merge This PR can now be self-merged by the PR author or an owner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants