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

Disable strictFunctionTypes in typescript #48959

Closed
dgofman-equinix opened this issue Apr 30, 2018 · 6 comments
Closed

Disable strictFunctionTypes in typescript #48959

dgofman-equinix opened this issue Apr 30, 2018 · 6 comments
Assignees
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code) typescript Typescript support issues

Comments

@dgofman-equinix
Copy link

Hi I need to disable strict function parameter in Visual Studio by using "strictFunctionTypes" argument.

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-6.html

microsoft/TypeScript#18654

I tried adding "strictFunctionTypes": false into tsconfig.json and setting.json but VScode ignore reading those settings.

@vscodebot vscodebot bot added the typescript Typescript support issues label Apr 30, 2018
@mjbvz
Copy link
Collaborator

mjbvz commented Apr 30, 2018

Please check that the typescript file is part of the expected tsconfig project by running the Go to project configuration command in it. This should open the tsconfig with strictFunctionTypes disabled

@mjbvz mjbvz added the info-needed Issue requires more information from poster label Apr 30, 2018
@dgofman-equinix
Copy link
Author

I tried all options:

  1. under my project ".vscode/settings.json add path to latest typescript folder "^2.8.3"

"typescript.tsdk": "./node_modules/typescript/lib"

  1. in tsconfig.json set strict and strictFunctionTypes to false

{
"compileOnSave": false,
"strictFunctionTypes": false,
"compilerOptions": {
"sourceMap": true,
"target": "es5",
"strict": false,
"noImplicitAny": false,
"strictFunctionTypes": false
},
"exclude": [
"node_modules"
]
}

  1. restarted VS code

but still getting the same error, No issues compiling code via command line

tsc --p ./tsconfig.json

@mjbvz
Copy link
Collaborator

mjbvz commented Apr 30, 2018

Does Go to project configuration open ./tsconfig.json?

@dgofman-equinix
Copy link
Author

dgofman-equinix commented Apr 30, 2018

Sorry, I have two tsconfig.json files.
One for nodeJS another for compiling ES5.

When I opened "workspace settings" (Ctrl+Shift+P) (link bellow)
https://code.visualstudio.com/docs/getstarted/settings

I have to use command line:
">TypeScript: Go to Project Configuration"

Now I added "strictFunctionTypes": false under "compilerOptions" what is fixed that issue.

Thanks for your help.

@dgofman-equinix
Copy link
Author

I have one more question. Do you know if I can ignore warning line (underline green) in my settings.json when I added a new variable.

For example I made changes settings.json

{
"PORT": 3000
}

and using this variable in launch.json

{
            "type": "chrome",
            "request": "launch",
            "name": "Chrome",
            "url": "http://localhost:${config:PORT}",
            "webRoot": "${workspaceFolder}/dist/www"
        }

But I am getting "Problems (1)": "Unknown configuration setting"

Maybe I need to declare under some parent? what can I use?

@mjbvz
Copy link
Collaborator

mjbvz commented Apr 30, 2018

Glad to hear the issue was resolved. Unsure about the config problem. The settings file is generally intended for vscode and extension settings, not general config options. I recommend putting port in the launch.json or getting it from the environment

@mjbvz mjbvz closed this as completed Apr 30, 2018
@mjbvz mjbvz added *question Issue represents a question, should be posted to StackOverflow (VS Code) and removed info-needed Issue requires more information from poster labels Apr 30, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code) typescript Typescript support issues
Projects
None yet
Development

No branches or pull requests

2 participants