Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* In NoModule builds, switched "export" keyword to "declare" in d.ts file. This aims to be the first step at getting the d.ts file working. The reason for this is that the TypeScript (3.8.3) compiler ignores "declare" statements if it sees "export" statements. Not sure if that's a bug in TypeScript. Either way, all I really did here was scan through all changes to `self.typescript` and see if it could add an "export". The only big wild-card I found was the `typescript_custom_sections`, which I think exists just to let `wasm_buildgen` annotations to add extra typescript to the document? * Trying to putting the generated methods into a `wasm_bindgen` namespace. This is a bit crude, basically anything before the "init" block is put in this namespace. Hopefully this works in general. I'm not 100% sure yet. * Fixed a typo in the comments. * In NoModules d.ts files `init()` is renamed to `wasm_bindgen()`. Based on the output JavaScript this seems to be how it works. * Realized that the function declarations couldn't also have `declare`s. Then traced through the other instances where I'd switched `export` to `declare` and switched them over if they were going to end up in the same `wasm_bindgen` namespace. * Realized there was a nice no_modules() method. * Removing the extra spaces at the end of the .d.ts files. * Realized that can leave the `export` in the namespace declaration. * Adding tests for the no-modules target. I'm hoping that `run.sh` is what the CI runs. * Tried to get the no-modules TypeScript tests to build against actual TypeScript. So now the `*.d.ts` files will actually be build against (modified) `*.ts` files. This should be a better check than only verifying TypeScript doesn't fail when given just the `*.d.ts` files (what it did before). Note that the `*.ts` files are generated from the `*.ts` files in `src` using some fairly simple Regular Expressions. This skips checking the `typescript_tests_bg.wasm.d.ts` file, as I have no experience using that. * Adding more info about the testing changes in run.sh.
- Loading branch information