How would this work with npm libraries? What if the js files I import are using a different type checker / a newer version of the type checker / invalid types?
The same way TypeScript works now. If you depend on a project with invalid/unrecognizable types, tsc will report that as a failure. (You can choose to instruct TypeScript to ignore the invalid types, or provide correct types of your own.)