This solution has some drawbacks:
any. If you don’t declare a type, it will be assumed as
anytype. This is completely normal in TS, but we never annotate types in vanilla JS. On the other hand, Tern is built to deal with this, and can infer the type under most cases.
- Performance penalty. Even querying completions in TS is a type check to the source file using the TS engine, hence the big overhead. Some build systems even treat stripping the type annotation as an optimization on bundling. We surely need a tool for this job, nothing more, nothing less.