-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in TypeScript compilation: Cannot find name 'StdioOverrideFunction' #40
Comments
Note: I created a patch file with diff --git a/node_modules/wasmagic/dist/index.d.ts b/node_modules/wasmagic/dist/index.d.ts
index a4bc2f5..c59e913 100644
--- a/node_modules/wasmagic/dist/index.d.ts
+++ b/node_modules/wasmagic/dist/index.d.ts
@@ -56,6 +56,10 @@ export declare enum WASMagicFlags {
/** Don't check for SIMH tape files */
NO_CHECK_SIMH = 8388608
}
+export type StdioOverrideFunction = (
+ stdioName: "stdout" | "stderr",
+ text: string,
+) => void;
export type WASMagicOptions = {
flags?: WASMagicFlags;
loadDefaultMagicfile?: boolean; |
Thanks! Sorry about that. I'll get this integrated. I haven't run into this when testing myself |
This was a case of bad management of the types in play and their exposure outside the package. The fix that works for both package maintenance, and external users is to ensure that the type is available and copied into the final npm package. Finally this would have been caught with a test, which has now been added. - Fix #40 - Add dedicated type file for StdioOverrideFunction - Change type file paths to be relative - Move all type files to the `src` folder to make things easier - Add Makefile rules to copy over `.d.ts` files so they are in the package
This was a case of bad management of the types in play and their exposure outside the package. The fix that works for both package maintenance, and external users is to ensure that the type is available and copied into the final npm package. Finally this would have been caught with a test, which has now been added. - Fix #40 - Add dedicated type file for StdioOverrideFunction - Change type file paths to be relative - Move all type files to the `src` folder to make things easier - Add Makefile rules to copy over `.d.ts` files so they are in the package
This was a case of bad management of the types in play and their exposure outside the package. The fix that works for both package maintenance, and external users is to ensure that the type is available and copied into the final npm package. Finally this would have been caught with a test, which has now been added. - Fix #40 - Add dedicated type file for StdioOverrideFunction - Change type file paths to be relative - Move all type files to the `src` folder to make things easier - Add Makefile rules to copy over `.d.ts` files so they are in the package
This was a case of bad management of the types in play and their exposure outside the package. The fix that works for both package maintenance, and external users is to ensure that the type is available and copied into the final npm package. Finally this would have been caught with a test, which has now been added. - Fix #40 - Add dedicated type file for StdioOverrideFunction - Change type file paths to be relative - Move all type files to the `src` folder to make things easier - Add Makefile rules to copy over `.d.ts` files so they are in the package
This was a case of bad management of the types in play and their exposure outside the package. The fix that works for both package maintenance, and external users is to ensure that the type is available and copied into the final npm package. Finally this would have been caught with a test, which has now been added. - Fix #40 - Add dedicated type file for StdioOverrideFunction - Change type file paths to be relative - Move all type files to the `src` folder to make things easier - Add Makefile rules to copy over `.d.ts` files so they are in the package
A little bit of fighting with the Typescript type system for the type to not only be exposed in the library, but to work in-editor for library maintenance. My original solution, and your patch @bvobart were flawed, in that local development of the library with type checking was broken. As the Thank you for the bug report! This should be fixed in the latest release. Please let me know if you have any other issues. |
This was a case of bad management of the types in play and their exposure outside the package. The fix that works for both package maintenance, and external users is to ensure that the type is available and copied into the final npm package. Finally this would have been caught with a test, which has now been added. - Fix #40 - Add dedicated type file for StdioOverrideFunction - Change type file paths to be relative - Move all type files to the `src` folder to make things easier - Add Makefile rules to copy over `.d.ts` files so they are in the package
Thanks for your efforts!! Yeah, my patch was aimed at the final compiled & published artifacts, I don't know exactly how that relates back to your source code. However, the issue is not yet fixed. It seems that your fix now doubly includes the
I'll fork and play around to see if I can fix it in your source code / build process. I'll report back when I have a PR, but of course feel free to fix it yourself in the mean time too :) |
Do you have an example of usage / Typescript settings? I'm probably missing something here. When I import into another typescript project it compiles without any complaints. The other solution I arrived at was aliasing the type and re-exporting it. The only issue with that was more the editor didn't expose the underlying type, but that's not a big deal. Can revert to that if it works. |
Hmmmmm, this is strange. I tried out your working example and it worked just fine. I was trying to compare between my work project and your example, also to make a MWE showing the bug, but now somehow the issue is fixed. Perhaps there was still an old version around on my system somehow, I don't know. Anyways, it magically started working and my CI is happy too. Thanks a lot for your help and your quick replies! 😊 |
Oh I believe you. I was getting my own weirdness, highlighted by the multiple pushes above. In some instances, my LSP would report an error, and
Excellent!
My pleasure. Please feel free to ping me if you have any more issues or questions. |
Hi, I'm trying to use your library in a project for work, but running
npm run build
in our project fails due to the following error:I see that the mentioned
StdioOverrideFunction
is defined in thetypes
folder in this repo, but not insrc/index.ts
and it's apparent that the TypeScript compiler isn't including that type into the finaldist/index.d.ts
.Can you fix this? It's breaking TypeScript builds at the moment.
The text was updated successfully, but these errors were encountered: