-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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 function.prototype.name
#66734
add function.prototype.name
#66734
Conversation
@ljharb Thank you for submitting this PR! This is a live comment which I will keep updated. 1 package in this PR
Code ReviewsThis PR adds a new definition, so it needs to be reviewed by a DT maintainer before it can be merged. You can test the changes of this PR in the Playground. Status
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": 66734,
"author": "ljharb",
"headCommitOid": "521d0a3c41bc94502be878611ab8955de83fd065",
"mergeBaseOid": "3a2e6cbf0c40245af9f02b5011da2ea713cd351d",
"lastPushDate": "2023-09-18T06:01:52.000Z",
"lastActivityDate": "2023-09-26T23:22:08.000Z",
"mergeOfferDate": "2023-09-26T19:59:42.000Z",
"mergeRequestDate": "2023-09-26T23:22:08.000Z",
"mergeRequestUser": "ljharb",
"hasMergeConflict": false,
"isFirstContribution": false,
"tooManyFiles": false,
"hugeChange": false,
"popularityLevel": "Well-liked by everyone",
"pkgInfo": [
{
"name": "function.prototype.name",
"kind": "add",
"files": [
{
"path": "types/function.prototype.name/auto.d.ts",
"kind": "definition"
},
{
"path": "types/function.prototype.name/function.prototype.name-tests.ts",
"kind": "test"
},
{
"path": "types/function.prototype.name/implementation.d.ts",
"kind": "definition"
},
{
"path": "types/function.prototype.name/index.d.ts",
"kind": "definition"
},
{
"path": "types/function.prototype.name/polyfill.d.ts",
"kind": "definition"
},
{
"path": "types/function.prototype.name/shim.d.ts",
"kind": "definition"
},
{
"path": "types/function.prototype.name/tsconfig.json",
"kind": "package-meta",
"suspect": "not [the expected form](https://github.com/DefinitelyTyped/DefinitelyTyped#user-content-tsconfigjson) (check: `compilerOptions.esModuleInterop`)"
},
{
"path": "types/function.prototype.name/tslint.json",
"kind": "package-meta-ok"
}
],
"owners": [],
"addedOwners": [
"ljharb"
],
"deletedOwners": [],
"popularityLevel": "Well-liked by everyone"
}
],
"reviews": [
{
"type": "approved",
"reviewer": "RyanCavanaugh",
"date": "2023-09-26T19:58:55.000Z",
"isMaintainer": true
},
{
"type": "stale",
"reviewer": "sheetalkamat",
"date": "2023-09-22T18:35:08.000Z",
"abbrOid": "1167a14"
}
],
"mainBotCommentID": 1722798192,
"ciResult": "pass"
} |
🔔 @ljharb — 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...) |
@ljharb The CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! Note: builds which are failing do not end up on the list of PRs for the DT maintainers to review. |
d320dd4
to
e80ee56
Compare
@ljharb The CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! Note: builds which are failing do not end up on the list of PRs for the DT maintainers to review. |
e80ee56
to
062bc18
Compare
@ljharb The CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! Note: builds which are failing do not end up on the list of PRs for the DT maintainers to review. |
062bc18
to
16c1d13
Compare
type Func = (...args: any[]) => any; | ||
|
||
declare function name(): (this: Func) => string; | ||
|
||
export = name; |
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.
I dont think you need all these files. you just need index.d.ts since rest are implementation details and not needed in types package
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.
They are not implementation details; they're all explicit entry points that I use in dozens of packages, and are present in exports
.
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.
Rebased and repushed so the bot will do a proper rereview ping.
Do note that I have a hundred packages with this structure; some already are on DT; all of those have this DT file format already - so this is already an approved and accepted approach.
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.
https://github.com/es-shims/Function.prototype.name#example here talks about importing function.prototype.name
so i dont understand why others are explicit entry points. It seems like these definitions could be simplified into index.d.ts
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's not how my entire ecosystem of shims works. The example only talks about that, but all of my shims have the same 4 entry points.
It feels like you're arguing about the design of my library, and not about the quality of the types. This is how my library is designed, this is how the types need to be for consumers to use it correctly. I'm not sure why this is up for debate?
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.
Here's a few existing PRs where this exact (proper) pattern was followed:
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.
Rebased this again to make sure it shows up in the right queue.
@ljharb 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. Thank you! |
16c1d13
to
1167a14
Compare
@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? |
type Func = (...args: any[]) => any; | ||
|
||
declare function name(): (this: Func) => string; | ||
|
||
export = name; |
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.
https://github.com/es-shims/Function.prototype.name#example here talks about importing function.prototype.name
so i dont understand why others are explicit entry points. It seems like these definitions could be simplified into index.d.ts
@ljharb 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. Thank you! |
1167a14
to
521d0a3
Compare
@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? |
@ljharb: Everything looks good here. I am ready to merge this PR (at 521d0a3) on your behalf whenever you think it's ready. 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 |
Please fill in this template.
npm test <package to test>
.Select one of these and delete the others:
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 contain{ "extends": "@definitelytyped/dtslint/dt.json" }
, and no additional rules.tsconfig.json
should havenoImplicitAny
,noImplicitThis
,strictNullChecks
, andstrictFunctionTypes
set totrue
.