From ed964d1f1773905b64f99a68d4b8e54b4a326fe9 Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Tue, 12 Mar 2024 10:15:37 +0800 Subject: [PATCH] fix for TS 5.4 (fix #35) --- CHANGELOG.md | 2 ++ package.json | 4 ++-- parser.d.ts | 8 ++++++-- pnpm-lock.yaml | 16 ++++++++-------- shim.d.ts | 2 +- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f53328..a5f5d78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Fixed for TypeScript 5.4. (Fix [#35](https://github.com/g-plane/typed-query-selector/issues/35)) + ## v2.11.0 - Added `.js` extension in import statements. diff --git a/package.json b/package.json index 74adcd5..f8fc99b 100644 --- a/package.json +++ b/package.json @@ -16,9 +16,9 @@ "fmt": "prettier --write *.ts" }, "devDependencies": { - "@gplane/tsconfig": "^6.0.0", + "@gplane/tsconfig": "^6.1.0", "@type-challenges/utils": "^0.1.1", "prettier": "^3.0.3", - "typescript": "^5.1.3" + "typescript": "^5.4.2" } } diff --git a/parser.d.ts b/parser.d.ts index 4aa7fed..674a8a7 100644 --- a/parser.d.ts +++ b/parser.d.ts @@ -72,9 +72,13 @@ type PreprocessUnchecked = I extends `${infer L}\\${Quotes}${infer R}` // rem /** Parse `:is()` and `:where()` */ type ExpandFunctions = I extends `${infer L}:is(${infer Args})${infer R}` - ? ExpandFunctions<`${L}&${Split>}${R}`> + ? Split> extends string + ? ExpandFunctions<`${L}&${Split>}${R}`> + : unknown : I extends `${infer L}:where(${infer Args})${infer R}` - ? ExpandFunctions<`${L}&${Split>}${R}`> + ? Split> extends string + ? ExpandFunctions<`${L}&${Split>}${R}`> + : unknown : I extends `${infer L}:${infer Pseudo}(${string})${infer R}` ? IsIdentifier extends true ? ExpandFunctions<`${L}${R}`> diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 45fdc2f..0d459ad 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,8 +6,8 @@ settings: devDependencies: '@gplane/tsconfig': - specifier: ^6.0.0 - version: 6.0.0 + specifier: ^6.1.0 + version: 6.1.0 '@type-challenges/utils': specifier: ^0.1.1 version: 0.1.1 @@ -15,13 +15,13 @@ devDependencies: specifier: ^3.0.3 version: 3.0.3 typescript: - specifier: ^5.1.3 - version: 5.1.3 + specifier: ^5.4.2 + version: 5.4.2 packages: - /@gplane/tsconfig@6.0.0: - resolution: {integrity: sha512-K61z8tl3I5tR66MJoGoBCY1y950fybDfPol7uzcg/YPilretE0bl41GOOX0BpRbblYLOWzSJvdqlimzjAfryog==} + /@gplane/tsconfig@6.1.0: + resolution: {integrity: sha512-+WNtFH0x1Jjtp5m90dY5/u9wje5GAwjoEHJd60lQUzq9h1vfZ2ILeo9iQjFW9sB06g7mBXDf99iCvY0/t0pAUQ==} dev: true /@type-challenges/utils@0.1.1: @@ -34,8 +34,8 @@ packages: hasBin: true dev: true - /typescript@5.1.3: - resolution: {integrity: sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==} + /typescript@5.4.2: + resolution: {integrity: sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==} engines: {node: '>=14.17'} hasBin: true dev: true diff --git a/shim.d.ts b/shim.d.ts index e48ab3b..cbacd91 100644 --- a/shim.d.ts +++ b/shim.d.ts @@ -6,7 +6,7 @@ declare global { querySelectorAll( selector: S, - ): NodeListOf> + ): NodeListOf extends Node ? ParseSelector : Node> } interface Element {