- Notifications
You must be signed in to change notification settings - Fork13.2k
Open
Milestone
Description
We use TypeScript configuration"verbatimModuleSyntax": true intsconfig.json and so import statements can be specified etherimport module orimport type module.
Previously in the case when module was imported as a type likeimport type Test from 'test' and it needs to be imported without type likeimport Test from 'test' autocompletion will remove thetype part. With the new version this behaviour is broken andtype part is not being removed by autocompletion.
Before
// "type" will be removed hereimporttypeTestfrom'test';// -> import Test from 'test';// use autocompletion -> "type: being removed from aboveconsttest=newTest();
Now
// "type" stays at placeimporttypeTestfrom'test';// -> no changes// use autocompletion -> no changesconsttest=newTest();
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.106.3
- OS Version: Linux x64 6.14.0-36-generic snap
Steps to Reproduce:
- Make new project
- Add
tsconfig.json - Specify
"verbatimModuleSyntax": truein thetsconfig.json - Add new file
test.tsexportclassTest{}
- Add new file
example.tsconsttest:Test;// use autocompletion on the "Test"
- Observe that
import typehas been addedimporttype{Test}from'test';consttest:Test;
- Try to create new
Testinstanceimporttype{Test}from'test';consttest:Test=newTest();
- Observe error
`'Test' cannot be used as a value because it was imported using 'import type'.ts(1361)` - Use autocomplete on the
Test, observe thatimport type Test from 'test'has NOT been changed toimport Test from 'test'