mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
1.6 KiB
1.6 KiB
DSpace ESLint plugins > TypeScript rules > dspace-angular-ts/themed-wrapper-no-input-defaults
ThemedComponent wrappers should not declare input defaults (see DSpace Angular #2164)
Examples
Valid code
ThemedComponent wrapper defines an input without a default value
export class TTest extends ThemedComponent<Test> {
@Input()
test;
}
Regular class defines an input with a default value
export class Test {
@Input()
test = 'test';
}
Invalid code
ThemedComponent wrapper defines an input with a default value
export class TTest extends ThemedComponent<Test> {
@Input()
test1 = 'test';
@Input()
test2 = true;
@Input()
test2: number = 123;
@Input()
test3: number[] = [1,2,3];
}
Will produce the following error(s):
ThemedComponent wrapper declares inputs with defaults
ThemedComponent wrapper declares inputs with defaults
ThemedComponent wrapper declares inputs with defaults
ThemedComponent wrapper declares inputs with defaults
ThemedComponent wrapper defines an input with an undefined default value
export class TTest extends ThemedComponent<Test> {
@Input()
test = undefined;
}
Will produce the following error(s):
ThemedComponent wrapper declares inputs with defaults