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

Add babel-plugin-react-html-attrs type extensions for React #44416

Merged
merged 3 commits into from May 13, 2020

Conversation

insin
Copy link
Contributor

@insin insin commented May 1, 2020

Please fill in this template.

  • 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. (Run with npm test.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).

Select one of these and delete the others:

If adding a new definition:

  • The package does not already provide its own types, or cannot have its .d.ts files generated via --declaration
  • If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package.
  • Create it with dts-gen --dt, not by basing it on an existing project.
  • Represents shape of module/library correctly
  • tslint.json should be present and it shouldn't have any additional or disabling of rules. Just content as { "extends": "dtslint/dt.json" }. If for reason the some 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.
  • tsconfig.json should have noImplicitAny, noImplicitThis, strictNullChecks, and strictFunctionTypes set to true.

@typescript-bot typescript-bot added New Definition This PR creates a new definition package. Where is Travis? labels May 1, 2020
@typescript-bot
Copy link
Contributor

@typescript-bot typescript-bot commented May 1, 2020

@insin Thank you for submitting this PR! I see this is your first time submitting to DefinitelyTyped 👋 - keep an eye on this comment as I'll be updating it with information as things progress.

Code Reviews

This PR adds a new definition, so it needs to be reviewed by a DT maintainer before it can be merged.

Status

  • No merge conflicts
  • Continuous integration tests have passed
  • Only a DT maintainer can merge changes when there are new packages added

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": 44416,
  "author": "insin",
  "owners": [],
  "dangerLevel": "ScopedAndConfiguration",
  "headCommitAbbrOid": "d6df744",
  "headCommitOid": "d6df74423c5b86c825bd3d8ef09438cf2f342351",
  "mergeIsRequested": false,
  "stalenessInDays": 10,
  "lastCommitDate": "2020-05-02T06:24:28.000Z",
  "lastCommentDate": "2020-05-02T06:28:18.000Z",
  "reviewLink": "https://github.com/DefinitelyTyped/DefinitelyTyped/pull/44416/files",
  "hasMergeConflict": false,
  "authorIsOwner": false,
  "isFirstContribution": true,
  "popularityLevel": "Well-liked by everyone",
  "anyPackageIsNew": true,
  "packages": [
    "babel-plugin-react-html-attrs"
  ],
  "files": [
    {
      "filePath": "types/babel-plugin-react-html-attrs/OTHER_FILES.txt",
      "kind": "package-meta",
      "package": "babel-plugin-react-html-attrs"
    },
    {
      "filePath": "types/babel-plugin-react-html-attrs/babel-plugin-react-html-attrs-tests.tsx",
      "kind": "test",
      "package": "babel-plugin-react-html-attrs"
    },
    {
      "filePath": "types/babel-plugin-react-html-attrs/experimental.d.ts",
      "kind": "definition",
      "package": "babel-plugin-react-html-attrs"
    },
    {
      "filePath": "types/babel-plugin-react-html-attrs/global.d.ts",
      "kind": "definition",
      "package": "babel-plugin-react-html-attrs"
    },
    {
      "filePath": "types/babel-plugin-react-html-attrs/index.d.ts",
      "kind": "definition",
      "package": "babel-plugin-react-html-attrs"
    },
    {
      "filePath": "types/babel-plugin-react-html-attrs/package.json",
      "kind": "package-meta",
      "package": "babel-plugin-react-html-attrs"
    },
    {
      "filePath": "types/babel-plugin-react-html-attrs/tsconfig.json",
      "kind": "package-meta",
      "package": "babel-plugin-react-html-attrs"
    },
    {
      "filePath": "types/babel-plugin-react-html-attrs/tslint.json",
      "kind": "package-meta",
      "package": "babel-plugin-react-html-attrs"
    }
  ],
  "hasDismissedReview": false,
  "travisResult": "pass",
  "reviewersWithStaleReviews": [],
  "approvalFlags": 0,
  "isChangesRequested": false
}

@typescript-bot typescript-bot moved this from Other to Needs Author Action in New Pull Request Status Board May 1, 2020
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in New Pull Request Status Board May 1, 2020
@typescript-bot
Copy link
Contributor

@typescript-bot typescript-bot commented May 1, 2020

👋 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 package that doesn’t yet exist on master, so I don’t have anything to compare against yet! In the future, I’ll be able to compare PRs to babel-plugin-react-html-attrs with its source on master.

Comparison details 📊
Batch compilation
Type count 15954
Assignability cache size 34506
Language service measurements
Samples taken 170
Identifiers in tests 170
getCompletionsAtPosition
    Mean duration (ms) 287.3
    Mean CV 9.8%
    Worst duration (ms) 345.3
    Worst identifier text-decoration
getQuickInfoAtPosition
    Mean duration (ms) 277.5
    Mean CV 9.9%
    Worst duration (ms) 342.7
    Worst identifier text-decoration
System information
Node version v12.16.1
CPU count 2
CPU speed 2.095 GHz
CPU model Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz
CPU Architecture x64
Memory 6.8 GiB
Platform linux
Release 4.15.0-1077-azure

insin added 2 commits May 1, 2020
…umeric HTML attribute support

This had to be done as not possible to override existing imported types
(e.g. so  boolean attributes can be `boolean | string` instead of
`boolean`), which probably makes this type definition academic as it
probably breaks when  you use other typedefs which import @types/react.
@insin
Copy link
Contributor Author

@insin insin commented May 2, 2020

This PR started out adding extensions to @types/react for HTML attributes which weren't defined due to being different from their DOM property equivalents, but since you can't override existing types on interfaces it's become necessary to fork it in order to provide full boolean and numeric HTML attribute support for attributes already defined in @types/react which have the same name in HTML and the DOM.

As such, it now has the same exceptions to the definition guidelines in the PR template as @types/react.

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in New Pull Request Status Board May 11, 2020
@sandersn sandersn merged commit 99bf4d7 into DefinitelyTyped:master May 13, 2020
3 checks passed
@typescript-bot typescript-bot removed this from Needs Maintainer Review in New Pull Request Status Board May 13, 2020
@typescript-bot
Copy link
Contributor

@typescript-bot typescript-bot commented May 13, 2020

I just published @types/babel-plugin-react-html-attrs@3.0.0 to npm.

jjballano-qatium pushed a commit to jjballano-qatium/DefinitelyTyped that referenced this issue Jun 16, 2020
…lyTyped#44416)

* Add babel-plugin-react-html-attrs type extensions for React

* Update types and test for babel-plugin-react-html-attrs@3.0.2

* This is now a fork of @types/react in order to add full boolean and numeric HTML attribute support

This had to be done as not possible to override existing imported types
(e.g. so  boolean attributes can be `boolean | string` instead of
`boolean`), which probably makes this type definition academic as it
probably breaks when  you use other typedefs which import @types/react.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Definition This PR creates a new definition package.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants