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

feat(react): Support react-jsx and react-jsxdev #49701

Merged
merged 1 commit into from
Nov 20, 2020

Conversation

eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Nov 20, 2020

Adds support for "jsx": "react-jsx" and "jsx": "react-jsxdev" compiler options in TypeScript 4.1 (backports jsx-runtime*.d.ts from #48971).

I don't know how I could test this in the DT repo. Ideally we could control the TS version + compiler options in a test matrix.

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:
  • 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.
  • If you are making substantial changes, consider adding a tslint.json containing { "extends": "dtslint/dt.json" }. If for reason the any rule need to be disabled, disable it for that line using // tslint:disable-next-line [ruleName] and not for whole package so that the need for disabling can be reviewed.

@typescript-bot typescript-bot added this to Needs Author Action in New Pull Request Status Board Nov 20, 2020
@eps1lon eps1lon marked this pull request as ready for review November 20, 2020 12:10
@typescript-bot typescript-bot added Critical package Author is Owner The author of this PR is a listed owner of the package. Untested Change This PR does not touch tests labels Nov 20, 2020
@typescript-bot
Copy link
Contributor

typescript-bot commented Nov 20, 2020

@eps1lon Thank you for submitting this PR!

This is a live comment which I will keep updated.

This PR doesn't modify any tests, so it's hard to know what's being fixed, and your changes might regress in the future. Have you considered adding tests to cover the change you're making? Including tests allows this PR to be merged by yourself and the owners of this module. This can potentially save days of time for you.

1 package in this PR

Code Reviews

Because this is a widely-used package, a DT maintainer will need to review it before it can be merged.

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": 49701,
  "author": "eps1lon",
  "headCommitAbbrOid": "8ce1f86",
  "headCommitOid": "8ce1f86b77cb46d3db339c20d9fab54377589693",
  "stalenessInDays": 0,
  "lastPushDate": "2020-11-20T11:43:29.000Z",
  "reopenedDate": "2020-11-20T12:10:52.000Z",
  "lastCommentDate": "2020-11-20T13:16:19.000Z",
  "maintainerBlessed": false,
  "mergeOfferDate": "2020-11-20T12:18:16.000Z",
  "mergeRequestDate": "2020-11-20T13:16:19.000Z",
  "mergeRequestUser": "ferdaber",
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "react",
      "kind": "edit",
      "files": [
        {
          "path": "types/react/OTHER_FILES.txt",
          "kind": "package-meta-ok"
        },
        {
          "path": "types/react/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/react/jsx-dev-runtime.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/react/jsx-runtime.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/react/v15/OTHER_FILES.txt",
          "kind": "package-meta-ok"
        },
        {
          "path": "types/react/v15/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/react/v15/jsx-dev-runtime.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/react/v15/jsx-runtime.d.ts",
          "kind": "definition"
        }
      ],
      "owners": [
        "johnnyreilly",
        "bbenezech",
        "pzavolinsky",
        "digiguru",
        "ericanderson",
        "DovydasNavickas",
        "theruther4d",
        "guilhermehubner",
        "ferdaber",
        "jrakotoharisoa",
        "pascaloliv",
        "hotell",
        "franklixuefei",
        "Jessidhia",
        "saranshkataria",
        "lukyth",
        "eps1lon",
        "zieka",
        "dancerphil",
        "dimitropoulos",
        "disjukr",
        "vhfmag",
        "hellatan"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "johnnyreilly",
      "date": "2020-11-20T12:17:39.000Z",
      "isMaintainer": true
    }
  ],
  "ciResult": "pass"
}

@typescript-bot typescript-bot moved this from Needs Author Action to Needs Maintainer Review in New Pull Request Status Board Nov 20, 2020
@typescript-bot
Copy link
Contributor

🔔 @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @DovydasNavickas @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @Hotell @franklixuefei @Jessidhia @saranshkataria @lukyth @zieka @dancerphil @dimitropoulos @disjukr @vhfmag @hellatan — 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 Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner labels Nov 20, 2020
@typescript-bot typescript-bot moved this from Needs Maintainer Review to Waiting for Author to Merge in New Pull Request Status Board Nov 20, 2020
@ferdaber
Copy link
Contributor

Thank you for jumping in so quickly overnight to resolve this 🙏🏻

@ferdaber
Copy link
Contributor

Ready to merge

@typescript-bot typescript-bot moved this from Waiting for Author to Merge to Recently Merged in New Pull Request Status Board Nov 20, 2020
@typescript-bot typescript-bot merged commit c976060 into DefinitelyTyped:master Nov 20, 2020
@ferdaber
Copy link
Contributor

I’m a bit surprised that 4.1 doesn’t require the jsx and jsx_dev callable signatures to be declared. Let’s keep a close eye on this

@jasonwilliams
Copy link

@ferdaber When does this get promoted to npm?

@typescript-bot
Copy link
Contributor

I just published @types/react@16.14.0 to npm.

@typescript-bot
Copy link
Contributor

I just published @types/react@15.7.0 to npm.

@eps1lon
Copy link
Collaborator Author

eps1lon commented Nov 20, 2020

@ferdaber When does this get promoted to npm?

@jasonwilliams Typings for React 15 (@types/react@15.7.0) and 16 (@types/react@16.14.0) are now available.

@jasonwilliams
Copy link

@eps1lon is React 17 covered? I had issues with Could not find a declaration file for module 'react/jsx-runtime' since updating to version 17 and typescript 4.1

Sorry if this is the wrong place to ask

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

These typings are for a version of react that doesn’t yet exist on master, so I’ve compared them with v16.9.

Comparison details 📊
16.9@master 16.14 in #49701 diff
Batch compilation
Memory usage (MiB) 126.1 125.5 -0.4%
Type count 34870 34870 0%
Assignability cache size 8164 8164 0%
Language service
Samples taken 2854 2854 0%
Identifiers in tests 2935 2935 0%
getCompletionsAtPosition
    Mean duration (ms) 264.3 264.7 +0.1%
    Mean CV 9.0% 8.8%
    Worst duration (ms) 1074.5 1168.5 +8.7%
    Worst identifier memoized4Ref memoized4Ref
getQuickInfoAtPosition
    Mean duration (ms) 264.1 264.4 +0.1%
    Mean CV 9.4% 9.1%
    Worst duration (ms) 808.8 862.5 +6.6%
    Worst identifier ref ref

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 Nov 20, 2020
@ferdaber
Copy link
Contributor

The work for React 17 is being tracked in #48971

@eps1lon eps1lon deleted the feat/jsx-react branch November 20, 2020 14:33
@typescript-bot typescript-bot removed this from Recently Merged in New Pull Request Status Board Nov 20, 2020
owenlow pushed a commit to owenlow/DefinitelyTyped that referenced this pull request Dec 8, 2020
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. Critical package Maintainer Approved 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 Untested Change This PR does not touch tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants