Incorrect emitted TS declaration
See original GitHub issueHi! Thanks for the great library!
Since CodeGen was merged, I switched to the emitted declaration files instead of using manually created ones based on the source code, but the issue is, the nesting is wrong!
Right now the declarations are emitted like this:
export declare const dotnet: {
BannerlordModuleManager: { }; // The C# bindings
BootStatus: typeof BootStatus;
...
};
But dotnet.js exposes the variable via exports.BannerlordModuleManager
instead of exports.dotnet.BannerlordModuleManager
So the correct declaration would be this:
export declare const BannerlordModuleManager: { }; // The C# bindings
export declare const dotnet: {
BootStatus: typeof BootStatus;
...
};
PS: Writing it here because Discussions aren’t setup. Since we both are from Russia, I can’t setup PayPal donations via Ko-Fi because Russia<–>Russia transactions are banned. Do you know any way to bypass the restriction?
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Typescript Emits Declarations Despite Error #36169 - GitHub
d.ts typings declarations. Actual behavior: The type mismatch and error occur as expected but the incorrect typings are output anyway.
Read more >Adding my type declaration throws an error "Typescript ...
ts) gives me an error saying "Typescript emitted no output for my.d.ts". Of course, I don't expect any code generated from this type...
Read more >Compiler Options - TypeScript - JavaScript that scales.
Option Type Default
‑‑allowJs boolean false
‑‑allowSyntheticDefaultImports boolean module === "system" or ‑‑esModuleInterop
‑‑allowUmdGlobalAccess boolean false
Read more >TSConfig Reference - Docs on every TSConfig option
Offers a way to configure the root directory for where declaration files are emitted. example ├── index.ts ├── package.json └── tsconfig.json.
Read more >ae-wrong-input-file-type - API Extractor
Instead, it is designed to analyze the .d.ts files that are emitted by the compiler and exported by your NPM package. This design...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sure, such test should be enough to cover TS generation! And yea, the package emits everything correctly! Closing the issue, thanks!
Makes sense. Not sure if this one test justifies converting all the suite to TS, though. Maybe comparing the generated file with a reference is enough: https://github.com/Elringus/DotNetJS/blob/04dd07c4964541de7761075d769e983be1de21d9/JavaScript/dotnet-runtime/test/packed.js#L40
Anyway, latest nuget package should produce correct types now. Please let me know if it solves the issue.