Skip to content

[gtag.js] Replace function overload with generics - #66939

Merged
typescript-bot merged 2 commits into
DefinitelyTyped:masterfrom
HugeLetters:gtag
Oct 6, 2023
Merged

typescript-bot merged 2 commits into
DefinitelyTyped:masterfrom
HugeLetters:gtag

Conversation

@HugeLetters

@HugeLetters HugeLetters commented Oct 5, 2023 •

Copy link
Copy Markdown
Contributor

Changes

These changes don't change the behavior for the end-user but switching from overloads to generics brings a much nicer autocomplete as shown in the videos below. TS picks-up argument types from the correct function branch and recognizes on which branch you're from the first argument.
See microsoft/TypeScript#26892

old-overload.mov
new-generics.mov

@HugeLetters HugeLetters changed the title gtag.js: Replace function overload with generics [gtag.js] Replace function overload with generics Oct 5, 2023
@typescript-bot

typescript-bot commented Oct 5, 2023 •

Copy link
Copy Markdown
Contributor

@HugeLetters Thank you for submitting this PR! I see this is your first time submitting to DefinitelyTyped 👋 — I'm the local bot who will help you through the process of getting things through.

This is a live comment which I will keep updated.

1 package in this PR

Code Reviews

This PR can be merged once it's reviewed by a DT maintainer.

You can test the changes of this PR in the Playground.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ✅ Only a DT maintainer can approve changes without tests

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": 66939,
  "author": "HugeLetters",
  "headCommitOid": "d335d833b0344b65d6d71518fa81ca48b0b28f7b",
  "mergeBaseOid": "9b0635e961b26ce033e49062b4e0d60485b1567f",
  "lastPushDate": "2023-10-05T15:14:15.000Z",
  "lastActivityDate": "2023-10-06T16:40:55.000Z",
  "mergeOfferDate": "2023-10-06T16:40:39.000Z",
  "mergeRequestDate": "2023-10-06T16:40:55.000Z",
  "mergeRequestUser": "HugeLetters",
  "hasMergeConflict": false,
  "isFirstContribution": true,
  "tooManyFiles": false,
  "hugeChange": false,
  "popularityLevel": "Popular",
  "pkgInfo": [
    {
      "name": "gtag.js",
      "kind": "edit",
      "files": [
        {
          "path": "types/gtag.js/index.d.ts",
          "kind": "definition"
        }
      ],
      "owners": [
        "rokt33r",
        "KsAkira10"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Popular"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "rbuckton",
      "date": "2023-10-06T16:39:55.000Z",
      "isMaintainer": true
    }
  ],
  "mainBotCommentID": 1749110842,
  "ciResult": "pass"
}

@typescript-bot typescript-bot added Popular package This PR affects a popular package (as counted by NPM download counts). Untested Change This PR does not touch tests labels Oct 5, 2023
@typescript-bot

Copy link
Copy Markdown
Contributor

🔔 @Rokt33r @KsAkira10 — 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.

Comment thread types/gtag.js/index.d.ts Resolved
@typescript-bot typescript-bot added Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner labels Oct 6, 2023
@HugeLetters

Copy link
Copy Markdown
Contributor Author

Ready to merge

@typescript-bot
typescript-bot merged commit e8af086 into DefinitelyTyped:master Oct 6, 2023

@KsAkira10 KsAkira10 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.

LGTM!

@KsAkira10

Copy link
Copy Markdown
Contributor

Ready to merge

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

Labels

Maintainer Approved Popular package This PR affects a popular package (as counted by NPM download counts). Self Merge This PR can now be self-merged by the PR author or an owner Untested Change This PR does not touch tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants