You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See the below example: private readonly mySubject = new BehaviorSubject<string | undefined>(undefined)
Results in Explicit generic type arguments are forbidden. Despite the generic being necessary to specify the full type here.
A possible workaround is to cast the subject's initial value: private readonly mySubject = new BehaviorSubject(undefined as string | undefined)
But we find specifying generics to be preferable over casting.
I remember reading some time ago about adding some sort of unnecessary generic check as part of typescript-eslint itslef. There was a mention of current limitations with TypeScript or using complicated (and slower) AST checks. So I understand if such false-positives may not be possible to detect.
Edit: typescript-eslint/typescript-eslint#4978 (comment)
The text was updated successfully, but these errors were encountered:
See the below example:
private readonly mySubject = new BehaviorSubject<string | undefined>(undefined)
Results in
Explicit generic type arguments are forbidden.
Despite the generic being necessary to specify the full type here.A possible workaround is to cast the subject's initial value:
private readonly mySubject = new BehaviorSubject(undefined as string | undefined)
But we find specifying generics to be preferable over casting.
I remember reading some time ago about adding some sort of unnecessary generic check as part of typescript-eslint itslef. There was a mention of current limitations with TypeScript or using complicated (and slower) AST checks. So I understand if such false-positives may not be possible to detect.
Edit: typescript-eslint/typescript-eslint#4978 (comment)
The text was updated successfully, but these errors were encountered: