Typings do not allow for extending custom properties in TypeScript
origin1tech opened this issue · comments
Origin1 Tech commented
Having multiple return types for the constructor definition won't fly in TypeScript.
Prevents you from being able to extend the class with custom properties.
interface FileConstructor {
new(options: ConstructorOptions & { contents: null }): NullFile;
new(options: ConstructorOptions & { contents: Buffer }): BufferFile;
new(options: ConstructorOptions & { contents: NodeJS.ReadableStream }): StreamFile;
new(options?: ConstructorOptions): File;
}
Blaine Bublitz commented
We don't maintain the typings. Please direct this to the proper repository.
Origin1 Tech commented
...you're right wasn't thinking :)
Huan Li commented
@origin1tech I ran into the same issue as you today.
Did you find any workaround to extend the Vinyl in TypeScript?
Origin1 Tech commented
@zixia not positive but I believe I just created them manually, if I get a moment I'll see if I can't locate the project and get you a link so you can see how I did it :)