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

[NodeJS] Support 'typesVersions' in node/v6 through node/v9 #34678

Merged
merged 6 commits into from Apr 29, 2019

Conversation

rbuckton
Copy link
Collaborator

Similar to the recent change to split NodeJS v11 and v10 to support "typesVersions", this does the same for NodeJS v9 and v8. This change will be necessary to continue to support Node v8 and v9 once microsoft/TypeScript#30790 has merged.

@typescript-bot typescript-bot added this to Needs Author Attention in Pull Request Status Board Apr 12, 2019
@typescript-bot typescript-bot added New Definition This PR creates a new definition package. Popular package This PR affects a popular package (as counted by NPM download counts). The Travis CI build failed labels Apr 12, 2019
@typescript-bot
Copy link
Contributor

typescript-bot commented Apr 12, 2019

@rbuckton 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
Copy link
Contributor

typescript-bot commented Apr 12, 2019

@rbuckton The Travis CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@rbuckton
Copy link
Collaborator Author

@sandersn: Any idea what's going on here? types-publisher is complaining about a package called aframe being added to notNeededPackages.json, but I don't see that package listed.

@SimonSchick
Copy link
Contributor

@rbuckton with the size of node typings growing continuously, are there any plans to purge the EOL versions <= 6 (end of april) or even move them into a standard TS lib?

@sandersn
Copy link
Contributor

@rbuckton The diff with master is quite complicated in that run. aframe shows up as partly deleted, which is what causes the error, but three (which aframe depends on) shows up as added. This makes me think that the branch must be fairly old (pre-March 27). I think that the notNeededPackages code I added recently gets confused when a popular package, with dependents, gets removed, causing dependents to add a package.json.

I would merge from master as a workaround.

@rbuckton rbuckton force-pushed the splitNode8and9 branch 2 times, most recently from 3d08fb8 to f2fca64 Compare April 17, 2019 19:14
@typescript-bot
Copy link
Contributor

@rbuckton The Travis CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@rbuckton rbuckton force-pushed the splitNode8and9 branch 2 times, most recently from 27c165e to 8f24a46 Compare April 17, 2019 19:41
@typescript-bot
Copy link
Contributor

@rbuckton The Travis CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@rbuckton rbuckton marked this pull request as ready for review April 17, 2019 20:57
@rbuckton
Copy link
Collaborator Author

@sandersn: Thanks, rebasing with latest master seems to have fixed the issue.

@rbuckton
Copy link
Collaborator Author

Since the bot things this is a new definition, I'll notify the reviewers manually:


🔔 @microsoft @DefinitelyTyped @jkomyno @a-tarasyuk @alvis @r3nya @btoueg @BrunoScheufler @smac89 @tellnes @Touffy @DeividasBakanas @eyqs @Flarna @Hannes-Magnusson-CK @KSXGitHub @hoo29 @kjin @ajafff @islishude @mwiktorczyk @matthieusieben @mohsen1 @n-e @octo-sniffle @parambirs @eps1lon @SimonSchick @ThomasdenH @WilcoBakker @wwwy3y3 @ZaneHannanAU @jeremiergz @samuela @kuehlein @j-oliveras @bhongy - please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI.

@Flarna
Copy link
Contributor

Flarna commented Apr 18, 2019

Node.Js 9 is EOL since 2018-06-30, long before Node.Js 6 (2019-04-30). Therefore I don't think changes v9 are needed.
We should consider to remove EOL versions from the repo instead to avoid references to it and people modifying it. Or at least mark them as frozen.

@SimonSchick
Copy link
Contributor

@Flarna I think we should remove them, the node team doesn't maintain them and neither should we, people can always augment their typings.

@rbuckton
Copy link
Collaborator Author

The split of Node v8 and Node v9 typings has less to do with maintainability, and more to do with supporting the "typesVersions" redirection so that an upcoming change in the TypeScript compiler will not result in unresolvable build breaks.

This has more to do with ensuring that the next release of TypeScript does not result in major breaks for anyone still using Node v9, as module augmentations cannot address the issue this is meant to solve. An augmentation cannot address the "Duplicate identifier" error that would result from having conflicting interface IteratorResult<T> and type IteratorResult<T> definitions, which is why we are employing "typesVersions" here. Even if we were to remove the definitions for Node v9, the existing previously published definitions would still be available and would run into this issue. I discussed this with @RyanCavanaugh and we believe this is a fix we should still take despite the EOL status of Node v9.

@SimonSchick
Copy link
Contributor

@rbuckton I think our comments were a little off-topic and we weren't arguing the actual changes made here but rather making a note that we should remove them to avoid future churn :)

@rbuckton
Copy link
Collaborator Author

Hopefully the changes we've made to the Node definitions for "typesVersions" are comprehensive enough to avoid collisions with ECMAScript standard library definitions for the foreseeable future.

