-
Notifications
You must be signed in to change notification settings - Fork 66
Description
In the example in Chapter 9, a third-party JavaScript module is imported (reused) in the TypeScript.
What about when you want to make your own separate modules in TypeScript?
I tried to extend the Chapter 9 code with a src/browser/a.ts class that is simply
export class A { /* ... */ }VS Code wants to import A using classic TypeScript syntax (just after the blockchain elements are imported):
import { Blockchain, Block } from '../lib/bc_transactions.js';
import { A } from 'a';But when I run the code, I get a errors for importing a -- first it requires a relative URL (so, I make it ./a but then I get an error saying it's looking for a.js).
Is there a clean solution in Chapter 9 for using TypeScript modules? It hardly feels realistic if all of the project is in main.ts.
In the mean time, rather than using a bundler, I'll follow the advice of specifying .js at the end of the import's specification microsoft/TypeScript#27287 (comment)