| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -87,6 +87,20 @@ declare global { | |||
| 87 | 87 | | BigUint64Array | |
| 88 | 88 | | BigInt64Array; | |
| 89 | 89 | ||
| 90 | + type TypedArrayConstructor = | ||
| 91 | + | typeof Uint8Array | ||
| 92 | + | typeof Uint8ClampedArray | ||
| 93 | + | typeof Uint16Array | ||
| 94 | + | typeof Uint32Array | ||
| 95 | + | typeof Int8Array | ||
| 96 | + | typeof Int16Array | ||
| 97 | + | typeof Int32Array | ||
| 98 | + | typeof Float16Array | ||
| 99 | + | typeof Float32Array | ||
| 100 | + | typeof Float64Array | ||
| 101 | + | typeof BigUint64Array | ||
| 102 | + | typeof BigInt64Array; | ||
| 103 | + | ||
| 90 | 104 | namespace NodeJS { | |
| 91 | 105 | interface Global { | |
| 92 | 106 | internalBinding<T extends InternalBindingKeys>(binding: T): InternalBindingMap[T] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,7 +19,7 @@ type UncurryGetter<O, K extends keyof O, T = O> = | |||
| 19 | 19 | type UncurrySetter<O, K extends keyof O, T = O> = | |
| 20 | 20 | O[K] extends infer V ? (self: T, value: V) => void : never; | |
| 21 | 21 | ||
| 22 | - type TypedArrayContentType<T extends TypedArray> = T extends { [k: number]: infer V } ? V : never; | ||
| 22 | + type TypedArrayContentType<T extends TypedArrayConstructor> = InstanceType<T>[number]; | ||
| 23 | 23 | ||
| 24 | 24 | /** | |
| 25 | 25 | * Primordials are a way to safely use globals without fear of global mutation | |
@@ -472,43 +472,30 @@ declare namespace primordials { | |||
| 472 | 472 | export const SyntaxErrorPrototype: typeof SyntaxError.prototype | |
| 473 | 473 | export import TypeError = globalThis.TypeError; | |
| 474 | 474 | export const TypeErrorPrototype: typeof TypeError.prototype | |
| 475 | - export function TypedArrayFrom<T extends TypedArray>( | ||
| 476 | - constructor: new (length: number) => T, | ||
| 477 | - source: | ||
| 478 | - | Iterable<TypedArrayContentType<T>> | ||
| 479 | - | ArrayLike<TypedArrayContentType<T>>, | ||
| 480 | - ): T; | ||
| 481 | - export function TypedArrayFrom<T extends TypedArray, U, THIS_ARG = undefined>( | ||
| 482 | - constructor: new (length: number) => T, | ||
| 475 | + export function TypedArrayFrom<T extends TypedArrayConstructor>( | ||
| 476 | + constructor: T, | ||
| 477 | + source: Iterable<TypedArrayContentType<T>> | ArrayLike<TypedArrayContentType<T>>, | ||
| 478 | + ): InstanceType<T> | ||
| 479 | + export function TypedArrayFrom<T extends TypedArrayConstructor, U, THIS_ARG = undefined>( | ||
| 480 | + constructor: T, | ||
| 483 | 481 | source: Iterable<U> | ArrayLike<U>, | |
| 484 | 482 | mapfn: ( | |
| 485 | 483 | this: THIS_ARG, | |
| 486 | 484 | value: U, | |
| 487 | 485 | index: number, | |
| 488 | 486 | ) => TypedArrayContentType<T>, | |
| 489 | 487 | thisArg?: THIS_ARG, | |
| 490 | - ): T; | ||
| 491 | - export function TypedArrayOf<T extends TypedArray>( | ||
| 492 | - constructor: new (length: number) => T, | ||
| 493 | - ...items: readonly TypedArrayContentType<T>[] | ||
| 494 | - ): T; | ||
| 495 | - export function TypedArrayOfApply<T extends TypedArray>( | ||
| 496 | - constructor: new (length: number) => T, | ||
| 488 | + ): InstanceType<T>; | ||
| 489 | + export function TypedArrayOf<T extends TypedArrayConstructor>( | ||
| 490 | + constructor: T, | ||
| 491 | + ...items: TypedArrayContentType<T>[], | ||
| 492 | + ): InstanceType<T>; | ||
| 493 | + export function TypedArrayOfApply<T extends TypedArrayConstructor>( | ||
| 494 | + constructor: T, | ||
| 497 | 495 | items: readonly TypedArrayContentType<T>[], | |
| 498 | - ): T; | ||
| 499 | - export const TypedArray: TypedArray; | ||
| 500 | - export const TypedArrayPrototype: | ||
| 501 | - | typeof Uint8Array.prototype | ||
| 502 | - | typeof Int8Array.prototype | ||
| 503 | - | typeof Uint16Array.prototype | ||
| 504 | - | typeof Int16Array.prototype | ||
| 505 | - | typeof Uint32Array.prototype | ||
| 506 | - | typeof Int32Array.prototype | ||
| 507 | - | typeof Float32Array.prototype | ||
| 508 | - | typeof Float64Array.prototype | ||
| 509 | - | typeof BigInt64Array.prototype | ||
| 510 | - | typeof BigUint64Array.prototype | ||
| 511 | - | typeof Uint8ClampedArray.prototype; | ||
| 496 | + ): InstanceType<T>; | ||
| 497 | + export const TypedArray: TypedArrayConstructor; | ||
| 498 | + export const TypedArrayPrototype: TypedArrayConstructor["prototype"]; | ||
| 512 | 499 | export const TypedArrayPrototypeGetBuffer: UncurryGetter<TypedArray, "buffer">; | |
| 513 | 500 | export const TypedArrayPrototypeGetByteLength: UncurryGetter<TypedArray, "byteLength">; | |
| 514 | 501 | export const TypedArrayPrototypeGetByteOffset: UncurryGetter<TypedArray, "byteOffset">; | |
@@ -519,19 +506,7 @@ declare namespace primordials { | |||
| 519 | 506 | export function TypedArrayPrototypeSet<T extends TypedArray>(self: T, ...args: Parameters<T["set"]>): ReturnType<T["set"]>; | |
| 520 | 507 | export function TypedArrayPrototypeSubarray<T extends TypedArray>(self: T, ...args: Parameters<T["subarray"]>): ReturnType<T["subarray"]>; | |
| 521 | 508 | export function TypedArrayPrototypeSlice<T extends TypedArray>(self: T, ...args: Parameters<T["slice"]>): ReturnType<T["slice"]>; | |
| 522 | - export function TypedArrayPrototypeGetSymbolToStringTag(self: unknown): | ||
| 523 | - | 'Int8Array' | ||
| 524 | - | 'Int16Array' | ||
| 525 | - | 'Int32Array' | ||
| 526 | - | 'Uint8Array' | ||
| 527 | - | 'Uint16Array' | ||
| 528 | - | 'Uint32Array' | ||
| 529 | - | 'Uint8ClampedArray' | ||
| 530 | - | 'BigInt64Array' | ||
| 531 | - | 'BigUint64Array' | ||
| 532 | - | 'Float32Array' | ||
| 533 | - | 'Float64Array' | ||
| 534 | - | undefined; | ||
| 509 | + export function TypedArrayPrototypeGetSymbolToStringTag(self: unknown): TypedArray[typeof Symbol.toStringTag] | undefined; | ||
| 535 | 510 | export import URIError = globalThis.URIError; | |
| 536 | 511 | export const URIErrorPrototype: typeof URIError.prototype | |
| 537 | 512 | export import Uint16Array = globalThis.Uint16Array; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments