mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Report error only on local declaration with additional related information (#49746)
* Add test where the errors are reported in different file Test for #49739 * Report error only on local declaration with additional related information Fixes #49739 * Handle existing tests
This commit is contained in:
39
tests/cases/compiler/indexSignatureInOtherFile.ts
Normal file
39
tests/cases/compiler/indexSignatureInOtherFile.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
// @target: es2015
|
||||
// @Filename: index.ts
|
||||
class Test extends Array1 {
|
||||
[key: symbol]: string
|
||||
}
|
||||
|
||||
// @Filename: other.ts
|
||||
interface Array1<T> {
|
||||
length: number;
|
||||
[n: number]: T;
|
||||
}
|
||||
|
||||
interface ArrayConstructor1 {
|
||||
new(arrayLength?: number): Array1<any>;
|
||||
}
|
||||
|
||||
declare var Array1: ArrayConstructor1;
|
||||
|
||||
// iterable.d.ts
|
||||
interface Array1<T> {
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
}
|
||||
|
||||
// symbol.wellknown.d.ts
|
||||
interface Array1<T> {
|
||||
/**
|
||||
* Returns an object whose properties have the value 'true'
|
||||
* when they will be absent when used in a 'with' statement.
|
||||
*/
|
||||
[Symbol.unscopables](): {
|
||||
copyWithin: boolean;
|
||||
entries: boolean;
|
||||
fill: boolean;
|
||||
find: boolean;
|
||||
findIndex: boolean;
|
||||
keys: boolean;
|
||||
values: boolean;
|
||||
};
|
||||
}
|
||||
39
tests/cases/compiler/indexSignatureInOtherFile1.ts
Normal file
39
tests/cases/compiler/indexSignatureInOtherFile1.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
// @target: es2015
|
||||
// @Filename: other.ts
|
||||
interface Array1<T> {
|
||||
length: number;
|
||||
[n: number]: T;
|
||||
}
|
||||
|
||||
interface ArrayConstructor1 {
|
||||
new(arrayLength?: number): Array1<any>;
|
||||
}
|
||||
|
||||
declare var Array1: ArrayConstructor1;
|
||||
|
||||
// iterable.d.ts
|
||||
interface Array1<T> {
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
}
|
||||
|
||||
// symbol.wellknown.d.ts
|
||||
interface Array1<T> {
|
||||
/**
|
||||
* Returns an object whose properties have the value 'true'
|
||||
* when they will be absent when used in a 'with' statement.
|
||||
*/
|
||||
[Symbol.unscopables](): {
|
||||
copyWithin: boolean;
|
||||
entries: boolean;
|
||||
fill: boolean;
|
||||
find: boolean;
|
||||
findIndex: boolean;
|
||||
keys: boolean;
|
||||
values: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
// @Filename: index.ts
|
||||
class Test extends Array1 {
|
||||
[key: symbol]: string
|
||||
}
|
||||
Reference in New Issue
Block a user