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
I have a class deriving from a class in another package, which uses a too general type for an attribute, which I want to override. I can using @ts-ignore. However, the d.ts does not contain the @ts-ignore so another package using this package will not compile.
E.g. in foo.ts
// @ts-ignoreclassFooextendsBar{ ... }
Expected behavior:
in foo.d.ts:
// @ts-ignoredeclareclassFooextendsBar{ ... }
Actual behavior:
in foo.d.ts:
declareclassFooextendsBar
which triggers an error.
The text was updated successfully, but these errors were encountered:
@ts-ignore silences the error that would have been reported otherwise. it has no semantic meaning. It does not make senses to include it in a .d.ts. as a matter of fact, it is wrong to do so.
The correct fix is to update your dependency definition.
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
The correct fix is to update your dependency definition.
The problem is that I am not in control of the dependency definition. I thought that directly using a .ts file internally and using .d.ts + .js should result in the same compiler behavior. (In other words, .d.ts + .js + .js.map should correspond 1-1 to original .ts.) From an operational point of view, @ts-ignore does have meaning, as it results in an observable different in build tool operation?
Of course I could do something like class Foo extends Bar as any -- but this seems like a much worse hack than using \\ @ts-ignore -- indeed I would have thought that conscribing any hacks as much as possible was exactly the purpose of @ts-ignore.
If it is indeed a useful feature to use within a package (I know there could be argument about that, but I assume its moot, as you indeed do support @ts-ignore), is there a good reason that it should not be used when consuming another package?
TypeScript Version: 2.6.1
Code
I have a class deriving from a class in another package, which uses a too general type for an attribute, which I want to override. I can using
@ts-ignore
. However, thed.ts
does not contain the@ts-ignore
so another package using this package will not compile.E.g. in
foo.ts
Expected behavior:
in
foo.d.ts
:Actual behavior:
in
foo.d.ts
:which triggers an error.
The text was updated successfully, but these errors were encountered: