https://github.com/samouri/typescript-type-import-bug-repro
https://github.com/samouri/typescript-type-import-bug-repro
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/samouri/typescript-type-import-bug-repro
- Owner: samouri
- Created: 2021-07-02T14:12:15.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-07-02T14:58:55.000Z (almost 5 years ago)
- Last Synced: 2025-03-21T06:45:14.161Z (about 1 year ago)
- Language: TypeScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# typescript-type-import-bug-repro
I recently found a bug with `import type`.
Normally, TS will figure out if the imported object is incorrectly being used as a value. For example:
```typescript
import type { A } from './a';
// Error: 'A' cannot be used as a value because it was imported using 'import type'
const object = { A: A };
```
When shorthand form of this statement is used, the error incorrectly passes typechecking.
```typescript
import type { A } from './a';
const object = { A };
```