diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml new file mode 100644 index 000000000..774603d68 --- /dev/null +++ b/.github/workflows/typecheck.yml @@ -0,0 +1,33 @@ +name: Typecheck +on: + push: + branches: + - main + - canary + pull_request: +permissions: + contents: read + pull-requests: read +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + typecheck: + timeout-minutes: 20 + runs-on: depot-ubuntu-22.04-2 + container: + image: node:24-slim + steps: + - name: Checkout Repo + uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 + with: + fetch-depth: 1 + - name: pnpm setup + uses: pnpm/action-setup@738f428026a1f5a72398de22aeed83d859c4a660 + - name: Install packages + run: pnpm install --frozen-lockfile --prefer-offline + - name: Run Typecheck + run: pnpm typecheck + env: + TURBO_TOKEN: ${{ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && secrets.TURBO_TOKEN || '' }} + TURBO_TEAM: ${{ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && secrets.TURBO_TEAM || '' }} diff --git a/apps/web/components/ensure-matching-variants.spec.tsx b/apps/web/components/ensure-matching-variants.spec.tsx index a3b96197f..a783f5bfb 100644 --- a/apps/web/components/ensure-matching-variants.spec.tsx +++ b/apps/web/components/ensure-matching-variants.spec.tsx @@ -1,7 +1,6 @@ import { existsSync } from 'node:fs'; import path from 'node:path'; import { parse, stringify } from 'html-to-ast'; -import type { Attr, IDoc as Doc } from 'html-to-ast/dist/types'; import postcss from 'postcss'; import { pretty, render } from 'react-email'; import { getComponentElement } from '../src/app/components/get-imported-components-for'; @@ -9,6 +8,8 @@ import { Layout } from './_components/layout'; import { componentsStructure, getComponentPathFromSlug } from './structure'; type MaybeDoc = ReturnType[number]; +type Doc = Parameters[0][number]; +type Attr = NonNullable; const walkAst = (ast: T[], callback: (doc: T) => void) => { for (const doc of ast) { diff --git a/package.json b/package.json index e8fd9367c..7e92a0c5c 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "release": "turbo run build --filter=./packages/* && pnpm changeset publish", "test": "turbo run test", "test:watch": "turbo run test:watch", + "typecheck": "turbo run typecheck", "version": "changeset version && pnpm install --no-frozen-lockfile && pnpm lint:fix" }, "devDependencies": { diff --git a/packages/editor/src/extensions/columns.spec.tsx b/packages/editor/src/extensions/columns.spec.tsx index e0bcb4b2b..653aecc62 100644 --- a/packages/editor/src/extensions/columns.spec.tsx +++ b/packages/editor/src/extensions/columns.spec.tsx @@ -195,11 +195,14 @@ describe('Column Variants', () => { }); it('reflects column spacing in editor HTML without inventing a default gap', () => { - const renderHTML = TwoColumns.config.renderHTML; + type RenderHTMLFn = NonNullable; + const renderHTML = TwoColumns.config.renderHTML as + | OmitThisParameter + | undefined; const defaultHtml = renderHTML?.({ HTMLAttributes: {}, - } as Parameters>[0]) as [ + } as unknown as Parameters[0]) as [ string, Record, number, @@ -208,7 +211,7 @@ describe('Column Variants', () => { const spacedHtml = renderHTML?.({ HTMLAttributes: { cellspacing: '12', style: 'padding: 10px;' }, - } as Parameters>[0]) as [ + } as unknown as Parameters[0]) as [ string, Record, number, @@ -259,7 +262,7 @@ describe('Column Deletion', () => { } function findColDepth( - $from: ReturnType, + $from: typeof Editor.prototype.state.selection.$from, ): number | undefined { for (let d = $from.depth; d >= 0; d--) { if ($from.node(d).type.name === 'columnsColumn') return d; diff --git a/packages/react-email/tsconfig.json b/packages/react-email/tsconfig.json index f6039b90c..e13f016fe 100644 --- a/packages/react-email/tsconfig.json +++ b/packages/react-email/tsconfig.json @@ -35,5 +35,10 @@ "outDir": "dist" }, "include": ["src/**/*.ts", "src/**/*.tsx"], - "exclude": ["dist", "node_modules"] + "exclude": [ + "dist", + "node_modules", + "src/cli/utils/preview/hot-reloading/test", + "src/components/tailwind/e2e" + ] } diff --git a/turbo.json b/turbo.json index c07e7d5cc..1d6085e7e 100644 --- a/turbo.json +++ b/turbo.json @@ -50,6 +50,9 @@ "outputs": ["dist/**"] }, "lint": {}, + "typecheck": { + "dependsOn": ["^build"] + }, "//#format": {}, "//#format:check": {}, "test:e2e": {