gulpjs / vinyl

Virtual file format.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Typings do not allow for extending custom properties in TypeScript

origin1tech opened this issue · comments

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;
}

We don't maintain the typings. Please direct this to the proper repository.

...you're right wasn't thinking :)

@origin1tech I ran into the same issue as you today.

Did you find any workaround to extend the Vinyl in TypeScript?

@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 :)