-
Notifications
You must be signed in to change notification settings - Fork 30.5k
[@types/node] use assertion guards in assert module #42786
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
[@types/node] use assertion guards in assert module #42786
Conversation
|
If this passes, I'll rebase & adjust the commits, so lets not merge. I'm interested in the order that Anyway, @SimonSchick watch this space. (This works for me locally when I edit it in |
|
@G-Rath Thank you for submitting this PR! Because this is a new definition, a DefinitelyTyped maintainer will be reviewing this PR in the next few days once the Travis CI build passes. In the meantime, if the build fails or a merge conflict occurs, I'll let you know. Have a nice day! |
|
@typescript-bot yeah yeah I know why. I'll fix it when I'm home |
|
@G-Rath you do know you can run those tests locally right? |
|
@SimonSchick it works 🎉🎉🎉 - the bulk of the tests are passing. There are at least two failures however, which are weird ones: That doesn't seem right; using assert locally the resulting type is
|
You beat me to the punch 😂 I do indeed, but the tests are actually passing for the most part (aside from v10 being weird) - the failure is in a single library, and running those tests locally eats up resources like crazy since it's installing so many libraries. I have tested this out locally against libraries in |
|
So the I'm going to revist the |
|
Ugh so I believe this is caused by microsoft/TypeScript#35004, and renders We can fix the test by removing the assertion guard from I'll play around later with seeing if there's a way to have the types for that library do something different in ts3.7, like not use ts3.7 |
|
|
Actually running them locally results in an error 😬 :
|
| import dgram = require("dgram"); | ||
| import perf_hooks = require("perf_hooks"); | ||
|
|
||
| declare const assert: any; |
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.
The only dependent for this package on npm is bloater, which just depends on the first 1000 dependencies on npm, and is an attempt to just publish a really large package by the looks of it.
The adone npm package itself is deprecated, and the github project, while recently updated ~20 days ago, doesn't seem to have the std namespace anymore.
Of the two maintainers of these types, one no longer exists on github, and the other has no active contributions.
I believe it's acceptable in this case to slightly weaken the types of a single package that doesn't appear to be used anymore, vs not having assertion guards in @types/node.
Happy to break this out into another PR if needed.
|
We've gotten sign-off from a reviewer 👏. A maintainer will soon review this PR and merge it if there are no issues. If it shouldn't be merged yet, please leave a comment saying so and we'll wait. Thank you for contributing to DefinitelyTyped! |
|
@felixfbecker I can't request a re-review from you :( |
|
🔔 @rbuckton - Thanks for your review of this PR! Can you please look at the new code and update your review status if appropriate? |
felixfbecker
left a comment
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.
Ship it 🚢 🎉
|
@rbuckton any chance of a re-review? this PR is ready to go otherwise :) |
|
@rbuckton could you please review it? :) |
|
Can it be merged without @rbuckton? I'm not sure he is interested in reviewing it :( |
|
My only comment was about the order in |
|
I just published |
|
I just published |
|
I just published |
|
I just published |
|
@sandersn just if it matters @typescript-bot didn't post here about publishing a release of |
|
@G-Rath how can I use these when using TS 3.8.3? If I install |
|
@felixfbecker unfortunately right now they're not usable because the In order for TypeScript to use the new typings, that property has to have it's properties inverted; you can use @sandersn seemed pretty active about it, so I imagine it'll be fixed "soon" 🙂 |
|
Was the version 12 version not published for any particular reason? |
|
@G-Rath Thank you for submitting this PR! Code ReviewsBecause this is a widely-used package, a DT maintainer will need to review it before it can be merged. 🔔 @s0m3on3 @maxveres @microsoft @DefinitelyTyped @jkomyno @a-tarasyuk @alvis @r3nya @btoueg @BrunoScheufler @smac89 @tellnes @Touffy @DeividasBakanas @eyqs @Flarna @Hannes-Magnusson-CK @KSXGitHub @hoo29 @kjin @ajafff @islishude @mwiktorczyk @mohsen1 @n-e @octo-sniffle @galkin @parambirs @eps1lon @SimonSchick @ThomasdenH @WilcoBakker @wwwy3y3 @samuela @kuehlein @j-oliveras @bhongy @chyzwar @trivikr @nguymin4 @yoursunny @qwelias @ExE-Boss @Ryan-Willpower @peterblazejewicz - please review this PR in the next few days. Be sure to explicitly select 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",
"pr_number": 42786,
"author": "G-Rath",
"owners": [
"s0m3on3",
"maxveres",
"Microsoft",
"DefinitelyTyped",
"jkomyno",
"a-tarasyuk",
"alvis",
"r3nya",
"btoueg",
"brunoscheufler",
"smac89",
"tellnes",
"touffy",
"DeividasBakanas",
"eyqs",
"Flarna",
"Hannes-Magnusson-CK",
"KSXGitHub",
"hoo29",
"kjin",
"ajafff",
"islishude",
"mwiktorczyk",
"mohsen1",
"n-e",
"octo-sniffle",
"galkin",
"parambirs",
"eps1lon",
"SimonSchick",
"ThomasdenH",
"WilcoBakker",
"wwwy3y3",
"samuela",
"kuehlein",
"j-oliveras",
"bhongy",
"chyzwar",
"trivikr",
"nguymin4",
"yoursunny",
"qwelias",
"ExE-Boss",
"Ryan-Willpower",
"peterblazejewicz"
],
"dangerLevel": "MultiplePackagesEdited",
"headCommitAbbrOid": "c6c2a4c",
"headCommitOid": "c6c2a4ce6586a86ada902276e3ec9d05c267d3be",
"mergeIsRequested": false,
"stalenessInDays": 40,
"lastCommitDate": "2020-03-19T01:06:21.000Z",
"reviewLink": "https://github.com/DefinitelyTyped/DefinitelyTyped/pull/42786/files",
"hasMergeConflict": false,
"authorIsOwner": false,
"isFirstContribution": false,
"popularityLevel": "Critical",
"anyPackageIsNew": false,
"packages": [
"adone",
"node"
],
"files": [
{
"filePath": "types/adone/glosses/std.d.ts",
"kind": "definition",
"package": "adone"
},
{
"filePath": "types/node/assert.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/base.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/index.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/package.json",
"kind": "package-meta",
"package": "node"
},
{
"filePath": "types/node/ts3.2/base.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/ts3.2/index.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/ts3.5/base.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/ts3.5/index.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/ts3.7/assert.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/ts3.7/base.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/ts3.7/index.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/ts3.7/node-tests.ts",
"kind": "test",
"package": "node"
},
{
"filePath": "types/node/ts3.7/tsconfig.json",
"kind": "package-meta",
"package": "node"
},
{
"filePath": "types/node/ts3.7/tslint.json",
"kind": "package-meta",
"package": "node"
},
{
"filePath": "types/node/v10/assert.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v10/base.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v10/index.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v10/package.json",
"kind": "package-meta",
"package": "node"
},
{
"filePath": "types/node/v10/ts3.2/base.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v10/ts3.2/index.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v10/ts3.7/assert.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v10/ts3.7/base.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v10/ts3.7/index.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v10/ts3.7/node-tests.ts",
"kind": "test",
"package": "node"
},
{
"filePath": "types/node/v10/ts3.7/tsconfig.json",
"kind": "package-meta",
"package": "node"
},
{
"filePath": "types/node/v10/ts3.7/tslint.json",
"kind": "package-meta",
"package": "node"
},
{
"filePath": "types/node/v11/assert.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v11/base.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v11/index.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v11/package.json",
"kind": "package-meta",
"package": "node"
},
{
"filePath": "types/node/v11/ts3.2/base.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v11/ts3.2/index.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v11/ts3.7/assert.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v11/ts3.7/base.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v11/ts3.7/index.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v11/ts3.7/node-tests.ts",
"kind": "test",
"package": "node"
},
{
"filePath": "types/node/v11/ts3.7/tsconfig.json",
"kind": "package-meta",
"package": "node"
},
{
"filePath": "types/node/v11/ts3.7/tslint.json",
"kind": "package-meta",
"package": "node"
},
{
"filePath": "types/node/v12/assert.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v12/base.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v12/index.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v12/package.json",
"kind": "package-meta",
"package": "node"
},
{
"filePath": "types/node/v12/ts3.2/base.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v12/ts3.2/index.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v12/ts3.7/assert.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v12/ts3.7/base.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v12/ts3.7/index.d.ts",
"kind": "definition",
"package": "node"
},
{
"filePath": "types/node/v12/ts3.7/node-tests.ts",
"kind": "test",
"package": "node"
},
{
"filePath": "types/node/v12/ts3.7/tsconfig.json",
"kind": "package-meta",
"package": "node"
},
{
"filePath": "types/node/v12/ts3.7/tslint.json",
"kind": "package-meta",
"package": "node"
}
],
"otherApprovalCount": 2,
"ownerApprovalCount": 0,
"maintainerApprovalCount": 1,
"hasDismissedReview": false,
"travisResult": "pass",
"reviewersWithStaleReviews": [],
"approvalFlags": 5,
"isChangesRequested": false
} |
|
@G-Rath Everything looks good here. Great job! I am ready to merge this PR on your behalf.
and I'll merge it the next time I look at this PR. |
|
Per the comment in the other issue, it looks like the above issue has indeed been solved. That said, it looks like it's only those two versions, other major node version releases i.e. Is there a way a new patch release can be pushed of the appropriate major node versions containing the fix to the property? |
Please fill in this template.
npm test.)npm run lint package-name(ortscif notslint.jsonis present).Select one of these and delete the others:
If changing an existing definition:
tslint.jsoncontaining{ "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.I've made a start on this, but it was getting a bit tangly so wanted to push it up for the diff & for some guidance on how to handle a few things :)
Closes #40415
Lets try this on for size...