From b1c2e8caadba7722719ead1dca700fbcc307838d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Tue, 20 Jun 2023 18:52:38 +0200 Subject: [PATCH] Add extra test cases for string literal completions (#54714) --- ...alDirectlyInArgumentWithNullableConstraint.ts | 10 ++++++++++ ...iteralDirectlyInRestConstrainedToTupleType.ts | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 tests/cases/fourslash/completionsLiteralDirectlyInArgumentWithNullableConstraint.ts create mode 100644 tests/cases/fourslash/completionsLiteralDirectlyInRestConstrainedToTupleType.ts diff --git a/tests/cases/fourslash/completionsLiteralDirectlyInArgumentWithNullableConstraint.ts b/tests/cases/fourslash/completionsLiteralDirectlyInArgumentWithNullableConstraint.ts new file mode 100644 index 00000000000..56b786e2335 --- /dev/null +++ b/tests/cases/fourslash/completionsLiteralDirectlyInArgumentWithNullableConstraint.ts @@ -0,0 +1,10 @@ +/// +// @strict: true +//// +//// declare function func< +//// const T extends 'a' | 'b' | undefined = undefined, +//// >(arg?: T): string; +//// +//// func('/*1*/'); + +verify.completions({ marker: ["1"], exact: [`a`, `b`] }); diff --git a/tests/cases/fourslash/completionsLiteralDirectlyInRestConstrainedToTupleType.ts b/tests/cases/fourslash/completionsLiteralDirectlyInRestConstrainedToTupleType.ts new file mode 100644 index 00000000000..d48037a9683 --- /dev/null +++ b/tests/cases/fourslash/completionsLiteralDirectlyInRestConstrainedToTupleType.ts @@ -0,0 +1,16 @@ +/// +// @strict: true +//// +//// interface Func { +//// ( +//// ...args: +//// | [key: Key, options?: any] +//// | [key: Key, defaultValue: string, options?: any] +//// ): string; +//// } +//// +//// declare const func: Func; +//// +//// func("/*1*/"); + +verify.completions({ marker: ["1"], exact: [`a`, `b`] });