Skip to content

Instantly share code, notes, and snippets.

Avatar

Cyrille Tuzi cyrilletuzi

View GitHub Profile
View params.ts
function myMethod(required, optional = 'default') {}
myMethod(); // Error
View tsconfig.json
{
"angularCompilerOptions": {
"strictInjectionParameters": true,
"strictTemplates": true,
"strictInputAccessModifiers": true
}
}
View demo.ts
function filter<T>(list: T[]): T[] {}
View demo.ts
getFromClientSideStorage(key: string): unknown {}
View .eslintrc.json
{
"rules": {
"@typescript-eslint/explicit-function-return-type": "error"
}
}
View .eslintrc.json
{
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/no-explicit-any": "error"
}
}
View demo.ts
function test(hello: any, world = '') {
hello; // any
world; // string
}
View tsconfig.json
{
"compilerOptions": {
"strict": true
}
}
View demo.ts
function test(hello: string, world = '') {
hello; // string
world; // string
}
View demo.ts
function test(hello, world = '') {
hello; // any
world; // string
}