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
{{ message }}
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
I really like the no-object-literal-type-assertion rule for cases where
I'm trying to type a variable. i.e., this is great:
// What I should write:const x: MyInterface = {...}
// What tslint wisely stops me from writing:const x = {...} as MyInterface
However, the one circumstance where I tend to use the as syntax is
specifically when doing type overrides for tests. i.e.
// What I want to write for my test:const x = {...} as any
// What tslint recommends:const x: any = {...}
In this case, I'm using as any to draw attention to the fact that it *is*
an override... the variable x is not actually an any type.
Would it be possible to add an option to ignore no-object-literal-type-
assertion for as any?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2716>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALaeKE00A4D8iHDpViGRbeYioCCzdtEiks5r32segaJpZM4NUYTi>
.
I really like the
no-object-literal-type-assertion
rule for cases where I'm trying to type a variable. i.e., this is great:However, the one circumstance where I tend to use the
as
syntax is specifically when doing type overrides for tests. i.e.In this case, I'm using
as any
to draw attention to the fact that it is an override... the variablex
is not actually anany
type.Would it be possible to add an option to ignore
no-object-literal-type-assertion
foras any
?The text was updated successfully, but these errors were encountered: