Grokking TypeScript
Vote

0% completed

​

TypeScript Modules

Two files that never import each other can still conflict. Consider these two small files, compiled together:

// file: mathOperations.ts function add(a: number, b: number): number { return a + b; }
// file: labels.ts function add(a: string, b: string): string { return a + " " + b; }
labels.ts(2,10): error TS2393: Duplicate function implementation. mathOperations.ts(2,10): error TS2393: Duplicate function implementation.

The compiler treats a file with no top-level import or `export

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content