Merge branch 'copilot/change-default-types-to-empty' of https://github.com/microsoft/TypeScript into copilot/change-default-types-to-empty

This commit is contained in:
Ryan Cavanaugh 2026-01-22 10:18:56 -08:00
commit e641e7eb1c
9 changed files with 35 additions and 12 deletions

View File

@ -1,17 +1,14 @@
/a.ts(1,23): error TS2688: Cannot find type definition file for 'JqUeRy'.
/a.ts(2,1): error TS2581: Cannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`.
==== /tsconfig.json (0 errors) ====
{ "files": "a.ts" }
{ "files": "a.ts", "compilerOptions": { "types": ["jquery"] } }
==== /a.ts (2 errors) ====
==== /a.ts (1 errors) ====
/// <reference types="JqUeRy" />
~~~~~~
!!! error TS2688: Cannot find type definition file for 'JqUeRy'.
$.x;
~
!!! error TS2581: Cannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`.
==== /node_modules/@types/jquery/index.d.ts (0 errors) ====
declare var $: { x: any };

View File

@ -1,7 +1,14 @@
//// [tests/cases/conformance/typings/typingsLookup3.ts] ////
=== /a.ts ===
/// <reference types="JqUeRy" />
$.x;
>$.x : Symbol(x, Decl(index.d.ts, 0, 16))
>$ : Symbol($, Decl(index.d.ts, 0, 11))
>x : Symbol(x, Decl(index.d.ts, 0, 16))
=== /node_modules/@types/jquery/index.d.ts ===
declare var $: { x: any };
>$ : Symbol($, Decl(index.d.ts, 0, 11))
>x : Symbol(x, Decl(index.d.ts, 0, 16))

View File

@ -5,5 +5,15 @@
"Searching all ancestor node_modules directories for preferred extensions: Declaration.",
"File '/node_modules/JqUeRy.d.ts' does not exist.",
"File '/node_modules/@types/JqUeRy.d.ts' does not exist.",
"======== Type reference directive 'JqUeRy' was not resolved. ========"
"======== Type reference directive 'JqUeRy' was not resolved. ========",
"======== Resolving type reference directive 'jquery', containing file '/__inferred type names__.ts', root directory '/node_modules/@types'. ========",
"Resolving with primary search path '/node_modules/@types'.",
"File '/node_modules/@types/jquery/package.json' does not exist.",
"File '/node_modules/@types/jquery/index.d.ts' exists - use it as a name resolution result.",
"Resolving real path for '/node_modules/@types/jquery/index.d.ts', result '/node_modules/@types/jquery/index.d.ts'.",
"======== Type reference directive 'jquery' was successfully resolved to '/node_modules/@types/jquery/index.d.ts', primary: true. ========",
"File '/node_modules/@types/jquery/package.json' does not exist according to earlier cached lookups.",
"File '/node_modules/@types/package.json' does not exist.",
"File '/node_modules/package.json' does not exist.",
"File '/package.json' does not exist."
]

View File

@ -5,8 +5,15 @@
$.x;
>$.x : any
> : ^^^
>$ : any
> : ^^^
>$ : { x: any; }
> : ^^^^^ ^^^
>x : any
> : ^^^
=== /node_modules/@types/jquery/index.d.ts ===
declare var $: { x: any };
>$ : { x: any; }
> : ^^^^^ ^^^
>x : any
> : ^^^

View File

@ -1,4 +1,5 @@
// @noImplicitReferences: true
// @types: a
// @Filename: /node_modules/@types/.a/index.d.ts
declare const a: number;

View File

@ -1,5 +1,6 @@
// @declaration: true
// @noImplicitReferences: true
// @types: node
// @filename: /.src/node_modules/@types/node/index.d.ts
declare module "url" {
export class Url {}

View File

@ -24,4 +24,4 @@ import { z } from "abc";
x + y + z;
// @Filename: /foo/bar/tsconfig.json
{}
{ "compilerOptions": { "types": ["dopey", "grumpy", "sneezy"] } }

View File

@ -12,4 +12,4 @@ import { x } from "xyz";
x;
// @Filename: /src/tsconfig.json
{}
{ "compilerOptions": { "types": ["foo"] } }

View File

@ -4,7 +4,7 @@
// This tests that `types` references are not lowercased.
// @filename: /tsconfig.json
{ "files": "a.ts" }
{ "files": "a.ts", "compilerOptions": { "types": ["jquery"] } }
// @filename: /node_modules/@types/jquery/index.d.ts
declare var $: { x: any };