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

Add @types/node to dev deps in package.json for TS projects #1745

Closed
wants to merge 1 commit into from

Conversation

burkeholland
Copy link

If the user picks TypeScript, there is a 99% chance they are going to want at least the Node types as well. For instance, they can't use process without throwing an error if they don't have the types. I think it's safe to assume they need it and include by default.

@burkeholland burkeholland requested a review from a team as a code owner December 9, 2019 19:40
@@ -21,7 +21,8 @@ export class TypeScriptProjectCreateStep extends JavaScriptProjectCreateStep {

protected packageJsonDevDeps: { [key: string]: string } = {
'@azure/functions': '^1.0.2-beta2',
typescript: '^3.3.3'
typescript: '^3.3.3',
'@types/node': '^12.12.15'
Copy link
Member

Choose a reason for hiding this comment

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

The only problem I have with this is the version. People might not have node 12 and Azure Functions only recently added some support for 12. I think ideally this version would be based on the version of Node installed on the user's machine, but I'm not sure the added complexity is worth it.

Are you aware of any popular project generators for typescript and do they include node types by default? If so, what version? I wonder if users would have more confusion/annoyance about missing types or types with the wrong version

Copy link
Author

Choose a reason for hiding this comment

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

This is a good question for @bnb. Tierney - what is your opinion on this? I'm trying to remove a friction point here, but I see the point Eric is making about Node versions.

Thoughts?

Copy link

Choose a reason for hiding this comment

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

Yeah, you probably wouldn’t want to get Node.js 12 types for a Node.js 10 function.

There’s also the additional challenge of The possibility of using Node.js 10 locally but Node.js 12 up in the deployment. Not sure if this matters for TS functions.

I’m not familiar enough with function development to know if this is possible in the sandbox, but could you just fetch the system version and then pass that as the value?

@ejizba
Copy link
Member

ejizba commented Feb 4, 2020

Talked with @fiveisprime. We decided it's easiest to just let people manage their own types for this. It's a bit annoying, but there's too many complications around the version. I'm open to changing this decision if we find a popular project generator we can model after or if more users file feedback

@ejizba ejizba closed this Feb 4, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jan 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants