Comparing version 0.3.21-6 to 0.3.21-7
@@ -57,13 +57,33 @@ declare module 'bitecs' { | ||
type BuildPowersOf2LengthArrays<N extends number, R extends never[][]> = R[0][N] extends never ? R : BuildPowersOf2LengthArrays<N, [[...R[0], ...R[0]], ...R]>; | ||
type ConcatLargestUntilDone<N extends number, R extends never[][], B extends never[]> = B["length"] extends N ? B : [...R[0], ...B][N] extends never | ||
? ConcatLargestUntilDone<N, R extends [R[0], ...infer U] ? U extends never[][] ? U : never : never, B> | ||
: ConcatLargestUntilDone<N, R extends [R[0], ...infer U] ? U extends never[][] ? U : never : never, [...R[0], ...B]>; | ||
type Replace<R extends any[], T> = { [K in keyof R]: T } | ||
type TupleOf<T, N extends number> = number extends N ? T[] : { | ||
[K in N]: | ||
BuildPowersOf2LengthArrays<K, [[never]]> extends infer U ? U extends never[][] | ||
? Replace<ConcatLargestUntilDone<K, U, []>, T> : never : never; | ||
}[N] | ||
type TuplePop<T> = T extends [any, ...infer L] ? L : never | ||
export type ArrayType<T, L extends number> = Omit<T, number> & {length: L} & {[K in NonNullable<Partial<TuplePop<TupleOf<any, L>>>["length"]>]: number} | ||
export type ComponentType<T extends ISchema> = { | ||
[key in keyof T]: T[key] extends Type | ||
? ArrayByType[T[key]] | ||
: T[key] extends [infer RT, number] | ||
? RT extends Type | ||
? Array<ArrayByType[RT]> | ||
[K in keyof T]: T[K] extends Type | ||
? ArrayByType[T[K]] | ||
: T[K] extends readonly [infer RT, number] | ||
? RT extends Type | ||
? T[K] extends readonly [RT, infer L] | ||
? L extends number | ||
? number extends L | ||
? ArrayByType[RT][] | ||
: ArrayType<ArrayByType[RT], L>[] | ||
: unknown | ||
: unknown | ||
: T[key] extends ISchema | ||
? ComponentType<T[key]> | ||
: unknown; | ||
}; | ||
: unknown | ||
: T[K] extends ISchema | ||
? ComponentType<T[K]> | ||
: unknown | ||
} & {} | ||
@@ -78,8 +98,10 @@ export interface IWorld { | ||
export interface IComponentProp { | ||
[key: string]: TypedArray | Array<TypedArray> | ||
} | ||
// export interface IComponentProp { | ||
// [key: string]: TypedArray | Array<TypedArray> | ||
// } | ||
export type ComponentProp = TypedArray | Array<TypedArray> | ||
export interface IComponent { | ||
[key: string]: IComponentProp | ||
[key: string]: ComponentProp | IComponent | ||
} | ||
@@ -86,0 +108,0 @@ |
@@ -57,13 +57,33 @@ declare module 'bitecs' { | ||
type BuildPowersOf2LengthArrays<N extends number, R extends never[][]> = R[0][N] extends never ? R : BuildPowersOf2LengthArrays<N, [[...R[0], ...R[0]], ...R]>; | ||
type ConcatLargestUntilDone<N extends number, R extends never[][], B extends never[]> = B["length"] extends N ? B : [...R[0], ...B][N] extends never | ||
? ConcatLargestUntilDone<N, R extends [R[0], ...infer U] ? U extends never[][] ? U : never : never, B> | ||
: ConcatLargestUntilDone<N, R extends [R[0], ...infer U] ? U extends never[][] ? U : never : never, [...R[0], ...B]>; | ||
type Replace<R extends any[], T> = { [K in keyof R]: T } | ||
type TupleOf<T, N extends number> = number extends N ? T[] : { | ||
[K in N]: | ||
BuildPowersOf2LengthArrays<K, [[never]]> extends infer U ? U extends never[][] | ||
? Replace<ConcatLargestUntilDone<K, U, []>, T> : never : never; | ||
}[N] | ||
type TuplePop<T> = T extends [any, ...infer L] ? L : never | ||
export type ArrayType<T, L extends number> = Omit<T, number> & {length: L} & {[K in NonNullable<Partial<TuplePop<TupleOf<any, L>>>["length"]>]: number} | ||
export type ComponentType<T extends ISchema> = { | ||
[key in keyof T]: T[key] extends Type | ||
? ArrayByType[T[key]] | ||
: T[key] extends [infer RT, number] | ||
? RT extends Type | ||
? Array<ArrayByType[RT]> | ||
[K in keyof T]: T[K] extends Type | ||
? ArrayByType[T[K]] | ||
: T[K] extends readonly [infer RT, number] | ||
? RT extends Type | ||
? T[K] extends readonly [RT, infer L] | ||
? L extends number | ||
? number extends L | ||
? ArrayByType[RT][] | ||
: ArrayType<ArrayByType[RT], L>[] | ||
: unknown | ||
: unknown | ||
: T[key] extends ISchema | ||
? ComponentType<T[key]> | ||
: unknown; | ||
}; | ||
: unknown | ||
: T[K] extends ISchema | ||
? ComponentType<T[K]> | ||
: unknown | ||
} & {} | ||
@@ -78,8 +98,10 @@ export interface IWorld { | ||
export interface IComponentProp { | ||
[key: string]: TypedArray | Array<TypedArray> | ||
} | ||
// export interface IComponentProp { | ||
// [key: string]: TypedArray | Array<TypedArray> | ||
// } | ||
export type ComponentProp = TypedArray | Array<TypedArray> | ||
export interface IComponent { | ||
[key: string]: IComponentProp | ||
[key: string]: ComponentProp | IComponent | ||
} | ||
@@ -86,0 +108,0 @@ |
{ | ||
"name": "bitecs", | ||
"version": "0.3.21-6", | ||
"version": "0.3.21-7", | ||
"description": "Functional, minimal, data-driven, ultra-high performance ECS library written in Javascript", | ||
@@ -5,0 +5,0 @@ "license": "MPL-2.0", |
@@ -99,1 +99,3 @@ # 👾 bitECS 👾 [![npm](https://img.shields.io/npm/v/bitecs.svg)](https://www.npmjs.com/package/bitecs) [![Minzipped](https://badgen.net/bundlephobia/minzip/bitecs)](https://www.npmjs.com/package/bitecs) [![npm](https://img.shields.io/npm/dt/bitecs.svg)](https://www.npmjs.com/package/bitecs) [![License](https://badgen.net/npm/license/bitecs)](https://www.npmjs.com/package/bitecs) | ||
<a href="https://github.com/XRFoundation/XREngine"><img src="https://github.com/XRFoundation/XREngine/raw/master/xrengine%20black.png" width="420"/></a> | ||
<a href="https://github.com/thirdroom/thirdroom"><img src="https://github.com/thirdroom/thirdroom/raw/main/docs/assets/logo.png" width="420"/></a> |
@@ -13,6 +13,3 @@ { | ||
"sourceMap": true, | ||
"outDir": "./dist", | ||
"allowJs": true, | ||
"checkJs": false, | ||
"types": ["node"] | ||
"outDir": "./dist" | ||
}, | ||
@@ -19,0 +16,0 @@ "include": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
263601
2837
101