solid
solid copied to clipboard
typescript checking/compilation of ./store package is very slow
Describe the bug
when developing an app using solid-js/store, tsserver will lag and build tooling will stall for several seconds as store.d.ts is parsed
Your Example Website or App
https://github.com/solidjs/solid
Steps to Reproduce the Bug or Issue
cd packages/solid
pnpm tsc --project ./store/tsconfig.build.json --diagnostics --incremental false --generateTrace store-tsc-trace
npx @typescript/analyze-trace store-tsc-trace
Expected behavior
expected no hotspots, but i see:
Hot Spots
└─ Check file packages/solid/store/src/store.ts (2714ms)
└─ Compare types 44453 and 61141 (2274ms)
└─ Compare types 44453 and 61184 (2274ms)
└─ Compare types 44453 and 61140 (2273ms)
└─ Compare types 44453 and 61940 (2271ms)
└─ Compare types 44453 and 61941 (2271ms)
└─ Compare types 44453 and 61944 (2271ms)
└─ Compare types 44453 and 61942 (2270ms)
└─ Compare types 44453 and 61945 (2270ms)
└─ Compare types 44453 and 61949 (2270ms)
├─ Compare types 44453 and 61946 (1171ms)
│ └─ Compare types 44453 and 61950 (1171ms)
│ └─ Compare types 44453 and 61951 (1171ms)
│ └─ Compare types 44453 and 61952 (1171ms)
│ └─ Compare types 44453 and 61978 (1171ms)
│ └─ Compare types 44453 and 61976 (1170ms)
│ └─ Compare types 44453 and 64216 (1162ms)
│ └─ Compare types 44453 and 64217 (1162ms)
│ └─ Compare types 44453 and 64221 (1162ms)
│ ├─ {"id":44453,"kind":"TypeParameter","name":"K7","location":{"path":"packages/solid/store/src/store.ts","line":399,"char":5}}
│ └─ {"id":64221,"kind":"Intersection","count":3,"types":[64218,64219,64220]}
│ ├─ {"id":64218,"kind":"IndexType","keyofType":62028}
│ │ └─ {"id":62028,"kind":"AliasedConditionalType","name":"Exclude","aliasTypeArguments":[62014,43330],"conditionalCheckType":62014,"conditionalExtendsType":43330,"conditionalTrueType":24,"conditionalFalseType":62014,"location":{"path":"node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts","line":1613,"char":1}}
│ │ ├─ {"id":62014,"kind":"IndexedAccess","indexedAccessObjectType":52852,"indexedAccessIndexType":14}
│ │ │ ├─ {"id":52852,"kind":"AliasedConditionalType","name":"Exclude","aliasTypeArguments":[52838,43330],"conditionalCheckType":52838,"conditionalExtendsType":43330,"conditionalTrueType":24,"conditionalFalseType":52838,"location":{"path":"node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts","line":1613,"char":1}}
│ │ │ │ ├─ {"id":52838,"kind":"IndexedAccess","indexedAccessObjectType":47460,"indexedAccessIndexType":14}
│ │ │ │ │ ├─ {"id":47460,"kind":"AliasedConditionalType","name":"Exclude","aliasTypeArguments":[45448,43330],"conditionalCheckType":45448,"conditionalExtendsType":43330,"conditionalTrueType":24,"conditionalFalseType":45448,"location":{"path":"node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts","line":1613,"char":1}}
│ │ │ │ │ │ ├─ {"id":45448,"kind":"IndexedAccess","indexedAccessObjectType":45368,"indexedAccessIndexType":44450}
│ │ │ │ │ │ │ ├─ {"id":45368,"kind":"AliasedConditionalType","name":"Exclude","aliasTypeArguments":[44851,43330],"conditionalCheckType":44851,"conditionalExtendsType":43330,"conditionalTrueType":24,"conditionalFalseType":44851,"location":{"path":"node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts","line":1613,"char":1}}
│ │ │ │ │ │ │ │ ├─ {"id":44851,"kind":"IndexedAccess","indexedAccessObjectType":44796,"indexedAccessIndexType":44449}
│ │ │ │ │ │ │ │ │ ├─ {"id":44796,"kind":"AliasedConditionalType","name":"Exclude","aliasTypeArguments":[44581,43330],"conditionalCheckType":44581,"conditionalExtendsType":43330,"conditionalTrueType":24,"conditionalFalseType":44581,"location":{"path":"node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts","line":1613,"char":1}}
│ │ │ │ │ │ │ │ │ │ ├─ {"id":44581,"kind":"IndexedAccess","indexedAccessObjectType":44541,"indexedAccessIndexType":44448}
│ │ │ │ │ │ │ │ │ │ │ ├─ {"id":44541,"kind":"AliasedConditionalType","name":"Exclude","aliasTypeArguments":[44540,43330],"conditionalCheckType":44540,"conditionalExtendsType":43330,"conditionalTrueType":24,"conditionalFalseType":44540,"location":{"path":"node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts","line":1613,"char":1}}
│ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":44540,"kind":"IndexedAccess","indexedAccessObjectType":44517,"indexedAccessIndexType":44447}
│ │ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":44517,"kind":"AliasedConditionalType","name":"Exclude","aliasTypeArguments":[44443,43330],"conditionalCheckType":44443,"conditionalExtendsType":43330,"conditionalTrueType":24,"conditionalFalseType":44443,"location":{"path":"node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts","line":1613,"char":1}}
│ │ │ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":44443,"kind":"TypeParameter","name":"T","location":{"path":"packages/solid/store/src/store.ts","line":391,"char":35}}
│ │ │ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":43330,"kind":"AliasedUnion","name":"NotWrappable","count":9,"types":[10,13,14,15,16,18,20,22,68],"location":{"path":"packages/solid/store/src/store.ts","line":34,"char":1}}
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":10,"kind":"Intrinsic","name":"undefined"}
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":13,"kind":"Intrinsic","name":"null"}
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":14,"kind":"Intrinsic","name":"string"}
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":15,"kind":"Intrinsic","name":"number"}
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":16,"kind":"Intrinsic","name":"bigint"}
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":18,"kind":"Intrinsic","name":"false"}
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":20,"kind":"Intrinsic","name":"true"}
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":22,"kind":"Intrinsic","name":"symbol"}
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └─ {"id":68,"kind":"Object","name":"Function","location":{"path":"node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts","line":275,"char":1}}
│ │ │ │ │ │ │ │ │ │ │ │ │ │ └─ {"id":24,"kind":"Intrinsic","name":"never"}
│ │ │ │ │ │ │ │ │ │ │ │ │ └─ {"id":44447,"kind":"TypeParameter","name":"K1","location":{"path":"packages/solid/store/src/store.ts","line":393,"char":5}}
│ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":43330,"kind":"AliasedUnion","name":"NotWrappable","count":9,"types":[10,13,14,15,16,18,20,22,68],"location":{"path":"packages/solid/store/src/store.ts","line":34,"char":1}}
│ │ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":10,"kind":"Intrinsic","name":"undefined"}
│ │ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":13,"kind":"Intrinsic","name":"null"}
│ │ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":14,"kind":"Intrinsic","name":"string"}
│ │ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":15,"kind":"Intrinsic","name":"number"}
│ │ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":16,"kind":"Intrinsic","name":"bigint"}
│ │ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":18,"kind":"Intrinsic","name":"false"}
│ │ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":20,"kind":"Intrinsic","name":"true"}
│ │ │ │ │ │ │ │ │ │ │ │ │ ├─ {"id":22,"kind":"Intrinsic","name":"symbol"}
│ │ │ │ │ │ │ │ │ │ │ │ │ └─ {"id":68,"kind":"Object","name":"Function","location":{"path":"node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts","line":275,"char":1}}
│ │ │ │ │ │ │ │ │ │ │ │ └─ {"id":24,"kind":"Intrinsic","name":"never"}
│ │ │ │ │ │ │ │ │ │ │ └─ {"id":44448,"kind":"TypeParameter","name":"K2","location":{"path":"packages/solid/store/src/store.ts","line":394,"char":5}}
│ │ │ │ │ │ │ │ │ │ ├─ {"id":43330,"kind":"AliasedUnion","name":"NotWrappable","count":9,"types":[10,13,14,15,16,18,20,22,68],"location":{"path":"packages/solid/store/src/store.ts","line":34,"char":1}}
│ │ │ │ │ │ │ │ │ │ │ ├─ {"id":10,"kind":"Intrinsic","name":"undefined"}
│ │ │ │ │ │ │ │ │ │ │ ├─ {"id":13,"kind":"Intrinsic","name":"null"}
│ │ │ │ │ │ │ │ │ │ │ ├─ {"id":14,"kind":"Intrinsic","name":"string"}
│ │ │ │ │ │ │ │ │ │ │ ├─ {"id":15,"kind":"Intrinsic","name":"number"}
│ │ │ │ │ │ │ │ │ │ │ ├─ {"id":16,"kind":"Intrinsic","name":"bigint"}
│ │ │ │ │ │ │ │ │ │ │ ├─ {"id":18,"kind":"Intrinsic","name":"false"}
│ │ │ │ │ │ │ │ │ │ │ ├─ {"id":20,"kind":"Intrinsic","name":"true"}
│ │ │ │ │ │ │ │ │ │ │ ├─ {"id":22,"kind":"Intrinsic","name":"symbol"}
│ │ │ │ │ │ │ │ │ │ │ └─ {"id":68,"kind":"Object","name":"Function","location":{"path":"node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts","line":275,"char":1}}
│ │ │ │ │ │ │ │ │ │ └─ {"id":24,"kind":"Intrinsic","name":"never"}
│ │ │ │ │ │ │ │ │ └─ {"id":44449,"kind":"TypeParameter","name":"K3","location":{"path":"packages/solid/store/src/store.ts","line":395,"char":5}}
│ │ │ │ │ │ │ │ ├─ {"id":43330,"kind":"AliasedUnion","name":"NotWrappable","count":9,"types":[10,13,14,15,16,18,20,22,68],"location":{"path":"packages/solid/store/src/store.ts","line":34,"char":1}}
│ │ │ │ │ │ │ │ │ ├─ {"id":10,"kind":"Intrinsic","name":"undefined"}
│ │ │ │ │ │ │ │ │ ├─ {"id":13,"kind":"Intrinsic","name":"null"}
│ │ │ │ │ │ │ │ │ ├─ {"id":14,"kind":"Intrinsic","name":"string"}
│ │ │ │ │ │ │ │ │ ├─ {"id":15,"kind":"Intrinsic","name":"number"}
│ │ │ │ │ │ │ │ │ ├─ {"id":16,"kind":"Intrinsic","name":"bigint"}
│ │ │ │ │ │ │ │ │ ├─ {"id":18,"kind":"Intrinsic","name":"false"}
│ │ │ │ │ │ │ │ │ ├─ {"id":20,"kind":"Intrinsic","name":"true"}
│ │ │ │ │ │ │ │ │ ├─ {"id":22,"kind":"Intrinsic","name":"symbol"}
│ │ │ │ │ │ │ │ │ └─ {"id":68,"kind":"Object","name":"Function","location":{"path":"node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts","line":275,"char":1}}
│ │ │ │ │ │ │ │ └─ {"id":24,"kind":"Intrinsic","name":"never"}
│ │ │ │ │ │ │ └─ {"id":44450,"kind":"TypeParameter","name":"K4","location":{"path":"packages/solid/store/src/store.ts","line":396,"char":5}}
│ │ │ │ │ │ ├─ {"id":43330,"kind":"AliasedUnion","name":"NotWrappable","count":9,"types":[10,13,14,15,16,18,20,22,68],"location":{"path":"packages/solid/store/src/store.ts","line":34,"char":1}}
│ │ │ │ │ │ │ ├─ {"id":10,"kind":"Intrinsic","name":"undefined"}
│ │ │ │ │ │ │ ├─ {"id":13,"kind":"Intrinsic","name":"null"}
│ │ │ │ │ │ │ ├─ {"id":14,"kind":"Intrinsic","name":"string"}
│ │ │ │ │ │ │ ├─ {"id":15,"kind":"Intrinsic","name":"number"}
│ │ │ │ │ │ │ ├─ {"id":16,"kind":"Intrinsic","name":"bigint"}
│ │ │ │ │ │ │ ├─ {"id":18,"kind":"Intrinsic","name":"false"}
│ │ │ │ │ │ │ ├─ {"id":20,"kind":"Intrinsic","name":"true"}
│ │ │ │ │ │ │ ├─ {"id":22,"kind":"Intrinsic","name":"symbol"}
│ │ │ │ │ │ │ └─ {"id":68,"kind":"Object","name":"Function","location":{"path":"node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts","line":275,"char":1}}
│ │ │ │ │ │ └─ {"id":24,"kind":"Intrinsic","name":"never"}
│ │ │ │ │ └─ {"id":14,"kind":"Intrinsic","name":"string"}
│ │ │ │ ├─ {"id":43330,"kind":"AliasedUnion","name":"NotWrappable","count":9,"types":[10,13,14,15,16,18,20,22,68],"location":{"path":"packages/solid/store/src/store.ts","line":34,"char":1}}
│ │ │ │ │ ├─ {"id":10,"kind":"Intrinsic","name":"undefined"}
│ │ │ │ │ ├─ {"id":13,"kind":"Intrinsic","name":"null"}
│ │ │ │ │ ├─ {"id":14,"kind":"Intrinsic","name":"string"}
│ │ │ │ │ ├─ {"id":15,"kind":"Intrinsic","name":"number"}
│ │ │ │ │ ├─ {"id":16,"kind":"Intrinsic","name":"bigint"}
│ │ │ │ │ ├─ {"id":18,"kind":"Intrinsic","name":"false"}
│ │ │ │ │ ├─ {"id":20,"kind":"Intrinsic","name":"true"}
│ │ │ │ │ ├─ {"id":22,"kind":"Intrinsic","name":"symbol"}
│ │ │ │ │ └─ {"id":68,"kind":"Object","name":"Function","location":{"path":"node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts","line":275,"char":1}}
│ │ │ │ └─ {"id":24,"kind":"Intrinsic","name":"never"}
│ │ │ └─ {"id":14,"kind":"Intrinsic","name":"string"}
│ │ ├─ {"id":43330,"kind":"AliasedUnion","name":"NotWrappable","count":9,"types":[10,13,14,15,16,18,20,22,68],"location":{"path":"packages/solid/store/src/store.ts","line":34,"char":1}}
│ │ │ ├─ {"id":10,"kind":"Intrinsic","name":"undefined"}
│ │ │ ├─ {"id":13,"kind":"Intrinsic","name":"null"}
│ │ │ ├─ {"id":14,"kind":"Intrinsic","name":"string"}
│ │ │ ├─ {"id":15,"kind":"Intrinsic","name":"number"}
│ │ │ ├─ {"id":16,"kind":"Intrinsic","name":"bigint"}
│ │ │ ├─ {"id":18,"kind":"Intrinsic","name":"false"}
│ │ │ ├─ {"id":20,"kind":"Intrinsic","name":"true"}
│ │ │ ├─ {"id":22,"kind":"Intrinsic","name":"symbol"}
│ │ │ └─ {"id":68,"kind":"Object","name":"Function","location":{"path":"node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts","line":275,"char":1}}
│ │ └─ {"id":24,"kind":"Intrinsic","name":"never"}
│ ├─ {"id":64219,"kind":"IndexType","keyofType":62029}
...
Platform
mac, 4d824b08d8534d2a079f9ca4c1ea980684c05582
I'm not surprised as the types for Stores.. especially the setter types are quite expensive I imagine. Honestly I didn't know if it would even be possible to type this interface originally. We are looking at alternative Store Set APIs in 2.0 but I'm unsure that we can do much to improve type performance of the current interface.