Typescript compilation error: Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier.
AndrewGrachov opened this issue · 12 comments
$ tsc && cp -r src/api dist/api
node_modules/scramjet/.d.ts/index.d.ts:8:1 - error TS1046: Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier.
8 function pipelineOverride(...a: never[]): never;
~~~~~~~~
node_modules/scramjet/.d.ts/index.d.ts:13:7 - error TS2417: Class static side 'typeof PromiseTransform' incorrectly extends base class static side 'typeof Transform'.
The types of 'pipeline.__promisify__' are incompatible between these types.
Type '(...a: never[]) => never' is not assignable to type '{ (stream1: ReadableStream, stream2: WritableStream): Promise<void>; (stream1: ReadableStream, stream2: ReadWriteStream, stream3: WritableStream): Promise<...>; (stream1: ReadableStream, stream2: ReadWriteStream, stream3: ReadWriteStream, stream4: WritableStream): Promise<...>; (stream1: ReadableStream, stream2: Rea...'.
Types of parameters 'a' and 'stream1' are incompatible.
Type 'ReadableStream' is not assignable to type 'never'.
**TS version: ** 3.8.3
**Scramjet version: ** 4.33.4
**Solution: **
downgraded to 4.30.1
Hey, thanks for the comment, we're on it. :)
@AndrewGrachov can you extract a simple repo for instance with a single file that causes the above issue? We'd check if we can reproduce this.
Or at least share the code that uses scramjet?
https://github.com/AndrewGrachov/scramjet-error
here you are, I suspect yarn
dockerfile build should fail
Thanks, I'll check - I believe I'll need to redo the pipeline
method override in all streams - I don't know why it's like that in ts
since pipeline is not a method of Readable
or Writable
or any other Node.js stream, but worst case scenario I'll just allow any
there...
I'm trying to fix this - but this is taking some extra time, as I don't really know how to make Typescript ok with overriding of some of Duplex/PassThrough stream methods (pipeline
mostly).
I'll try to solve it in such a way that this will be compatible - I'll create a PR over the weekend and perhaps you could help me with getting the definitions right.
Still working on this - it's a bit annoying since I added the pipeline
method before it was added to Transform stream and then the method was made incompatible which doesn't go well with Typescript.
Another update - we're focusing on Scramjet v5.x branch now, as we're trying to pass a tipping point there - still we'll return to this asap.
Ok, fix underway - I needed to remove the pipe method altogether and use node's own one. There's a possible compatibility issue, but if that occurs for anyone - it's most likely to be a bug (so you'd need to fix that in your own code).
@AndrewGrachov tell me if it's now working for you with 4.34.0
- I'll publish this in a couple minutes.
@AndrewGrachov shall we close this?
Build is ok, thank you!
Brilliant. 👍