Skip to content

Imports without import clause don't report that the specifier can't end with .ts #58725

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

Closed
Andarist opened this issue May 31, 2024 · 3 comments
Closed
Labels
Not a Defect This behavior is one of several equally-correct options

Comments

@Andarist
Copy link
Contributor

πŸ”Ž Search Terms

import clause ts extension resolution

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

https://www.typescriptlang.org/dev/bug-workbench/?module=1#code/PTAEAEDMEsBsFMB2BDAtvAXKZA6ALgM4BQR8AHgA4D2ATnqAMZWIH3KgC8oA5MtySAgwEKdFgBG+YkWipqdHjmC5C-WfPoBvAL6hINKqkXKp-IA

πŸ’» Code

// @filename: a.ts

export const a = 'a'

// @filename: b.ts

import './a.ts'
import {} from './a.ts'

πŸ™ Actual behavior

We get one error in b.ts

πŸ™‚ Expected behavior

We should get errors on both imports in b.ts

Additional information about the issue

No response

@jakebailey
Copy link
Member

These imports are canonically unchecked by design. I personally would love to see this change, but IIRC this is currently intentional behavior, so people can write import "./App.css";.

@Andarist
Copy link
Contributor Author

I understand this is something that works as expected for a class of imports. I'm specifically reporting this as an issue with *.ts imports. Those have special meaning for TS and it feels weird that this works inconsistently for them here.

@RyanCavanaugh RyanCavanaugh added the Not a Defect This behavior is one of several equally-correct options label Jun 6, 2024
@RyanCavanaugh
Copy link
Member

I don't think making this more inconsistent is the right solution. We should explore (separately) a flag to check all non-binding imports

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Not a Defect This behavior is one of several equally-correct options
Projects
None yet
Development

No branches or pull requests

3 participants