diff --git a/.github/workflows/test-old-typescript.yml b/.github/workflows/test-old-typescript.yml index 8cbf93dfe8..c1f86454fd 100644 --- a/.github/workflows/test-old-typescript.yml +++ b/.github/workflows/test-old-typescript.yml @@ -37,6 +37,10 @@ jobs: cache-dependency-path: '**/pnpm-lock.yaml' - run: pnpm install --frozen-lockfile - run: pnpm build + - name: Patch for v4/v3 TS + if: ${{ startsWith(matrix.typescript, '4.') || startsWith(matrix.typescript, '3.') }} + run: | + sed -i~ 's/"verbatimModuleSyntax": true,//' tsconfig.json - name: Patch for Old TS run: | sed -i~ 's/\/\/ @ts-expect-error.*\[LATEST-TS-ONLY\]//' tests/*.tsx diff --git a/tests/basic.test.tsx b/tests/basic.test.tsx index efc386eb5f..0c34d4bcfa 100644 --- a/tests/basic.test.tsx +++ b/tests/basic.test.tsx @@ -1,11 +1,11 @@ import { Component as ClassComponent, - ReactNode, StrictMode, useEffect, useLayoutEffect, useState, } from 'react' +import type { ReactNode } from 'react' import { act, fireEvent, render } from '@testing-library/react' import ReactDOM from 'react-dom' import { afterEach, expect, it, vi } from 'vitest' diff --git a/tests/context.test.tsx b/tests/context.test.tsx index 5944f11773..7a07e0e92e 100644 --- a/tests/context.test.tsx +++ b/tests/context.test.tsx @@ -1,11 +1,11 @@ import { Component as ClassComponent, - ReactNode, StrictMode, useCallback, useEffect, useState, } from 'react' +import type { ReactNode } from 'react' import { render } from '@testing-library/react' import { afterEach, it, vi } from 'vitest' import { create } from 'zustand' diff --git a/tests/devtools.test.tsx b/tests/devtools.test.tsx index 3180b52daf..84ca2b2d52 100644 --- a/tests/devtools.test.tsx +++ b/tests/devtools.test.tsx @@ -1,6 +1,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { devtools, redux } from 'zustand/middleware' -import { StoreApi, createStore } from 'zustand/vanilla' +import { createStore } from 'zustand/vanilla' +import type { StoreApi } from 'zustand/vanilla' type TupleOfEqualLengthH< Arr extends unknown[], diff --git a/tsconfig.json b/tsconfig.json index 4e6de5f402..79af697f28 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,6 +10,7 @@ "allowImportingTsExtensions": true, "noUncheckedIndexedAccess": true, "exactOptionalPropertyTypes": true, + "verbatimModuleSyntax": true, "noEmit": true, "baseUrl": ".", "paths": {