@Flarna
Copy link
Contributor

Flarna commented Apr 18, 2019

But why not v6 and v4 then? It's more likely that users are still on v6/v4 then on v9 as they were LTS versions.

@typescript-bot typescript-bot moved this from Needs Author Attention to Review in Pull Request Status Board Apr 22, 2019
@typescript-bot typescript-bot removed the Has Merge Conflict This PR can't be merged because it has a merge conflict. The author needs to update it. label Apr 22, 2019
@typescript-bot typescript-bot moved this from Review to Needs Author Attention in Pull Request Status Board Apr 26, 2019
@typescript-bot typescript-bot added the Has Merge Conflict This PR can't be merged because it has a merge conflict. The author needs to update it. label Apr 26, 2019
@rbuckton
Copy link
Collaborator Author

@Flarna or others, can you take a look? I'd like to merge this if possible as changes continue to be made to the v6 and v8 definitions.

@typescript-bot typescript-bot moved this from Needs Author Attention to Review in Pull Request Status Board Apr 29, 2019
@typescript-bot typescript-bot removed the Has Merge Conflict This PR can't be merged because it has a merge conflict. The author needs to update it. label Apr 29, 2019
interface Error {
stack?: string;
}
// NOTE: Augmentations for TypeScript 3.1 and later should use individual files for overrides
Copy link
Contributor

@Flarna Flarna Apr 29, 2019

Choose a reason for hiding this comment

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

actually 3.2 (also applicable to other versions)

@@ -2,7 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5"
"es6"
Copy link
Contributor

Choose a reason for hiding this comment

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

why this change? I can remember about some complains that node typings don't work with lib es5, usually because of missing forward declarations. if es6 is used here this is not detected by tests

interface IteratorResult<T> { }
interface AsyncIterableIterator<T> {}
interface SymbolConstructor {
readonly iterator: symbol;
readonly asyncIterator: symbol;
Copy link
Contributor

Choose a reason for hiding this comment

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

have you removed asyncIterator per accident here? For whatever reason it's only present in v6 so maybe it's anyway wrong.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I removed it intentionally. It seemed out of place and I verified that it does not, in fact, exist in Node v6.

Copy link
Contributor

@Flarna Flarna left a comment

Choose a reason for hiding this comment

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

I haven't looked on every single line but it seems correct to me

@typescript-bot typescript-bot moved this from Review to Check and Merge in Pull Request Status Board Apr 29, 2019
@typescript-bot typescript-bot added Owner Approved A listed owner of this package signed off on the pull request. Merge:Express and removed Awaiting reviewer feedback labels Apr 29, 2019
@typescript-bot
Copy link
Contributor

A definition owner has approved this PR ⭐️. A maintainer will merge this PR shortly. If it shouldn't be merged yet, please leave a comment saying so and we'll wait. Thank you for your contribution to DefinitelyTyped!

@rbuckton rbuckton merged commit b1d706c into master Apr 29, 2019
Pull Request Status Board automation moved this from Check and Merge to Done Apr 29, 2019
@typescript-bot
Copy link
Contributor

I just published @types/node@9.6.48 to npm.

@typescript-bot
Copy link
Contributor

I just published @types/node@8.10.48 to npm.

@typescript-bot
Copy link
Contributor

I just published @types/node@7.10.6 to npm.

@typescript-bot
Copy link
Contributor

I just published @types/node@6.14.6 to npm.

@rbuckton rbuckton deleted the splitNode8and9 branch April 29, 2019 23:57
@sharikovvladislav
Copy link

sharikovvladislav commented Oct 24, 2019

Isn't this needed in @types/node@10.x.x?

I am getting following at typescript@3.6.4 + @types/node@10.9.4:

node_modules/@types/node/index.d.ts:169:11 - error TS2300: Duplicate identifier 'IteratorResult'.

169 interface IteratorResult<T> { }
              ~~~~~~~~~~~~~~

  node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6
    41 type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
            ~~~~~~~~~~~~~~
    'IteratorResult' was also declared here.
node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6 - error TS2300: Duplicate identifier 'IteratorResult'.

41 type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
        ~~~~~~~~~~~~~~

@Flarna
Copy link
Contributor

Flarna commented Oct 24, 2019

@sharikovvladislav Try latest node 10 type definitions.

@sharikovvladislav
Copy link

sharikovvladislav commented Oct 24, 2019

Latest for 10 is 10.14.22. Is it ok if I update 10.9.x to 10.14.22?

Thank you for the fast response.

@Flarna
Copy link
Contributor

Flarna commented Oct 24, 2019

At least the split for typescript versions is included there.

@sharikovvladislav
Copy link

Thank you. That helped.

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. Owner Approved A listed owner of this package signed off on the pull request. Popular package This PR affects a popular package (as counted by NPM download counts).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants