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

TypeScript support for type-checking #126

Closed
jeromegn opened this Issue Jan 26, 2019 · 6 comments

Comments

4 participants
@jeromegn
Copy link

jeromegn commented Jan 26, 2019

I've successfully used swc to compile typescript files, that's great. I'm thoroughly impressed!

However, I noticed it compiled "wrong" typescript. Example:

function foo(): string {
}

^ is invalid typescript (the function actually returns void), but this will still compile fine with swc.

I'm assuming this is a lot more complicated to make happen. You'd have to check keep track of the type signature of every function and variables to compare and check type validity.

@kdy1

This comment has been minimized.

Copy link
Collaborator

kdy1 commented Jan 27, 2019

It was intentional as babel does not do type checking, but I'm considering implementing it.

@sledorze

This comment has been minimized.

Copy link

sledorze commented Feb 12, 2019

@kdy1 have you evaluated how much a moving target typescript really is?

@kdy1

This comment has been minimized.

Copy link
Collaborator

kdy1 commented Feb 12, 2019

@sledorze I didn't, but in one blog post they said they co-operated with babel team to make babel understand typescript. So I think trancompiler is not that hard to follow.

I'm not sure about type system though. Type system of typescript seems to be changing frequently..

@sledorze

This comment has been minimized.

Copy link

sledorze commented Feb 12, 2019

@kdy1 yes the type system is changing frequently and is not sound, full of corner cases; I'm guessing that it's a herculean job..

@dgoldstein0

This comment has been minimized.

Copy link

dgoldstein0 commented Feb 13, 2019

Typescript's type system gets new improvements with every minor version release. I don't see how it'd be a viable strategy for an alternative implementation to keep up with them - even if you have enough resources to keep up, you'd have to match it quirk for quirk to actually be compatible.

A lot of people separate transpiling and typechecking in their tools anyway - with some webpack plugins (awesome-typescript-loader) even forking separate processes to report typecheck errors outside the normal rebuild flow. So I don't think this is a necessary feature, though certainly a project that just tried to speed up typescript's typechecking would be appreciated.

@jeromegn

This comment has been minimized.

Copy link
Author

jeromegn commented Feb 13, 2019

That makes sense! I didn't realize it changed so often. Now I just wish typescript would want to contribute and use this instead of their own checker.

Feel free to disregard this issue :)

@kdy1 kdy1 closed this Feb 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment