-
-
Notifications
You must be signed in to change notification settings - Fork 26
Handle imports from @types/foo
type-only packages
#113
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
Comments
It seems like we'll need to add a new I don't know anything about |
It looks like hard-coded behaviour. `@types/${packageName.startsWith('@') ? packageName.slice(1).replace('/', '__') : packageName}` |
I think I can get this implemented if it's trivial:
|
Is it possible to create another resolver instance with the Here's a similar example to resolve Lines 1061 to 1066 in 4226f7a
|
I want to confirm the scope of this instance. Just resolve Here are the different types of packages that I have listed // no type declarations but has @types
import { LatLng } from '@google/maps'; // resolved path: file:///node_modules/@types/google__maps/index
// type only package
import {} from 'undici-types' // resolved path: file:///node_modules/undici-types/index
// both js source files and corresponding type declarations
import { } from 'vite' // resolved path: file:///node_modules/vite/dist/node/index
// js only package
import {} from 'js-only-pacakage' // resolved nothing If that's what we're going to do, I think we can do a lot of linter rules about |
The resolution will return both the package path as well its types packages. I was thinking about implementing this in user land, but seems a bit difficult after a second thought. |
If my understanding is correct, I think we should do this
|
@Boshen, was there a resolution to this issue? Or a workaround? |
I closed this as not planned. But given your familiarly with this project, you may give this a try. |
In typescript it's possible to import from a module that only has a
@types/
definition.Example -- if you "right click -> peek definition" on the import source you'll see it mentions
node_modules/@types/google__maps
.From what I can tell there isn't a way to resolve this import without manually specifying a mapping.
Am I correct in this? Or is there a way to support it?
The text was updated successfully, but these errors were encountered: