- How do you structure a TypeScript project?
- When to use interface vs type TypeScript?
- What are interfaces in TypeScript?
How do you structure a TypeScript project?
Project Structure
In a TypeScript project, it's best to have separate source and distributable files. TypeScript ( . ts ) files live in your src folder and after compilation are output as JavaScript ( . js ) in the dist folder.
When to use interface vs type TypeScript?
Type aliases and interfaces are very similar, and in many cases you can choose between them freely. Almost all features of an interface are available in type , the key distinction is that a type cannot be re-opened to add new properties vs an interface which is always extendable.
What are interfaces in TypeScript?
Interface is a structure that defines the contract in your application. It defines the syntax for classes to follow. Classes that are derived from an interface must follow the structure provided by their interface. The TypeScript compiler does not convert interface to JavaScript.