Skip to content

postcss-less > Fix incorrect generic type parameter #58082

Merged
weswigham merged 1 commit intoDefinitelyTyped:masterfrom
dmisdm:patch-1
Jan 10, 2022
Merged

postcss-less > Fix incorrect generic type parameter #58082
weswigham merged 1 commit intoDefinitelyTyped:masterfrom
dmisdm:patch-1

Conversation

@dmisdm
Copy link
Copy Markdown
Contributor

@dmisdm dmisdm commented Jan 10, 2022

The introduction of the Document type in this PR incorrectly advertises that parse can return a Document object, because the Parser interface is now generic.

This PR exposes the parser as a more specific type of Parser so that consumers aren't given a Root | Document, but just a Root.

Please fill in this template.

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 contain { "extends": "@definitelytyped/dtslint/dt.json" }, and no additional rules.
  • tsconfig.json should have noImplicitAny, noImplicitThis, strictNullChecks, and strictFunctionTypes set to true.

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 removing a declaration:

  • If a package was never on Definitely Typed, you don't need to do anything. (If you wrote a package and provided types, you don't need to register it with us.)
  • Delete the package's directory.
  • Add it to notNeededPackages.json.

The introduction of the `Document` type [in this PR](postcss/postcss#1582) incorrectly advertises that `parse` can return a `Document` object, because the [`Parser` interface is now generic](https://github.com/postcss/postcss/pull/1582/files#diff-68ba6abc949516587990ca61016794e81039fd6ae58437d5cfaccd4eeebdac07R224).

This PR exposes the parser as a more specific type of `Parser` so that consumers aren't given a `Root | Document`, but just a `Root`.
@dmisdm dmisdm changed the title Package: postcss-less > Fix incorrect generic type parameter postcss-less > Fix incorrect generic type parameter Jan 10, 2022
@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Jan 10, 2022

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

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": 58082,
  "author": "dmisdm",
  "headCommitOid": "f82b19ac6d92e0a3e0d67ec16a58135a3237ff9e",
  "mergeBaseOid": "11922d0a92d48a9f55611a0cfb7ac8c4f586c854",
  "lastPushDate": "2022-01-10T02:08:17.000Z",
  "lastActivityDate": "2022-01-10T07:56:02.000Z",
  "hasMergeConflict": false,
  "isFirstContribution": true,
  "tooManyFiles": false,
  "hugeChange": false,
  "popularityLevel": "Well-liked by everyone",
  "pkgInfo": [
    {
      "name": "postcss-less",
      "kind": "edit",
      "files": [
        {
          "path": "types/postcss-less/index.d.ts",
          "kind": "definition"
        }
      ],
      "owners": [
        "ybiquitous",
        "djcsdy"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Well-liked by everyone"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "martin-badin",
      "date": "2022-01-10T07:56:02.000Z",
      "isMaintainer": false
    },
    {
      "type": "approved",
      "reviewer": "ybiquitous",
      "date": "2022-01-10T07:13:33.000Z",
      "isMaintainer": false
    }
  ],
  "mainBotCommentID": 1008489514,
  "ciResult": "pass"
}

@typescript-bot typescript-bot added the Untested Change This PR does not touch tests label Jan 10, 2022
@typescript-bot
Copy link
Copy Markdown
Contributor

🔔 @ybiquitous @djcsdy — 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.

Copy link
Copy Markdown
Contributor

@ybiquitous ybiquitous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmisdm Thanks! LGTM 👍🏼

@typescript-bot typescript-bot added the Owner Approved A listed owner of this package signed off on the pull request. label Jan 10, 2022
@typescript-bot typescript-bot added the Other Approved This PR was reviewed and signed-off by a community member. label Jan 10, 2022
@weswigham weswigham merged commit c500a3f into DefinitelyTyped:master Jan 10, 2022
martin-badin pushed a commit to martin-badin/DefinitelyTyped that referenced this pull request Feb 23, 2022
The introduction of the `Document` type [in this PR](postcss/postcss#1582) incorrectly advertises that `parse` can return a `Document` object, because the [`Parser` interface is now generic](https://github.com/postcss/postcss/pull/1582/files#diff-68ba6abc949516587990ca61016794e81039fd6ae58437d5cfaccd4eeebdac07R224).

This PR exposes the parser as a more specific type of `Parser` so that consumers aren't given a `Root | Document`, but just a `Root`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Other Approved This PR was reviewed and signed-off by a community member. Owner Approved A listed owner of this package signed off on the pull request. Untested Change This PR does not touch tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants