kaleidawave / ezno

A fast and correct TypeScript type checker and compiler with additional experiments
https://kaleidawave.github.io/posts/introducing-ezno/
MIT License
2.55k stars 47 forks source link

Allow type-only import labels #194

Closed noahbald closed 1 day ago

noahbald commented 3 months ago

Hi, just playing around with this - I've noticed that checking type only imports seems to result in an error. This isn't mentioned in the specification docs, so perhaps it was missed?

error:
  ┌─ ./src/actions/address.ts:4:15
  │
4 │ import { type PartialMessage } from "@bufbuild/protobuf";
  │               ^^^^^^^^^^^^^^ Expected CloseBrace or Comma found Identifier("PartialMessage")
kaleidawave commented 3 months ago

Yep, seems to be a parser issue. I think I added support for type keyword in the import part recently

https://github.com/kaleidawave/ezno/blame/main/parser/src/declarations/mod.rs#L394

and yes doesn't appear to be a test for it in specification.md. Will take a look at it. I know I added import type ... from ... but I don't think the checker currently checks simple item type modifiers.

kaleidawave commented 1 day ago

I believe the parsing for this has now been fixed a while back. https://kaleidawave.github.io/ezno/playground/?id=31vj7m

Will tag #185 to look at whether this works in the type checker.