Monday, December 23

Tag: Angular

Web Tricks

3 Useful TypeScript Tips for Angular

  These are the 3 tips I found pretty handy while working with Typescript: Eliminating the need to import interfaces Making all interface properties optional Stop throwing me error, I know what I'm doing Though I discovered these while working with Angular application, but all tips are not Angular specific, it's just Typescript. Eliminating the need to import interfaces I like interfaces. However, I don't like to import them everytime. Although Visual Studio Code has auto-import feature, I don't like my source files been "polluted" by multiple lines of imports - just for the purpose of strong typing. This is how we do it normally. // api.model.ts export interface Customer { id: number; name: string; } export interface User { id: number; is...