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: Add regenerator‑runtime
type definition
#46276
feat: Add regenerator‑runtime
type definition
#46276
Conversation
@ExE-Boss Thank you for submitting this PR! This is a live comment which I will keep updated. Code ReviewsThis PR adds a new definition, so it needs to be reviewed by a DT maintainer before it can be merged. Status
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": 46276,
"author": "ExE-Boss",
"owners": [],
"dangerLevel": "ScopedAndConfiguration",
"headCommitAbbrOid": "9cf0b9c",
"headCommitOid": "9cf0b9cb231e368c4f657698454cf1d9811d4a97",
"mergeIsRequested": true,
"stalenessInDays": 0,
"lastPushDate": "2020-07-28T16:09:50.000Z",
"lastCommentDate": "2020-07-29T16:06:28.000Z",
"maintainerBlessed": false,
"reviewLink": "https://github.com/DefinitelyTyped/DefinitelyTyped/pull/46276/files",
"hasMergeConflict": false,
"authorIsOwner": false,
"isFirstContribution": false,
"popularityLevel": "Well-liked by everyone",
"anyPackageIsNew": true,
"packages": [
"regenerator-runtime"
],
"files": [
{
"path": "types/regenerator-runtime/index.d.ts",
"kind": "definition",
"package": "regenerator-runtime"
},
{
"path": "types/regenerator-runtime/regenerator-runtime-tests.ts",
"kind": "test",
"package": "regenerator-runtime"
},
{
"path": "types/regenerator-runtime/tsconfig.json",
"kind": "package-meta",
"package": "regenerator-runtime",
"suspect": "created"
},
{
"path": "types/regenerator-runtime/tslint.json",
"kind": "package-meta-ok",
"package": "regenerator-runtime"
}
],
"hasDismissedReview": false,
"ciResult": "pass",
"lastReviewDate": "2020-07-29T15:34:21.000Z",
"reviewersWithStaleReviews": [
{
"reviewedAbbrOid": "0743779",
"reviewer": "sheetalkamat",
"date": "2020-07-23T18:27:21Z"
}
],
"approvalFlags": 4,
"isChangesRequested": false
} |
🔔 @ExE-Boss — you're the only owner, but it would still be good if you find someone to review this PR in the next few days, otherwise a maintainer will look at it. (And if you do find someone, maybe even recruit them to be a second owner to make future changes easier...) |
👋 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 regenerator-runtime with its source on master. Comparison details 📊
|
export function async<T = undefined, TReturn = unknown>( | ||
innerFn: InnerFunction<T, unknown, TReturn>, | ||
// tslint:disable-next-line: ban-types | ||
outerFn?: Function | null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not disable this error:: Fix this instead by changing to () => void
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That signature is incorrect, as it won’t accept newable‑only functions and anything that takes at least one required parameter.
The Function
type most closely describes what the wrap
and async
functions need: https://github.com/facebook/regenerator/blob/0566ce53c67b5fe1de13b47ed4db00570de7d9f6/packages/regenerator-runtime/runtime.js#L39.
Technically it’s { prototype?: unknown }
, but that causes:
TS2559: Type '<T, U, TNext = unknown>(this: Iterator<T, unknown, TNext>, mapper: (value: T) => U) => Generator<U, void, TNext>' has no properties in common with type '{ prototype?: unknown; }'
@ExE-Boss One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits or comments. If you disagree with the reviewer's comments, you can "dismiss" the review using GitHub's review UI. Thank you! |
@sheetalkamat Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review? |
@ExE-Boss Everything looks good here. Great job! I am ready to merge this PR on your behalf. If you'd like that to happen, please post a comment saying:
and I'll merge this PR almost instantly. Thanks for helping out! ❤️ |
Ready to merge |
… definition by @ExE-Boss * feat: Add `regenerator‑runtime` type definition * fix(regenerator‑runtime/mark): Preserve overloads * fix(regenerator‑runtime): Improve order of `context.abrupt(…)` inference * fix(regenerator‑runtime): Fix `AsyncIterator.next` signature
… definition by @ExE-Boss * feat: Add `regenerator‑runtime` type definition * fix(regenerator‑runtime/mark): Preserve overloads * fix(regenerator‑runtime): Improve order of `context.abrupt(…)` inference * fix(regenerator‑runtime): Fix `AsyncIterator.next` signature
Please fill in this template.
npm test
.)npm run lint package-name
(ortsc
if notslint.json
is present).If adding a new definition:
.d.ts
files generated via--declaration
dts-gen --dt
, not by basing it on an existing project.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 havenoImplicitAny
,noImplicitThis
,strictNullChecks
, andstrictFunctionTypes
set totrue
.