ci: add typescript validation test using old version

This commit is contained in:
alexander-akait 2025-03-14 01:20:37 +03:00
parent b91099b38e
commit 115f41ee8d
5 changed files with 97 additions and 103 deletions

View File

@ -43,6 +43,11 @@ jobs:
key: lint-cspell-${{ runner.os }}-node-${{ hashFiles('**/yarn.lock', '**/cspell.json') }} key: lint-cspell-${{ runner.os }}-node-${{ hashFiles('**/yarn.lock', '**/cspell.json') }}
restore-keys: lint-cspell- restore-keys: lint-cspell-
- run: yarn lint - run: yarn lint
- name: Validate types using old typescript version
run: |
yarn upgrade typescript@5.0
yarn --frozen-lockfile
yarn type-validate
basic: basic:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:

View File

@ -154,6 +154,7 @@
"lint": "yarn code-lint && yarn special-lint && yarn type-lint && yarn typings-test && yarn module-typings-test && yarn yarn-lint && yarn pretty-lint && yarn spellcheck", "lint": "yarn code-lint && yarn special-lint && yarn type-lint && yarn typings-test && yarn module-typings-test && yarn yarn-lint && yarn pretty-lint && yarn spellcheck",
"code-lint": "node node_modules/eslint/bin/eslint.js --cache .", "code-lint": "node node_modules/eslint/bin/eslint.js --cache .",
"type-lint": "tsc", "type-lint": "tsc",
"type-validate": "tsc -p tsconfig.validation.json",
"typings-test": "tsc -p tsconfig.types.test.json", "typings-test": "tsc -p tsconfig.types.test.json",
"module-typings-test": "tsc -p tsconfig.module.test.json", "module-typings-test": "tsc -p tsconfig.module.test.json",
"spellcheck": "cspell --cache --no-must-find-files --quiet \"**/*.*\"", "spellcheck": "cspell --cache --no-must-find-files --quiet \"**/*.*\"",

4
tsconfig.validation.json Normal file
View File

@ -0,0 +1,4 @@
{
"extends": "./tsconfig",
"include": ["types.d.ts"]
}

185
types.d.ts vendored
View File

