Updated definitions to resolve the TS1046 error.#148
Updated definitions to resolve the TS1046 error.#148mat-sz wants to merge 2 commits intoTooTallNate:masterfrom
Conversation
Not sure if this is a result of recent TypeScript changes, since I've never used node-speaker with TypeScript before, but I'm getting this error message. I can confirm that my changes resolve that error and the library functions correctly.
```
node_modules/speaker/index.d.ts:3:1 - error TS1046: Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier.
3 namespace Speaker {
~~~~~~~~~
```
| * @param opts options. | ||
| */ | ||
| class Speaker extends Writable { | ||
| export default class Speaker extends Writable { |
There was a problem hiding this comment.
This doesn't accurately reflect how the JavaScript code is exported, could you instead only change namespace Speaker to declare namespace Speaker, and leave the export as export = Speaker?
There was a problem hiding this comment.
Unfortunately the export is not going to work like that, the export = syntax causes TS to error with:
Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier. ts(1046)
There was a problem hiding this comment.
You could just do declare class Speaker extends Writable { and then leave the export = Speaker. That seems to keep things working as expected, while fixing the errors, though, not totally sure what the differences might be in the approaches.
|
Can confirm this fixes the issue of using this library with latest versions of Typescript. |
Not sure if this is a result of recent TypeScript changes, since I've never used node-speaker with TypeScript before, but I'm getting this error message. I can confirm that my changes resolve that error and the library functions correctly.