You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exporttypeKeysOfType<T,U,B=false>={[PinkeyofT]: Bextendstrue
? T[P]extendsU
? UextendsT[P]
? P
: never
: never
: T[P]extendsU
? P
: never;}[keyofT];exporttypeBigIntKeys<T>=KeysOfType<T,bigint,true>exporttypeCompatType<T>=Omit<T,BigIntKeys<T>>&{[PropertyinBigIntKeys<T>]: string;};exportfunctioncompatModel<T>(model: T): CompatType<T>{constcompat: Partial<CompatType<T>>={};for(constkofObject.keys(model)asArray<keyofT>){constv=model[k];compat[k]=typeofv==="bigint" ? v.toString() : v;}returncompatasCompatType<T>;};
π Actual behavior
The final compat[k] shows a type error indicating Type 'keyof T' cannot be used to index type 'Partial<CompatType<T>>
π Expected behavior
The keys from T should be allowed to index CompatType<T> since the keys contained in both of the types are identical. The only difference is the values which have changed from bigints to strings.
The text was updated successfully, but these errors were encountered:
Bug Report
π Search Terms
keyof types
π Version & Regression Information
4.2.3 when running on my own machine
4.5.2 when running on ts playground
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
The final compat[k] shows a type error indicating
Type 'keyof T' cannot be used to index type 'Partial<CompatType<T>>
π Expected behavior
The keys from
T
should be allowed to indexCompatType<T>
since the keys contained in both of the types are identical. The only difference is the values which have changed from bigints to strings.The text was updated successfully, but these errors were encountered: