overrides: [
// tests, no restrictions (runs in Node / jest with jsdom)
{
- files: ['**/__tests__/**', 'test-dts/**'],
+ files: ['**/__tests__/**', 'packages/dts-test/**'],
rules: {
'no-restricted-globals': 'off',
'no-restricted-syntax': 'off',
"test-unit": "vitest -c vitest.unit.config.ts",
"test-e2e": "node scripts/build.mjs vue -f global -d && vitest -c vitest.e2e.config.ts",
"test-dts": "run-s build-dts test-dts-only",
- "test-dts-only": "tsc -p ./test-dts/tsconfig.build.json",
+ "test-dts-only": "tsc -p ./packages/dts-test/tsconfig.test.json",
"test-coverage": "vitest -c vitest.unit.config.ts --coverage",
"release": "node scripts/release.mjs",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"preinstall": "node ./scripts/preinstall.mjs",
"postinstall": "simple-git-hooks"
},
- "types": "test-dts/index.d.ts",
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged && pnpm check",
"commit-msg": "node scripts/verifyCommit.mjs"
"@typescript-eslint/parser": "^5.23.0",
"@vitest/coverage-istanbul": "^0.28.2",
"@vue/consolidate": "0.17.3",
- "@vue/reactivity": "workspace:*",
- "@vue/runtime-core": "workspace:*",
- "@vue/runtime-dom": "workspace:*",
"brotli": "^1.3.2",
"chalk": "^4.1.0",
"conventional-changelog-cli": "^2.0.31",
"tslib": "^2.4.0",
"typescript": "^4.9.0",
"vite": "^4.0.4",
- "vitest": "^0.28.2",
- "vue": "workspace:*"
+ "vitest": "^0.28.2"
}
}
--- /dev/null
+# dts-test
+
+Tests Typescript types to ensure the types remain as expected.
+
+- This directory is included in the root `tsconfig.json`, where package imports are aliased to `src` directories, so in IDEs and the `pnpm check` script the types are validated against source code.
+
+- When runnong `tsc` with `packages/dts-test/tsconfig.test.json`, packages are resolved using using normal `node` resolution, so the types are validated against actual **built** types. This requires the types to be built first via `pnpm build-types`.
// This directory contains a number of d.ts assertions
// use \@ts-expect-error where errors are expected.
-export * from '@vue/runtime-dom'
+export * from 'vue'
export function describe(_name: string, _fn: () => void): void
export function test(_name: string, _fn: () => any): void
--- /dev/null
+{
+ "name": "dts-test",
+ "private": true,
+ "dependencies": {
+ "vue": "workspace:*",
+ "@vue/runtime-core": "workspace:*",
+ "@vue/runtime-dom": "workspace:*",
+ "@vue/reactivity": "workspace:*"
+ }
+}
-import { WritableComputedRef } from '@vue/reactivity'
-import { expectType, ref, computed, Ref, ComputedRef } from './index'
+import {
+ expectType,
+ ref,
+ computed,
+ Ref,
+ ComputedRef,
+ WritableComputedRef
+} from './index'
import 'vue/macros-global'
import { RefType, RefTypes } from 'vue/macros'
-import { ComponentPropsOptions } from '@vue/runtime-core'
import { isArray, isPromise, isFunction } from '@vue/shared'
import {
getCurrentInstance,
unsetCurrentInstance
} from './component'
import { EmitFn, EmitsOptions } from './componentEmits'
-import { ComponentObjectPropsOptions, ExtractPropTypes } from './componentProps'
+import {
+ ComponentPropsOptions,
+ ComponentObjectPropsOptions,
+ ExtractPropTypes
+} from './componentProps'
import { warn } from './warning'
// dev only
'@typescript-eslint/parser': ^5.23.0
'@vitest/coverage-istanbul': ^0.28.2
'@vue/consolidate': 0.17.3
- '@vue/reactivity': workspace:*
- '@vue/runtime-core': workspace:*
- '@vue/runtime-dom': workspace:*
brotli: ^1.3.2
chalk: ^4.1.0
conventional-changelog-cli: ^2.0.31
typescript: ^4.9.0
vite: ^4.0.4
vitest: ^0.28.2
- vue: workspace:*
devDependencies:
'@babel/parser': 7.20.15
'@babel/types': 7.20.7
'@typescript-eslint/parser': 5.50.0_jofidmxrjzhj7l6vknpw5ecvfe
'@vitest/coverage-istanbul': 0.28.3_jsdom@21.1.0+terser@5.16.2
'@vue/consolidate': 0.17.3
- '@vue/reactivity': link:packages/reactivity
- '@vue/runtime-core': link:packages/runtime-core
- '@vue/runtime-dom': link:packages/runtime-dom
brotli: 1.3.3
chalk: 4.1.2
conventional-changelog-cli: 2.2.2
typescript: 4.9.5
vite: 4.1.1_ghge5pqdvzsmxto52quo4r2say
vitest: 0.28.3_jsdom@21.1.0+terser@5.16.2
- vue: link:packages/vue
packages/compiler-core:
specifiers:
'@vue/compiler-dom': link:../compiler-dom
'@vue/shared': link:../shared
+ packages/dts-test:
+ specifiers:
+ '@vue/reactivity': workspace:*
+ '@vue/runtime-core': workspace:*
+ '@vue/runtime-dom': workspace:*
+ vue: workspace:*
+ dependencies:
+ '@vue/reactivity': link:../reactivity
+ '@vue/runtime-core': link:../runtime-core
+ '@vue/runtime-dom': link:../runtime-dom
+ vue: link:../vue
+
packages/reactivity:
specifiers:
'@vue/shared': 3.2.47
const nonSrcPackages = [
'sfc-playground',
'size-check',
- 'template-explorer'
+ 'template-explorer',
+ 'dts-test'
]
for (const dir of dirs) {
+++ /dev/null
-# Test-ts
-
-Tests Typescript types to ensure the types remain as expected.
-
-## Configuration
-
-### tsconfig.json
-
-Config used to test against the package source
-
-### tsconfig.build.json
-
-Replaces the `vue` and `@vue/*` dependencies with the built Typescript to ensure the published types are correct.
+++ /dev/null
-{
- "extends": "../tsconfig.json",
- "compilerOptions": {
- "noEmit": true,
- "declaration": true
- },
- "exclude": ["../packages/*/__tests__", "../packages/template-explorer"]
-}
"packages/template-explorer",
"packages/sfc-playground",
"packages/size-check",
- "test-dts"
+ "packages/dts-test"
]
}
"packages/*/src",
"packages/runtime-dom/types/jsx.d.ts",
"packages/*/__tests__",
- "test-dts"
+ "packages/dts-test"
]
}