Begin migration to typescript - #1186
Conversation
| "import": "./lib/es2015/esm/single-spa.dev.js", | ||
| "require": "./lib/es2015/umd/single-spa.dev.cjs" | ||
| "require": "./lib/es2015/umd/single-spa.dev.cjs", | ||
| "types": "./typings/single-spa.d.ts" |
There was a problem hiding this comment.
Do we need separate types for import/require? With a .cts extension? I'm looking at https://github.com/single-spa/single-spa-react/pull/197/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R16 for reference and am unsure
| "@rollup/plugin-commonjs": "^19.0.0", | ||
| "@rollup/plugin-node-resolve": "^13.0.0", | ||
| "@rollup/plugin-replace": "^2.3.1", | ||
| "@rollup/plugin-terser": "^0.4.4", |
There was a problem hiding this comment.
The old terser plugin wasn't working for some reason with babel preset typescript, so I upgraded to it
| window.__SINGLE_SPA_DEVTOOLS__.exposedMethods = devtools; | ||
| } | ||
|
|
||
| declare global { |
There was a problem hiding this comment.
I initially had this in a separate file globals.ts but ended up colocating it with where __SINGLE_SPA_DEVTOOLS__ is defined. I have my own typescript patterns that are fairly loose but don't involve a strict folder/file structure. I prefer colocating interfaces in the files that use them much of the time. Perhaps over time, we can develop more established typescript patterns for single-spa projects. I'm open to feedback on typescript patterns - generally I don't prefer lots of folders and files when inlining interfaces does fine
| @@ -1,238 +0,0 @@ | |||
| declare module "single-spa" { | |||
| interface CustomProps { | |||
There was a problem hiding this comment.
I'll move many of these types into .ts source files in subsequent PRs.
This sets up the migration to typescript, by getting the type declarations, tests, and build working with typescript. It will be followed up with more PRs to migrate the source files. This PR is going into a new
7.0branch since the migration to typescript will be a breaking change.