diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts
index 04441468a7313..6cdabfef1b74d 100644
--- a/src/harness/fourslashInterfaceImpl.ts
+++ b/src/harness/fourslashInterfaceImpl.ts
@@ -902,7 +902,7 @@ namespace FourSlashInterface {
export const keywords: readonly ExpectedCompletionEntryObject[] = keywordsWithUndefined.filter(k => k.name !== "undefined");
export const typeKeywords: readonly ExpectedCompletionEntryObject[] =
- ["false", "null", "true", "void", "any", "boolean", "keyof", "never", "readonly", "number", "object", "string", "symbol", "undefined", "unique", "unknown", "bigint"].map(keywordEntry);
+ ["false", "null", "true", "void", "asserts", "any", "boolean", "keyof", "never", "readonly", "number", "object", "string", "symbol", "undefined", "unique", "unknown", "bigint"].map(keywordEntry);
const globalTypeDecls: readonly ExpectedCompletionEntryObject[] = [
interfaceEntry("Symbol"),
@@ -1058,7 +1058,7 @@ namespace FourSlashInterface {
}
export const classElementKeywords: readonly ExpectedCompletionEntryObject[] =
- ["private", "protected", "public", "static", "abstract", "async", "constructor", "get", "readonly", "set"].map(keywordEntry);
+ ["private", "protected", "public", "static", "abstract", "async", "constructor", "declare", "get", "readonly", "set"].map(keywordEntry);
export const classElementInJsKeywords = getInJsKeywords(classElementKeywords);
@@ -1152,6 +1152,7 @@ namespace FourSlashInterface {
"let",
"package",
"yield",
+ "asserts",
"any",
"async",
"await",
@@ -1351,6 +1352,7 @@ namespace FourSlashInterface {
"let",
"package",
"yield",
+ "asserts",
"any",
"async",
"await",
diff --git a/src/services/completions.ts b/src/services/completions.ts
index 9de0d2cb7613f..e671a25f97f1b 100644
--- a/src/services/completions.ts
+++ b/src/services/completions.ts
@@ -2525,6 +2525,7 @@ namespace ts.Completions {
case SyntaxKind.GetKeyword:
case SyntaxKind.SetKeyword:
case SyntaxKind.AsyncKeyword:
+ case SyntaxKind.DeclareKeyword:
return true;
default:
return isClassMemberModifier(kind);
diff --git a/src/services/utilities.ts b/src/services/utilities.ts
index 9d52fcf88b66e..9dce278c83c40 100644
--- a/src/services/utilities.ts
+++ b/src/services/utilities.ts
@@ -1278,6 +1278,7 @@ namespace ts {
export const typeKeywords: readonly SyntaxKind[] = [
SyntaxKind.AnyKeyword,
+ SyntaxKind.AssertsKeyword,
SyntaxKind.BigIntKeyword,
SyntaxKind.BooleanKeyword,
SyntaxKind.FalseKeyword,
diff --git a/tests/cases/fourslash/completionAmbientPropertyDeclaration.ts b/tests/cases/fourslash/completionAmbientPropertyDeclaration.ts
new file mode 100644
index 0000000000000..e83620fab7ccc
--- /dev/null
+++ b/tests/cases/fourslash/completionAmbientPropertyDeclaration.ts
@@ -0,0 +1,9 @@
+///
+
+//// class C {
+//// /*1*/ declare property: number;
+//// /*2*/
+//// }
+
+verify.completions({marker: "1", exact: completion.classElementKeywords, isNewIdentifierLocation: true});
+verify.completions({marker: "2", exact: completion.classElementKeywords, isNewIdentifierLocation: true});
diff --git a/tests/cases/fourslash/completionEntryForClassMembers.ts b/tests/cases/fourslash/completionEntryForClassMembers.ts
index d40a8d273bc65..d0023dc15f4f6 100644
--- a/tests/cases/fourslash/completionEntryForClassMembers.ts
+++ b/tests/cases/fourslash/completionEntryForClassMembers.ts
@@ -146,7 +146,7 @@ verify.completions(
"classThatStartedWritingIdentifierAfterPrivateModifier",
"classThatStartedWritingIdentifierAfterPrivateStaticModifier",
],
- exact: ["private", "protected", "public", "static", "abstract", "async", "constructor", "get", "readonly", "set"].map(
+ exact: ["private", "protected", "public", "static", "abstract", "async", "constructor", "declare", "get", "readonly", "set"].map(
name => ({ name, sortText: completion.SortText.GlobalsOrKeywords })
),
isNewIdentifierLocation: true,
diff --git a/tests/cases/fourslash/completionListInNamedClassExpression.ts b/tests/cases/fourslash/completionListInNamedClassExpression.ts
index 503051310c968..68d994ca2c117 100644
--- a/tests/cases/fourslash/completionListInNamedClassExpression.ts
+++ b/tests/cases/fourslash/completionListInNamedClassExpression.ts
@@ -11,7 +11,7 @@ verify.completions(
{ marker: "0", includes: { name: "myClass", text: "(local class) myClass", kind: "local class" } },
{
marker: "1",
- exact: ["private", "protected", "public", "static", "abstract", "async", "constructor", "get", "readonly", "set"].map(
+ exact: ["private", "protected", "public", "static", "abstract", "async", "constructor", "declare", "get", "readonly", "set"].map(
name => ({ name, sortText: completion.SortText.GlobalsOrKeywords })
),
isNewIdentifierLocation: true,
diff --git a/tests/cases/fourslash/completionTypeGuard.ts b/tests/cases/fourslash/completionTypeGuard.ts
new file mode 100644
index 0000000000000..e072fd5798561
--- /dev/null
+++ b/tests/cases/fourslash/completionTypeGuard.ts
@@ -0,0 +1,11 @@
+///
+
+//// const x = "str";
+//// function assert1(condition: any, msg?: string): /*1*/ ;
+//// function assert2(condition: any, msg?: string): /*2*/ { }
+//// function assert3(condition: any, msg?: string): /*3*/
+//// hi
+
+verify.completions({marker: "1", exact: completion.globalTypes});
+verify.completions({marker: "2", exact: completion.globalTypes});
+verify.completions({marker: "3", exact: completion.globalTypes});