@ -244,20 +244,19 @@ declare interface ArgumentConfig {
type: "string" | "number" | "boolean" | "path" | "enum" | "RegExp" | "reset"; type: "string" | "number" | "boolean" | "path" | "enum" | "RegExp" | "reset";
values?: any[]; values?: any[];
} }
type ArrayBufferLike = ArrayBuffer | SharedArrayBuffer; type ArrayBufferView =
type ArrayBufferView<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> = | Uint8Array
| Uint8Array<TArrayBuffer> | Uint8ClampedArray
| Uint8ClampedArray<TArrayBuffer> | Uint16Array
| Uint16Array<TArrayBuffer> | Uint32Array
| Uint32Array<TArrayBuffer> | Int8Array
| Int8Array<TArrayBuffer> | Int16Array
| Int16Array<TArrayBuffer> | Int32Array
| Int32Array<TArrayBuffer> | BigUint64Array
| BigUint64Array<TArrayBuffer> | BigInt64Array
| BigInt64Array<TArrayBuffer> | Float32Array
| Float32Array<TArrayBuffer> | Float64Array
| Float64Array<TArrayBuffer> | DataView;
| DataView<TArrayBuffer>;
declare interface Asset { declare interface Asset {
/** /**
* the filename of the asset * the filename of the asset
@ -872,10 +871,10 @@ type BufferEncoding =
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| "base64"
| "base64url"
| "hex"; | "hex";
type BufferEncodingOption = "buffer" | { encoding: "buffer" }; type BufferEncodingOption = "buffer" | { encoding: "buffer" };
type BuildInfo = KnownBuildInfo & Record<string, any>; type BuildInfo = KnownBuildInfo & Record<string, any>;
@ -3953,10 +3952,10 @@ type EncodingOption =
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| "base64"
| "base64url"
| "hex" | "hex"
| ObjectEncodingOptions; | ObjectEncodingOptions;
type Entry = type Entry =
@ -5541,7 +5540,7 @@ declare interface HashedModuleIdsPluginOptions {
/** /**
* The encoding to use when generating the hash, defaults to 'base64'. All encodings from Node.JS' hash.digest are supported. * The encoding to use when generating the hash, defaults to 'base64'. All encodings from Node.JS' hash.digest are supported.
*/ */
hashDigest?: "base64" | "latin1" | "hex"; hashDigest?: "latin1" | "base64" | "hex";
/** /**
* The prefix length of the hash digest to use, defaults to 4. * The prefix length of the hash digest to use, defaults to 4.
@ -5890,15 +5889,15 @@ declare interface IntermediateFileSystemExtras {
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| "base64"
| "base64url"
| "hex" | "hex"
| WriteStreamOptions | WriteStreamOptions
) => NodeJS.WritableStream; ) => NodeJS.WritableStream;
open: Open; open: Open;
read: Read<ArrayBufferView<ArrayBufferLike>>; read: Read<ArrayBufferView>;
close: ( close: (
df: number, df: number,
callback: (err: null | NodeJS.ErrnoException) => void callback: (err: null | NodeJS.ErrnoException) => void
@ -10144,10 +10143,10 @@ declare interface ObjectEncodingOptions {
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| "base64"
| "base64url"
| "hex"; | "hex";
} }
declare interface ObjectForExtract { declare interface ObjectForExtract {
@ -11368,13 +11367,9 @@ declare interface PathData {
url?: string; url?: string;
} }
type PathLikeFs = string | Buffer | URL; type PathLikeFs = string | Buffer | URL;
type PathLikeTypes = string | URL_url | Buffer<ArrayBufferLike>; type PathLikeTypes = string | Buffer | URL_url;
type PathOrFileDescriptorFs = string | number | Buffer | URL; type PathOrFileDescriptorFs = string | number | Buffer | URL;
type PathOrFileDescriptorTypes = type PathOrFileDescriptorTypes = string | number | Buffer | URL_url;
| string
| number
| Buffer<ArrayBufferLike>
| URL_url;
type Pattern = type Pattern =
| Identifier | Identifier
| MemberExpression | MemberExpression
@ -11725,10 +11720,7 @@ declare interface RawSourceMap {
mappings: string; mappings: string;
file: string; file: string;
} }
declare interface Read< declare interface Read<TBuffer extends ArrayBufferView = ArrayBufferView> {
TBuffer extends
ArrayBufferView<ArrayBufferLike> = ArrayBufferView<ArrayBufferLike>
> {
( (
fd: number, fd: number,
buffer: TBuffer, buffer: TBuffer,
@ -11755,13 +11747,11 @@ declare interface Read<
callback: ( callback: (
err: null | NodeJS.ErrnoException, err: null | NodeJS.ErrnoException,
bytesRead: number, bytesRead: number,
buffer: ArrayBufferView<ArrayBufferLike> buffer: ArrayBufferView
) => void ) => void
): void; ): void;
} }
declare interface ReadAsyncOptions< declare interface ReadAsyncOptions<TBuffer extends ArrayBufferView> {
TBuffer extends ArrayBufferView<ArrayBufferLike>
> {
offset?: number; offset?: number;
length?: number; length?: number;
position?: null | number | bigint; position?: null | number | bigint;
@ -11813,7 +11803,6 @@ declare interface ReadFileFs {
( (
path: PathOrFileDescriptorFs, path: PathOrFileDescriptorFs,
options: options:
| ({ encoding: BufferEncoding; flag?: string } & Abortable)
| "ascii" | "ascii"
| "utf8" | "utf8"
| "utf-8" | "utf-8"
@ -11821,10 +11810,11 @@ declare interface ReadFileFs {
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| ({ encoding: BufferEncoding; flag?: string } & Abortable)
| "base64"
| "base64url"
| "hex", | "hex",
callback: (err: null | NodeJS.ErrnoException, result?: string) => void callback: (err: null | NodeJS.ErrnoException, result?: string) => void
): void; ): void;
@ -11840,10 +11830,10 @@ declare interface ReadFileFs {
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| "base64"
| "base64url"
| "hex" | "hex"
| (ObjectEncodingOptions & { flag?: string } & Abortable), | (ObjectEncodingOptions & { flag?: string } & Abortable),
callback: ( callback: (
@ -11871,10 +11861,10 @@ declare interface ReadFileSync {
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| "base64"
| "base64url"
| "hex" | "hex"
| { encoding: BufferEncoding; flag?: string } | { encoding: BufferEncoding; flag?: string }
): string; ): string;
@ -11889,10 +11879,10 @@ declare interface ReadFileSync {
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| "base64"
| "base64url"
| "hex" | "hex"
| (ObjectEncodingOptions & { flag?: string }) | (ObjectEncodingOptions & { flag?: string })
): string | Buffer; ): string | Buffer;
@ -11916,10 +11906,10 @@ declare interface ReadFileTypes {
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| "base64"
| "base64url"
| "hex" | "hex"
| ({ encoding: BufferEncoding; flag?: string } & Abortable), | ({ encoding: BufferEncoding; flag?: string } & Abortable),
callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void
@ -11936,10 +11926,10 @@ declare interface ReadFileTypes {
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| "base64"
| "base64url"
| "hex" | "hex"
| (ObjectEncodingOptions & { flag?: string } & Abortable), | (ObjectEncodingOptions & { flag?: string } & Abortable),
callback: ( callback: (
@ -11965,10 +11955,10 @@ declare interface ReaddirFs {
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| "base64"
| "base64url"
| "hex" | "hex"
| { | {
encoding: encoding:
@ -11980,10 +11970,10 @@ declare interface ReaddirFs {
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| "base64"
| "base64url"
| "hex"; | "hex";
withFileTypes?: false; withFileTypes?: false;
recursive?: boolean; recursive?: boolean;
@ -12013,10 +12003,10 @@ declare interface ReaddirFs {
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| "base64"
| "base64url"
| "hex" | "hex"
| (ObjectEncodingOptions & { | (ObjectEncodingOptions & {
withFileTypes?: false; withFileTypes?: false;
@ -12048,10 +12038,10 @@ declare interface ReaddirSync {
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| "base64"
| "base64url"
| "hex" | "hex"
| { | {
encoding: encoding:
@ -12063,10 +12053,10 @@ declare interface ReaddirSync {
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| "base64"
| "base64url"
| "hex"; | "hex";
withFileTypes?: false; withFileTypes?: false;
recursive?: boolean; recursive?: boolean;
@ -12089,10 +12079,10 @@ declare interface ReaddirSync {
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| "base64"
| "base64url"
| "hex" | "hex"
| (ObjectEncodingOptions & { withFileTypes?: false; recursive?: boolean }) | (ObjectEncodingOptions & { withFileTypes?: false; recursive?: boolean })
): string[] | Buffer[]; ): string[] | Buffer[];
@ -12117,10 +12107,10 @@ declare interface ReaddirTypes {
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| "base64"
| "base64url"
| "hex" | "hex"
| { | {
encoding: encoding:
@ -12132,10 +12122,10 @@ declare interface ReaddirTypes {
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| "base64"
| "base64url"
| "hex"; | "hex";
withFileTypes?: false; withFileTypes?: false;
recursive?: boolean; recursive?: boolean;
@ -12165,10 +12155,10 @@ declare interface ReaddirTypes {
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| "base64"
| "base64url"
| "hex" | "hex"
| (ObjectEncodingOptions & { | (ObjectEncodingOptions & {
withFileTypes?: false; withFileTypes?: false;
@ -15601,7 +15591,6 @@ declare class WebpackError extends Error {
* Creates an instance of WebpackError. * Creates an instance of WebpackError.
*/ */
constructor(message?: string); constructor(message?: string);
[index: number]: () => string;
details?: string; details?: string;
module?: null | Module; module?: null | Module;
loc?: SyntheticDependencyLocation | RealDependencyLocation; loc?: SyntheticDependencyLocation | RealDependencyLocation;
@ -15899,18 +15888,18 @@ declare interface WriteFile {
file: PathOrFileDescriptorFs, file: PathOrFileDescriptorFs,
data: data:
| string | string
| Uint8Array<ArrayBufferLike> | Uint8Array
| Uint8ClampedArray<ArrayBufferLike> | Uint8ClampedArray
| Uint16Array<ArrayBufferLike> | Uint16Array
| Uint32Array<ArrayBufferLike> | Uint32Array
| Int8Array<ArrayBufferLike> | Int8Array
| Int16Array<ArrayBufferLike> | Int16Array
| Int32Array<ArrayBufferLike> | Int32Array
| BigUint64Array<ArrayBufferLike> | BigUint64Array
| BigInt64Array<ArrayBufferLike> | BigInt64Array
| Float32Array<ArrayBufferLike> | Float32Array
| Float64Array<ArrayBufferLike> | Float64Array
| DataView<ArrayBufferLike>, | DataView,
options: WriteFileOptions, options: WriteFileOptions,
callback: (err: null | NodeJS.ErrnoException) => void callback: (err: null | NodeJS.ErrnoException) => void
): void; ): void;
@ -15918,18 +15907,18 @@ declare interface WriteFile {
file: PathOrFileDescriptorFs, file: PathOrFileDescriptorFs,
data: data:
| string | string
| Uint8Array<ArrayBufferLike> | Uint8Array
| Uint8ClampedArray<ArrayBufferLike> | Uint8ClampedArray
| Uint16Array<ArrayBufferLike> | Uint16Array
| Uint32Array<ArrayBufferLike> | Uint32Array
| Int8Array<ArrayBufferLike> | Int8Array
| Int16Array<ArrayBufferLike> | Int16Array
| Int32Array<ArrayBufferLike> | Int32Array
| BigUint64Array<ArrayBufferLike> | BigUint64Array
| BigInt64Array<ArrayBufferLike> | BigInt64Array
| Float32Array<ArrayBufferLike> | Float32Array
| Float64Array<ArrayBufferLike> | Float64Array
| DataView<ArrayBufferLike>, | DataView,
callback: (err: null | NodeJS.ErrnoException) => void callback: (err: null | NodeJS.ErrnoException) => void
): void; ): void;
} }
@ -15942,10 +15931,10 @@ type WriteFileOptions =
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| "base64"
| "base64url"
| "hex" | "hex"
| (ObjectEncodingOptions & | (ObjectEncodingOptions &
Abortable & { mode?: string | number; flag?: string; flush?: boolean }); Abortable & { mode?: string | number; flag?: string; flush?: boolean });
@ -15963,10 +15952,10 @@ declare interface WriteStreamOptions {
| "utf-16le" | "utf-16le"
| "ucs2" | "ucs2"
| "ucs-2" | "ucs-2"
| "base64"
| "base64url"
| "latin1" | "latin1"
| "binary" | "binary"
| "base64"
| "base64url"
| "hex"; | "hex";
fd?: any; fd?: any;
mode?: number; mode?: number;

View File

@ -6107,11 +6107,6 @@ uglify-js@^3.1.4:
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.19.3.tgz#82315e9bbc6f2b25888858acd1fff8441035b77f" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.19.3.tgz#82315e9bbc6f2b25888858acd1fff8441035b77f"
integrity sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ== integrity sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==
undici-types@~6.19.2:
version "6.19.8"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02"
integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==
undici-types@~6.20.0: undici-types@~6.20.0:
version "6.20.0" version "6.20.0"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.20.0.tgz#8171bf22c1f588d1554d55bf204bc624af388433" resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.20.0.tgz#8171bf22c1f588d1554d55bf204bc624af388433"