Closed
Description
Making tsserver.js
a Library
https://github.com/microsoft/TypeScript/pull/39291/files?w=1
- 10% of size of a specific Electron-based editor is TypeScript! Oops!
- Have been looking into producing smaller outputs, but also ways to deduplicate code.
- Modules would fix this, but that's down the road.
tsserver.js
is used for general editing,typescript.js
is used for aggregating some data in other contexts - kind of want to consolidate.- Ideally could use
tsserverlibrary.js
. - Seems like one file can call out to another.
Minifying our Outputs
/ghexp/dtsminify/typescript_dts-minify/lib$ ls -lh tsserver.*
-rw-rw-r-- 1 acasey acasey 8.5M Jul 1 01:17 tsserver.js
-rw-rw-r-- 1 acasey acasey 1.6M Jul 1 01:17 tsserver.js.gz
-rw-rw-r-- 1 acasey acasey 4.6M Jul 1 01:19 tsserver.min.js
-rw-rw-r-- 1 acasey acasey 917K Jul 1 01:19 tsserver.min.js.gz
- Should we do this?
- Can't debug as easily.
- Have to have some sort of way to map back to source.
- Does this actually make sense?
- We really want to fix the "we need to switch to modules" problem.
- We at least want to reduce download time.
- We're fine with other people minifying the TypeScript that they ship, but we want to wait on our own infrastructure first.
- Choosing not to minify at this time.
Abstract Constructors and Construct Signatures
- We already have a pattern that supports mixin factory patterns.
- The problem is that it doesn't work well for abstract classes.
- Not assignable to constructor functions.
- There's a hack to write
Function & { prototype: Ctor }
, but givenclass Foo<T> {}
, trying to infer from atypeof Foo
toCtor
will lose the genericity ofFoo
.- Also accepts non-constructor functions, which isn't exactly desirable.
- Does the output of a mixin function also product an abstract signature?
- You can manually toggle it with the modifier.
- But having some sort of
class
type syntax. - Able to model methods that are still marked as
abstract
.
- Want to get a sense of whether this is interesting to others.
- Still in progress.
Recommended Base TSConfigs
- Kind of a DT-like repo that aggregates tsconfigs that we think are good.
- "You say 'recommended' but it fires the wrong neurons for me and makes me mad. My experience with eslint, tslint - the 'recommended' rules make no sense."
useDefineForClassFields
- maybe not great because the emit isn't great.skipLibCheck
- is that actually good?- Diverging between
tsc --init
andtsconfig/recommended
- Lots of options in the team chat that are hard!
- jsx: react? Sure
- declaration: true? Okay
- moduleResolution: node? Sure
- module: esnext? Uh
- declarationMap: true?: Okay...
- incremental: true? Ugh, right, yes.
recommended
might not be a great idea