Add support for module types in Source Typed
zhaojj2209 opened this issue · 0 comments
Currently, all names imported from modules default to the any
type (see below code snippet, specifically line 563):
js-slang/src/typeChecker/typeErrorChecker.ts
Lines 543 to 566 in 0dd4d8c
In order to support typing of modules, we would need to design a system that allows for the importing of module types.
Possible implementation: every module should include a type declaration file containing a mapping of names to types. When encountering import statements, the type error checker can then retrieve the types from the type declaration file and conduct type checking using those types. If the type declaration file does not exist/any errors are encountered, the type error checker can default back to using the any
type for all names in the module.