There’s a typed module – 'markdown-it' – defining an interface that describes a class living in another (untyped) module – 'markdown-it/lib/token'
I would like to define typings for the latter, for which I created a .d.ts file:
declare module 'markdown-it/lib/token' {
import * as MarkdownIt from 'markdown-it'
class Token implements MarkdownIt.Token {}
export = Token
}
Sadly, Typescript complains that Token doesn’t implement MarkdownIt.Token.
Optimally, I’d like to tell Typescript “the class and interface are identical”. But even if this isn’t possible, I can’t even copy the definition, as
Class
Tokenincorrectly implements interfacemarkdownit.Token.
TypeTokenprovides no match for the signaturenew (type: string, tag: string, nesting: number): Token
no matter if I do
class Token implements MarkdownIt.Token {
new (type: string, tag: string, nesting: number): Token
// or
new (type: string, tag: string, nesting: number): Token
// or
constructor(type: string, tag: string, nesting: number)
...
}