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
The 'this' context of type 'this' is not assignable to method's 'this' of type 'Foo & { bar: string; }'.
[...]
Property 'bar' is protected in 'Foo' but public in type '{ bar: string; }'.
This is a very similar problem, where the this typing on doThing requires that bar is public even though both canDoThing and doThing should have access to it.
My use-case here is that I have a method that is currently only being called in non-null cases, and only makes sense to call in non-null cases, so I'm currently throwing in a null case (that should never happen). But I would like to enforce that at compile time.
The text was updated successfully, but these errors were encountered:
TypeScript Version: 2.2.0-dev.20170116
Code
Expected behavior:
Compiles without error.
Actual behavior:
Notably, though, even if
baz
ispublic
, attempting to usedoThing
here even from within another method fails:Here the error is
This is a very similar problem, where the
this
typing ondoThing
requires thatbar
is public even though bothcanDoThing
anddoThing
should have access to it.My use-case here is that I have a method that is currently only being called in non-null cases, and only makes sense to call in non-null cases, so I'm currently throwing in a null case (that should never happen). But I would like to enforce that at compile time.
The text was updated successfully, but these errors were encountered: