When declaring a TypeScript interface, both ,
(comma) and ;
(semicolon) are considered valid syntax. For example, the following declarations are all valid:
export interface IUser {
name: string;
email: string;
id: number;
}
export interface IUser {
name: string,
email: string,
id: number
}
However, mixing ,
and ;
within the same interface also produces valid results:
export interface IUser {
name: string;
email: string,
id: number;
}
For consistency, it is preferred to enforce the use of ;
in all occasions. But even with linting rules set for TypeScript, how can we ensure this standard is maintained?
.eslintrc.json
{
"root": true,
"ignorePatterns": [
"projects/**/*"
],
"overrides":
...
}
]
}
tsconfig.json
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
...
]
}
}