-
Notifications
You must be signed in to change notification settings - Fork 4k
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 @types/node as a dev dependency for TypeScript projects #4462
Conversation
…s is needed to access the process object used for getting environment vars
Thanks so much for taking the time to contribute to the AWS CDK ❤️ We will shortly assign someone to review this pull request and help get it
|
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
I am okay with adding this despite the fact that it is not normally needed. @RomainMuller what do you think? You were the one that removed them earlier. |
If I might... I would say that as soon as you start working with assets you usually use |
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 wouldn't do this at all, as this has been a source of issues in the past, and to a certain extent it takes control away from the use:
- If we proactively configure this, then we're also possibly restricting the set of
node
standard library features that are available (only those up to the version of@types/node
we choose will be available, but the user may elect to run with a much more recentnode
engine). - Also, this has caused issues in the past in two ways (resulting in
tsc
errors that are hard to understand, but are easier to debug when you know it broke right after you added a new dependency...):- When we used
^8.x.y
, we occasionally got broken by new & broken versions of this package - When we used
8.x.y
(no caret), we hit issues when some type definitions were moved over to TypeScript'sES####
libraries (because of duplicate declarations of the same type name)
- When we used
I we however feel that using process.env
is common enough to warrant being proactive about it, we must use the version of @types/node
that matches our minimum node
engine requirement (currently, this would be ^8.10.53
), otherwise you're advertising features of the node
standard library that may, in fact, not be available.
Would that it were so simple, I guess. I didn't run into versioning issues myself because I have a near-current Node.js installed, so of course the latest Maybe there's a way we could provide the necessary type info for just Anyway, this isn't the PR we're looking for, so I'll close it. |
@RomainMuller and I discussed this. @RomainMuller can you please follow up on this? I think we want to add this after all... |
Since it is very common for users to need to reference local files using `path.join` and `__dirname`, it is only pragmatic that we will include @types/node in the init template. We use a pinned version since experience shows that these types can get a bit messed up (see #3839) Supersedes #4462 Reverts #3840
Superseded by #4947 |
Since it is very common for users to need to reference local files using `path.join` and `__dirname`, it is only pragmatic that we will include @types/node in the init template. We use a pinned version since experience shows that these types can get a bit messed up (see #3839) Supersedes #4462 Reverts #3840
Add @types/node as a dev dependency for TypeScript projects as this is needed to access the process object used for getting environment vars.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license