Open Griffork opened 3 years ago
@RyanCavanaugh i want to see this too maybe as
function loadFile(filePath: FilePath) {}
// or allow this so there is not posibility with name collision with existing types
function loadFile(filePath: Parameters<typeof import>[0]) {}
loadFile('./|')
// ^ ctrl + space return files autocomplete
same behavior as import
const mod = await import('./|')
// ^ ctrl + space return files autocomplete
This would be great for IDE auto-completion.
There's a VSCode extension that does this. I don't see the point in having TS supporting this natively.
There's a VSCode extension that does this. I don't see the point in having TS supporting this natively.
Not everyone is unfortunate enough to use VSCode.
Search Terms
Autocomplete, fs, require, strings.
Suggestion
I would like to be able to mark a string as a relative path, and get autocomplete for it if it's initialised with a constant.
Examples
Obviously some name for the type that doesn't conflict with common type names will have to be chosen.
Use Cases
It would be nice to have autocomplete for fs.read etc.
I'm making a modified require.js library which allows me to use a custom import function on the client to load resources (html templates, css, 3D models, animations, shaders, etc.) relative to the current script file. I'd like to be able to get auto-complete on the paths and compiler errors if the resource doesn't exist (e.g. i forgot to build my scss files).
I would also like these paths to update when you move or rename a resource the same way paths update when you move or rename a script file.
I'm aware this functionality can be enabled in VSCode with plugins but I'm stuck using Visual Studio and would like it to be supported natively.
Checklist
My suggestion meets these guidelines: