From b8db8d645ee47980c034b104cc59bc22db7dc6c8 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Mon, 8 Jul 2024 13:50:17 +0200 Subject: [PATCH] doc: add strip-types proposal --- .DS_Store | Bin 0 -> 6148 bytes doc/.DS_Store | Bin 0 -> 6148 bytes doc/design/proposal-strip-types.md | 71 +++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 .DS_Store create mode 100644 doc/.DS_Store create mode 100644 doc/design/proposal-strip-types.md diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..7521819700943c6244f084707dcaba18b3eba1b1 GIT binary patch literal 6148 zcmeHKJ5Iwu5S?*cSkR=TLVE(FbVzBO$dpvMKonaFNU@v(Itm{n+<+T!0}jI#Xn3TiDZ@9zfO_KUP5w$VQJVa!UJJV1!^i=i@}->d$73DuvgS{VrxFwDt|RE z9IIph5W|T}MW3AkXCP%@qRXk=|2Oz#Mw|RJ#aGUNGw{zC;JjK@OT3ibttYQ1cWuB} tV~9vxFA4;D@)LlCoFf;}ss123;!49_QFak~Ob7apKqSN`XW$nY_yqk)K!pGR literal 0 HcmV?d00001 diff --git a/doc/.DS_Store b/doc/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..1d01845dfdad24a772252b59db2de38fc295b973 GIT binary patch literal 6148 zcmeHKu};H447E#zidZ@_q5FmYL8!vW)PV`9Dya%m(^M+#H}MB7NDORz2_L|>@BuuZ ztEOOdoMvM7uFuHE) zW#;XM|Hy#6yF;pIN-Mgh?EQ_OzpvL#Sx)B71oqzL%hMH~zMbVh)lQ$~&E`3Y*aC;F zMjlhTLnaI4vTC2D$Mgfg!a3z%I;5Fqd9JVuE2|7!|PsVGRXpC|irc8V-9f zzrrvoYB;eqA8dDK>rgn|9s7smPFyJZ=nOamZ3YhXvM=@j{OA6^9pqQefHSaH3~;v` zl|wv|)z<9cq}B%L7%C!uQE?rDNh-zgl~Q~HO#*w639vAXim*WZM Note that the missing types are replaced with whitespace, so the line numbers are preserved, so that sourcemaps are not needed. + +By removing types completely, we can avoid the need to commit to supporting TypeScript in the long term, as the feature is not a full TypeScript implementation. +As in JavaScript files, file extensions are required in `import` statements and `import()` expressions. +TypeScript features that depend on settings within `tsconfig.json`, such as paths or converting module formats, are unsupported. +This will solve the long term compatibility issue, but might not be as complete as a full TypeScript implementation. + +## Limitations + +### `.js` extension for `.ts` files + +The reason is that the compiler/bundler should be responsible to resolve the correct extension at compile time. +At runtime, the extension must be correct, not to add overhead in production when it can be solved during development. +This is an issue that should apply to all tools that execute TypeScript at runtime. + +### No type checking + +Type checking should be done by user land tools during development, and not at runtime. +By performing at runtime, we would be adding large overhead. + +### Running TypeScript in node_modules + +The proposal does not support running TypeScript files in `node_modules`. +This is to avoid encouraging package maintainers to ship TypeScript files in their packages. This has been explicitly requested by TypeScript maintainers. + +### Monorepos support + +Due to not running TypeScript in `node_modules`, monorepos are not supported. +This is a limitation that should be solved by user land tools.