2017-12-07 21:14:18 +01:00
|
|
|
/// <reference path='fourslash.ts' />
|
|
|
|
|
|
|
|
// @noUnusedLocals: true
|
|
|
|
// @noUnusedParameters: true
|
|
|
|
|
2018-06-27 18:26:47 +02:00
|
|
|
////import d from "foo";
|
|
|
|
////import d2, { used1 } from "foo";
|
|
|
|
////import { x } from "foo";
|
|
|
|
////import { x2, used2 } from "foo";
|
|
|
|
////used1; used2;
|
|
|
|
////
|
2017-12-07 21:14:18 +01:00
|
|
|
////function f(a, b) {
|
|
|
|
//// const x = 0;
|
|
|
|
////}
|
2018-05-17 23:31:58 +02:00
|
|
|
////function g(a, b, c) { return a; }
|
2018-06-27 18:26:47 +02:00
|
|
|
////f; g;
|
2018-05-29 21:39:45 +02:00
|
|
|
////
|
|
|
|
////interface I {
|
|
|
|
//// m(x: number): void;
|
|
|
|
////}
|
|
|
|
////
|
|
|
|
////class C implements I {
|
|
|
|
//// m(x: number): void {} // Does not remove 'x', which is inherited
|
|
|
|
//// n(x: number): void {}
|
2018-06-27 18:26:47 +02:00
|
|
|
//// private ["o"](): void {}
|
2018-05-29 21:39:45 +02:00
|
|
|
////}
|
2018-06-27 18:26:47 +02:00
|
|
|
////C;
|
2018-05-29 21:39:45 +02:00
|
|
|
////
|
2018-06-27 18:26:47 +02:00
|
|
|
////declare function takesCb(cb: (x: number, y: string) => void): void;
|
|
|
|
////takesCb((x, y) => {});
|
|
|
|
////takesCb((x, y) => { x; });
|
|
|
|
////takesCb((x, y) => { y; });
|
2018-05-29 21:39:45 +02:00
|
|
|
////
|
2020-09-09 17:23:53 +02:00
|
|
|
////function fn1(x: number, y: string): void {}
|
|
|
|
////takesCb(fn1);
|
|
|
|
////
|
|
|
|
////function fn2(x: number, y: string): void { x; }
|
|
|
|
////takesCb(fn2);
|
|
|
|
////
|
|
|
|
////function fn3(x: number, y: string): void { y; }
|
|
|
|
////takesCb(fn3);
|
|
|
|
////
|
2018-10-30 00:40:30 +01:00
|
|
|
////x => {
|
|
|
|
//// const y = 0;
|
|
|
|
////};
|
|
|
|
////
|
2018-05-22 00:54:33 +02:00
|
|
|
////{
|
|
|
|
//// let a, b;
|
|
|
|
////}
|
|
|
|
////for (let i = 0, j = 0; ;) {}
|
2018-06-27 18:26:47 +02:00
|
|
|
////for (const x of []) {}
|
|
|
|
////for (const y in {}) {}
|
2018-07-13 19:30:22 +02:00
|
|
|
////
|
|
|
|
////export type First<T, U> = T;
|
|
|
|
////export interface ISecond<T, U> { u: U; }
|
|
|
|
////export const cls = class<T, U> { u: U; };
|
2018-07-27 20:55:31 +02:00
|
|
|
////export class Ctu<T, U> {}
|
|
|
|
////export type Length<T> = T extends ArrayLike<infer U> ? number : never; // Not affected, can't delete
|
2017-12-07 21:14:18 +01:00
|
|
|
|
|
|
|
verify.codeFixAll({
|
|
|
|
fixId: "unusedIdentifier_delete",
|
2020-06-30 20:44:47 +02:00
|
|
|
fixAllDescription: ts.Diagnostics.Delete_all_unused_declarations.message,
|
2017-12-07 21:14:18 +01:00
|
|
|
newFileContent:
|
2020-11-02 23:18:50 +01:00
|
|
|
`import d from "foo";
|
|
|
|
import d2, { used1 } from "foo";
|
|
|
|
import { x } from "foo";
|
|
|
|
import { x2, used2 } from "foo";
|
2018-06-27 18:26:47 +02:00
|
|
|
used1; used2;
|
|
|
|
|
|
|
|
function f() {
|
2018-05-17 23:31:58 +02:00
|
|
|
}
|
2018-05-22 00:54:33 +02:00
|
|
|
function g(a) { return a; }
|
2018-06-27 18:26:47 +02:00
|
|
|
f; g;
|
2018-05-29 21:39:45 +02:00
|
|
|
|
|
|
|
interface I {
|
|
|
|
m(x: number): void;
|
|
|
|
}
|
|
|
|
|
|
|
|
class C implements I {
|
|
|
|
m(x: number): void {} // Does not remove 'x', which is inherited
|
|
|
|
n(): void {}
|
|
|
|
}
|
2018-06-27 18:26:47 +02:00
|
|
|
C;
|
2018-05-29 21:39:45 +02:00
|
|
|
|
2018-06-27 18:26:47 +02:00
|
|
|
declare function takesCb(cb: (x: number, y: string) => void): void;
|
|
|
|
takesCb(() => {});
|
|
|
|
takesCb((x) => { x; });
|
|
|
|
takesCb((x, y) => { y; });
|
2018-05-29 21:39:45 +02:00
|
|
|
|
2020-09-09 17:23:53 +02:00
|
|
|
function fn1(): void {}
|
|
|
|
takesCb(fn1);
|
|
|
|
|
|
|
|
function fn2(x: number): void { x; }
|
|
|
|
takesCb(fn2);
|
|
|
|
|
|
|
|
function fn3(x: number, y: string): void { y; }
|
|
|
|
takesCb(fn3);
|
|
|
|
|
2018-10-30 00:40:30 +01:00
|
|
|
() => {
|
|
|
|
};
|
|
|
|
|
2018-05-22 00:54:33 +02:00
|
|
|
{
|
|
|
|
}
|
2018-06-27 18:26:47 +02:00
|
|
|
for (; ;) {}
|
|
|
|
for (const {} of []) {}
|
2018-07-13 19:30:22 +02:00
|
|
|
for (const {} in {}) {}
|
|
|
|
|
|
|
|
export type First<T> = T;
|
|
|
|
export interface ISecond<U> { u: U; }
|
2018-07-27 20:55:31 +02:00
|
|
|
export const cls = class<U> { u: U; };
|
|
|
|
export class Ctu {}
|
|
|
|
export type Length<T> = T extends ArrayLike<infer U> ? number : never; // Not affected, can't delete`,
|
2017-12-07 21:14:18 +01:00
|
|
|
});
|