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

path imports of packages not supported #206

Closed
eps1lon opened this issue Feb 2, 2020 · 2 comments
Closed

path imports of packages not supported #206

eps1lon opened this issue Feb 2, 2020 · 2 comments
Labels
Playground ATA Holes in the current type acquisition You Can Do This A ticket which has been greenlighted as will be accepted

Comments

@eps1lon
Copy link
Contributor

eps1lon commented Feb 2, 2020

Repro: http://www.typescriptlang.org/play/#code/JYWwDg9gTgLgBAKjgQwM5wEoFNkGN4BmUEIcA5FDvmQNwBQokscA3gL5xEnmV4wC0AExIB6VFigA3CWQbho8FnThwRIuDAAWWOLhKQAdlgMx0ATwgBXOJfGC6HLqTIABEMhgTgyADb9LwCJ6lCIAKmaQAOZQyGCaZiLABoJYAB6ydASWBvjAEAZwACJYIBAAFACUrMqq6gCaVlC6ECkOQA

Currently imports such as react-dom/server or @material-ui/core/Typography are not supported. It seems like it tries to fetch them by appending .d.ts (which is only part of the usual resolution algorithm). But even by leveraging that knowledge and using e.g. import Typography from '@material-ui/core/Typography/index' (where import Typography from '@material-ui/core/Typography/index.d.ts' does exits) is not in a found module.

Technically it should consider import Typography from '@material-ui/core/Typography/index.d.ts' in import Typography from '@material-ui/core/Typography' as well. In a perfect world it would also check the types field in import Typography from '@material-ui/core/Typography/package.json'.

@orta orta added Playground ATA Holes in the current type acquisition You Can Do This A ticket which has been greenlighted as will be accepted labels Mar 10, 2021
@orta
Copy link
Contributor

orta commented Mar 10, 2021

This is still valid, the key is that the fallback of the path might need to resolve over to definitely types too

import * as React from 'react';
import {} from 'react-dom/server'

function Demo() {
  // Your code
}

Looks at: https://www.unpkg.com/react-dom@17.0.1/server.d.ts which would work if they bundled

But it also needs to look at: https://www.unpkg.com/@types/react@17.0.3/server.d.ts

@typescript-bot
Copy link
Collaborator

Hello! As per #2804, we are automatically closing all open issues. Please see #2804 for a description of what issues and PRs can be accepted going forward.

@typescript-bot typescript-bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Playground ATA Holes in the current type acquisition You Can Do This A ticket which has been greenlighted as will be accepted
Projects
None yet
Development

No branches or pull requests

3 participants