Educate language server (ts) about extensions made by loaders

22 views Asked by At

If you make a loader, the editor (vscode) screams with red lines for these

Lets say we want to interpolate process output as code like this

index.js

//this is a line handled by the loader
> npx ts-node --skip-project someSnippet arg1 arg2

Of course language server screams

but:

  • when you import json language server knows very precise type of your json (not just declare record)
  • even when you use embedded languages like when using styled components you get detailed type of the variable/component.

Where does this "type injection" happen and how?

  • in case of loaders
  • in case of embedded languages

i tried searching the web but cant find even the general concepts of how to do this i tried digging trough source of the styled components but didnt really figure it out

0

There are 0 answers