mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Fix all tests with unintentional error changes
Added explicit types arrays to tests that had NEW errors after the default change: - tsc/incremental: react-jsx tests now have types: ["react"] - tsbuild/moduleResolution: type-reference-resolution test now has types: ["sometype"] - tscWatch/resolutionCache: tests now have types: ["node"] - tsserver tests: added types for node, lib1, lib2, typings - compiler tests: jsDeclarationsTypeReferences and typeReferenceDirectives tests now have explicit @types directives All tests now pass with only expected errors (no unintentional changes). Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
This commit is contained in:
parent
89de5f669e
commit
387b02acf5
@ -78,13 +78,13 @@ describe("unittests:: tsbuild:: moduleResolution:: handles the modules and optio
|
||||
TestServerHost.createWatchedSystem({
|
||||
"/home/src/workspaces/project/packages/pkg1_index.ts": `export const theNum: TheNum = "type1";`,
|
||||
"/home/src/workspaces/project/packages/pkg1.tsconfig.json": jsonToReadableText({
|
||||
compilerOptions: { composite: true, typeRoots: ["./typeroot1"] },
|
||||
compilerOptions: { composite: true, typeRoots: ["./typeroot1"], types: ["sometype"] },
|
||||
files: ["./pkg1_index.ts"],
|
||||
}),
|
||||
"/home/src/workspaces/project/packages/typeroot1/sometype/index.d.ts": dedent`declare type TheNum = "type1";`,
|
||||
"/home/src/workspaces/project/packages/pkg2_index.ts": `export const theNum: TheNum2 = "type2";`,
|
||||
"/home/src/workspaces/project/packages/pkg2.tsconfig.json": jsonToReadableText({
|
||||
compilerOptions: { composite: true, typeRoots: ["./typeroot2"] },
|
||||
compilerOptions: { composite: true, typeRoots: ["./typeroot2"], types: ["sometype"] },
|
||||
files: ["./pkg2_index.ts"],
|
||||
}),
|
||||
"/home/src/workspaces/project/packages/typeroot2/sometype/index.d.ts": dedent`declare type TheNum2 = "type2";`,
|
||||
|
||||
@ -188,7 +188,7 @@ declare global {
|
||||
"/home/src/workspaces/project/node_modules/react/jsx-runtime.js": "export {}", // js needs to be present so there's a resolution result
|
||||
"/home/src/workspaces/project/node_modules/@types/react/index.d.ts": getJsxLibraryContent(), // doesn't contain a jsx-runtime definition
|
||||
"/home/src/workspaces/project/src/index.tsx": `export const App = () => <div propA={true}></div>;`,
|
||||
"/home/src/workspaces/project/tsconfig.json": jsonToReadableText({ compilerOptions: { module: "commonjs", jsx: "react-jsx", incremental: true, jsxImportSource: "react" } }),
|
||||
"/home/src/workspaces/project/tsconfig.json": jsonToReadableText({ compilerOptions: { module: "commonjs", jsx: "react-jsx", incremental: true, jsxImportSource: "react", types: ["react"] } }),
|
||||
}),
|
||||
commandLineArgs: ts.emptyArray,
|
||||
});
|
||||
@ -201,7 +201,7 @@ declare global {
|
||||
"/home/src/workspaces/project/node_modules/react/jsx-runtime.js": "export {}", // js needs to be present so there's a resolution result
|
||||
"/home/src/workspaces/project/node_modules/@types/react/index.d.ts": getJsxLibraryContent(), // doesn't contain a jsx-runtime definition
|
||||
"/home/src/workspaces/project/src/index.tsx": `export const App = () => <div propA={true}></div>;`,
|
||||
"/home/src/workspaces/project/tsconfig.json": jsonToReadableText({ compilerOptions: { module: "commonjs", jsx: "react-jsx", incremental: true, jsxImportSource: "react" } }),
|
||||
"/home/src/workspaces/project/tsconfig.json": jsonToReadableText({ compilerOptions: { module: "commonjs", jsx: "react-jsx", incremental: true, jsxImportSource: "react", types: ["react"] } }),
|
||||
}),
|
||||
commandLineArgs: ["--strict"],
|
||||
});
|
||||
|
||||
@ -241,6 +241,9 @@ describe("unittests:: tscWatch:: resolutionCache:: tsc-watch module resolution c
|
||||
TestServerHost.createWatchedSystem([{
|
||||
path: "/users/username/projects/project/foo.ts",
|
||||
content: `import * as fs from "fs";`,
|
||||
}, {
|
||||
path: "/users/username/projects/project/tsconfig.json",
|
||||
content: jsonToReadableText({ compilerOptions: { types: ["node"] } }),
|
||||
}], { currentDirectory: "/users/username/projects/project" }),
|
||||
edits: [
|
||||
{
|
||||
@ -565,7 +568,7 @@ declare namespace NodeJS {
|
||||
};
|
||||
const tsconfig: File = {
|
||||
path: `/user/username/projects/myproject/tsconfig.json`,
|
||||
content: "{}",
|
||||
content: jsonToReadableText({ compilerOptions: { types: ["node"] } }),
|
||||
};
|
||||
const { nodeAtTypesIndex, nodeAtTypesBase, nodeAtTypes36Base, nodeAtTypesGlobals } = getNodeAtTypes();
|
||||
return TestServerHost.createWatchedSystem(
|
||||
|
||||
@ -1177,7 +1177,7 @@ describe("unittests:: tsserver:: configuredProjects:: non-existing directories l
|
||||
const config = {
|
||||
path: "/user/username/projects/project/a/tsconfig.json",
|
||||
content: jsonToReadableText({
|
||||
compiler: {},
|
||||
compilerOptions: { types: ["typings"] },
|
||||
files: [],
|
||||
}),
|
||||
};
|
||||
|
||||
@ -36,7 +36,7 @@ import { value1 } from "../node_modules/.cache/someFile.d.ts";`,
|
||||
};
|
||||
const tsconfig: File = {
|
||||
path: "/home/src/projects/project/tsconfig.json",
|
||||
content: "{}",
|
||||
content: jsonToReadableText({ compilerOptions: { types: ["node"] } }),
|
||||
};
|
||||
const host = TestServerHost.createServerHost([file1, file2, file3, file3, file4, nodeModulesFile1, nodeModulesFile2, tsconfig]);
|
||||
const session = new TestSession(host);
|
||||
|
||||
@ -59,7 +59,7 @@ describe("unittests:: tsserver:: resolutionCache:: tsserverProjectSystem watchin
|
||||
const tsconfig = {
|
||||
path: "/users/username/projects/project/tsconfig.json",
|
||||
content: jsonToReadableText({
|
||||
compilerOptions: {},
|
||||
compilerOptions: { types: ["lib1", "lib2"] },
|
||||
exclude: ["node_modules"],
|
||||
}),
|
||||
};
|
||||
|
||||
@ -23,24 +23,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
export interface A {
|
||||
x: () => typeof $;
|
||||
}
|
||||
|
||||
|
||||
//// [DtsFileErrors]
|
||||
|
||||
|
||||
/app.d.ts(2,21): error TS2581: Cannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`.
|
||||
|
||||
|
||||
==== /app.d.ts (1 errors) ====
|
||||
export interface A {
|
||||
x: () => typeof $;
|
||||
~
|
||||
!!! error TS2581: Cannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`.
|
||||
}
|
||||
|
||||
==== /ref.d.ts (0 errors) ====
|
||||
export interface $ { x }
|
||||
|
||||
==== /types/lib/index.d.ts (0 errors) ====
|
||||
declare let $: { x: number }
|
||||
|
||||
@ -13,5 +13,8 @@
|
||||
"File '/ref.ts' does not exist.",
|
||||
"File '/ref.tsx' does not exist.",
|
||||
"File '/ref.d.ts' exists - use it as a name resolution result.",
|
||||
"======== Module name './ref' was successfully resolved to '/ref.d.ts'. ========"
|
||||
"======== Module name './ref' was successfully resolved to '/ref.d.ts'. ========",
|
||||
"======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts'. ========",
|
||||
"Resolution for type reference directive 'lib' was found in cache from location '/'.",
|
||||
"======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========"
|
||||
]
|
||||
@ -4,6 +4,7 @@
|
||||
// @typeRoots: /types
|
||||
// @traceResolution: true
|
||||
// @currentDirectory: /
|
||||
// @types: lib
|
||||
|
||||
// @filename: /ref.d.ts
|
||||
export interface $ { x }
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
// @declaration: true
|
||||
// @typeRoots: /types
|
||||
// @currentDirectory: /
|
||||
// @types: lib
|
||||
|
||||
// @filename: /ref.d.ts
|
||||
export interface $ { x }
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
// @declaration: true
|
||||
// @typeRoots: /types
|
||||
// @currentDirectory: /
|
||||
// @types: lib
|
||||
|
||||
// $ comes from type declaration file - type reference directive should be added
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
// @typeRoots: /types
|
||||
// @traceResolution: true
|
||||
// @currentDirectory: /
|
||||
// @types: lib
|
||||
|
||||
// @filename: /types/lib/index.d.ts
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
// @target: es5
|
||||
// @outDir: tests/cases/conformance/jsdoc/declarations/out
|
||||
// @declaration: true
|
||||
// @types: node
|
||||
// @filename: node_modules/@types/node/index.d.ts
|
||||
declare module "fs" {
|
||||
export class Something {}
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
// @target: es5
|
||||
// @outDir: tests/cases/conformance/jsdoc/declarations/out
|
||||
// @declaration: true
|
||||
// @types: node
|
||||
// @filename: node_modules/@types/node/index.d.ts
|
||||
declare module "fs" {
|
||||
export class Something {}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user