From 6664d256e141cd8c0e62af705786c62a9b49cdda Mon Sep 17 00:00:00 2001 From: Alexander T Date: Mon, 1 Jun 2020 10:49:59 +0300 Subject: [PATCH 1/3] fix(38750): create unique names for keywords and re-export them with original names --- src/compiler/transformers/declarations.ts | 25 +- tests/baselines/reference/nullPropertyName.js | 327 +++++++++++ .../reference/nullPropertyName.symbols | 396 +++++++++++++ .../reference/nullPropertyName.types | 552 ++++++++++++++++++ .../declarationEmit/nullPropertyName.ts | 84 +++ 5 files changed, 1380 insertions(+), 4 deletions(-) create mode 100644 tests/baselines/reference/nullPropertyName.js create mode 100644 tests/baselines/reference/nullPropertyName.symbols create mode 100644 tests/baselines/reference/nullPropertyName.types create mode 100644 tests/cases/conformance/declarationEmit/nullPropertyName.ts diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index 00d01ec950809..ab219aedf7a24 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -1180,18 +1180,35 @@ namespace ts { fakespace.parent = enclosingDeclaration as SourceFile | NamespaceDeclaration; fakespace.locals = createSymbolTable(props); fakespace.symbol = props[0].parent!; - const declarations = mapDefined(props, p => { + const declarations = flatMap(props, p => { if (!isPropertyAccessExpression(p.valueDeclaration)) { return undefined; // TODO GH#33569: Handle element access expressions that created late bound names (rather than silently omitting them) } getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration); const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags, symbolTracker); getSymbolAccessibilityDiagnostic = oldDiag; - const varDecl = createVariableDeclaration(unescapeLeadingUnderscores(p.escapedName), type, /*initializer*/ undefined); - return createVariableStatement(/*modifiers*/ undefined, createVariableDeclarationList([varDecl])); + const propName = unescapeLeadingUnderscores(p.escapedName); + if (isIdentifier(p.valueDeclaration.name) && + p.valueDeclaration.name.originalKeywordKind && + isKeyword(p.valueDeclaration.name.originalKeywordKind)) { + const name = createUniqueName(propName); + return [ + transformProperty(name, type), + createExportDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, + createNamedExports([createExportSpecifier(name, propName)])) + ]; + } + return transformProperty(propName, type); + + function transformProperty(name: string | Identifier, type: TypeNode | undefined) { + return createVariableStatement( + /*modifiers*/ undefined, + createVariableDeclarationList([createVariableDeclaration(name, type, /*initializer*/ undefined)])); + } }); const namespaceDecl = createModuleDeclaration(/*decorators*/ undefined, ensureModifiers(input), input.name!, createModuleBlock(declarations), NodeFlags.Namespace); - if (!hasEffectiveModifier(clean, ModifierFlags.Default)) { return [clean, namespaceDecl]; } diff --git a/tests/baselines/reference/nullPropertyName.js b/tests/baselines/reference/nullPropertyName.js new file mode 100644 index 0000000000000..8ab378259b573 --- /dev/null +++ b/tests/baselines/reference/nullPropertyName.js @@ -0,0 +1,327 @@ +//// [nullPropertyName.ts] +function foo() {} +// properties +foo.x = 1; +foo.y = 1; + +// keywords +foo.break = 1; +foo.case = 1; +foo.catch = 1; +foo.class = 1; +foo.const = 1; +foo.continue = 1; +foo.debugger = 1; +foo.default = 1; +foo.delete = 1; +foo.do = 1; +foo.else = 1; +foo.enum = 1; +foo.export = 1; +foo.extends = 1; +foo.false = 1; +foo.finally = 1; +foo.for = 1; +foo.function = 1; +foo.if = 1; +foo.import = 1; +foo.in = 1; +foo.instanceof = 1; +foo.new = 1; +foo.null = 1; +foo.return = 1; +foo.super = 1; +foo.switch = 1; +foo.this = 1; +foo.throw = 1; +foo.true = 1; +foo.try = 1; +foo.typeof = 1; +foo.var = 1; +foo.void = 1; +foo.while = 1; +foo.with = 1; +foo.implements = 1; +foo.interface = 1; +foo.let = 1; +foo.package = 1; +foo.private = 1; +foo.protected = 1; +foo.public = 1; +foo.static = 1; +foo.yield = 1; +foo.abstract = 1; +foo.as = 1; +foo.asserts = 1; +foo.any = 1; +foo.async = 1; +foo.await = 1; +foo.boolean = 1; +foo.constructor = 1; +foo.declare = 1; +foo.get = 1; +foo.infer = 1; +foo.is = 1; +foo.keyof = 1; +foo.module = 1; +foo.namespace = 1; +foo.never = 1; +foo.readonly = 1; +foo.require = 1; +foo.number = 1; +foo.object = 1; +foo.set = 1; +foo.string = 1; +foo.symbol = 1; +foo.type = 1; +foo.undefined = 1; +foo.unique = 1; +foo.unknown = 1; +foo.from = 1; +foo.global = 1; +foo.bigint = 1; +foo.of = 1; + + +//// [nullPropertyName.js] +function foo() { } +// properties +foo.x = 1; +foo.y = 1; +// keywords +foo["break"] = 1; +foo["case"] = 1; +foo["catch"] = 1; +foo["class"] = 1; +foo["const"] = 1; +foo["continue"] = 1; +foo["debugger"] = 1; +foo["default"] = 1; +foo["delete"] = 1; +foo["do"] = 1; +foo["else"] = 1; +foo["enum"] = 1; +foo["export"] = 1; +foo["extends"] = 1; +foo["false"] = 1; +foo["finally"] = 1; +foo["for"] = 1; +foo["function"] = 1; +foo["if"] = 1; +foo["import"] = 1; +foo["in"] = 1; +foo["instanceof"] = 1; +foo["new"] = 1; +foo["null"] = 1; +foo["return"] = 1; +foo["super"] = 1; +foo["switch"] = 1; +foo["this"] = 1; +foo["throw"] = 1; +foo["true"] = 1; +foo["try"] = 1; +foo["typeof"] = 1; +foo["var"] = 1; +foo["void"] = 1; +foo["while"] = 1; +foo["with"] = 1; +foo.implements = 1; +foo.interface = 1; +foo.let = 1; +foo.package = 1; +foo.private = 1; +foo.protected = 1; +foo.public = 1; +foo.static = 1; +foo.yield = 1; +foo.abstract = 1; +foo.as = 1; +foo.asserts = 1; +foo.any = 1; +foo.async = 1; +foo.await = 1; +foo.boolean = 1; +foo.constructor = 1; +foo.declare = 1; +foo.get = 1; +foo.infer = 1; +foo.is = 1; +foo.keyof = 1; +foo.module = 1; +foo.namespace = 1; +foo.never = 1; +foo.readonly = 1; +foo.require = 1; +foo.number = 1; +foo.object = 1; +foo.set = 1; +foo.string = 1; +foo.symbol = 1; +foo.type = 1; +foo.undefined = 1; +foo.unique = 1; +foo.unknown = 1; +foo.from = 1; +foo.global = 1; +foo.bigint = 1; +foo.of = 1; + + +//// [nullPropertyName.d.ts] +declare function foo(): void; +declare namespace foo { + var x: number; + var y: number; + var break_1: number; + export { break_1 as break }; + var case_1: number; + export { case_1 as case }; + var catch_1: number; + export { catch_1 as catch }; + var class_1: number; + export { class_1 as class }; + var const_1: number; + export { const_1 as const }; + var continue_1: number; + export { continue_1 as continue }; + var debugger_1: number; + export { debugger_1 as debugger }; + var default_1: number; + export { default_1 as default }; + var delete_1: number; + export { delete_1 as delete }; + var do_1: number; + export { do_1 as do }; + var else_1: number; + export { else_1 as else }; + var enum_1: number; + export { enum_1 as enum }; + var export_1: number; + export { export_1 as export }; + var extends_1: number; + export { extends_1 as extends }; + var false_1: number; + export { false_1 as false }; + var finally_1: number; + export { finally_1 as finally }; + var for_1: number; + export { for_1 as for }; + var function_1: number; + export { function_1 as function }; + var if_1: number; + export { if_1 as if }; + var import_1: number; + export { import_1 as import }; + var in_1: number; + export { in_1 as in }; + var instanceof_1: number; + export { instanceof_1 as instanceof }; + var new_1: number; + export { new_1 as new }; + var null_1: number; + export { null_1 as null }; + var return_1: number; + export { return_1 as return }; + var super_1: number; + export { super_1 as super }; + var switch_1: number; + export { switch_1 as switch }; + var this_1: number; + export { this_1 as this }; + var throw_1: number; + export { throw_1 as throw }; + var true_1: number; + export { true_1 as true }; + var try_1: number; + export { try_1 as try }; + var typeof_1: number; + export { typeof_1 as typeof }; + var var_1: number; + export { var_1 as var }; + var void_1: number; + export { void_1 as void }; + var while_1: number; + export { while_1 as while }; + var with_1: number; + export { with_1 as with }; + var implements_1: number; + export { implements_1 as implements }; + var interface_1: number; + export { interface_1 as interface }; + var let_1: number; + export { let_1 as let }; + var package_1: number; + export { package_1 as package }; + var private_1: number; + export { private_1 as private }; + var protected_1: number; + export { protected_1 as protected }; + var public_1: number; + export { public_1 as public }; + var static_1: number; + export { static_1 as static }; + var yield_1: number; + export { yield_1 as yield }; + var abstract_1: number; + export { abstract_1 as abstract }; + var as_1: number; + export { as_1 as as }; + var asserts_1: number; + export { asserts_1 as asserts }; + var any_1: number; + export { any_1 as any }; + var async_1: number; + export { async_1 as async }; + var await_1: number; + export { await_1 as await }; + var boolean_1: number; + export { boolean_1 as boolean }; + var constructor_1: number; + export { constructor_1 as constructor }; + var declare_1: number; + export { declare_1 as declare }; + var get_1: number; + export { get_1 as get }; + var infer_1: number; + export { infer_1 as infer }; + var is_1: number; + export { is_1 as is }; + var keyof_1: number; + export { keyof_1 as keyof }; + var module_1: number; + export { module_1 as module }; + var namespace_1: number; + export { namespace_1 as namespace }; + var never_1: number; + export { never_1 as never }; + var readonly_1: number; + export { readonly_1 as readonly }; + var require_1: number; + export { require_1 as require }; + var number_1: number; + export { number_1 as number }; + var object_1: number; + export { object_1 as object }; + var set_1: number; + export { set_1 as set }; + var string_1: number; + export { string_1 as string }; + var symbol_1: number; + export { symbol_1 as symbol }; + var type_1: number; + export { type_1 as type }; + var undefined_1: number; + export { undefined_1 as undefined }; + var unique_1: number; + export { unique_1 as unique }; + var unknown_1: number; + export { unknown_1 as unknown }; + var from_1: number; + export { from_1 as from }; + var global_1: number; + export { global_1 as global }; + var bigint_1: number; + export { bigint_1 as bigint }; + var of_1: number; + export { of_1 as of }; +} diff --git a/tests/baselines/reference/nullPropertyName.symbols b/tests/baselines/reference/nullPropertyName.symbols new file mode 100644 index 0000000000000..78602b568086d --- /dev/null +++ b/tests/baselines/reference/nullPropertyName.symbols @@ -0,0 +1,396 @@ +=== tests/cases/conformance/declarationEmit/nullPropertyName.ts === +function foo() {} +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) + +// properties +foo.x = 1; +>foo.x : Symbol(foo.x, Decl(nullPropertyName.ts, 0, 17)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>x : Symbol(foo.x, Decl(nullPropertyName.ts, 0, 17)) + +foo.y = 1; +>foo.y : Symbol(foo.y, Decl(nullPropertyName.ts, 2, 10)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>y : Symbol(foo.y, Decl(nullPropertyName.ts, 2, 10)) + +// keywords +foo.break = 1; +>foo.break : Symbol(foo.break, Decl(nullPropertyName.ts, 3, 10)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>break : Symbol(foo.break, Decl(nullPropertyName.ts, 3, 10)) + +foo.case = 1; +>foo.case : Symbol(foo.case, Decl(nullPropertyName.ts, 6, 14)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>case : Symbol(foo.case, Decl(nullPropertyName.ts, 6, 14)) + +foo.catch = 1; +>foo.catch : Symbol(foo.catch, Decl(nullPropertyName.ts, 7, 13)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>catch : Symbol(foo.catch, Decl(nullPropertyName.ts, 7, 13)) + +foo.class = 1; +>foo.class : Symbol(foo.class, Decl(nullPropertyName.ts, 8, 14)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>class : Symbol(foo.class, Decl(nullPropertyName.ts, 8, 14)) + +foo.const = 1; +>foo.const : Symbol(foo.const, Decl(nullPropertyName.ts, 9, 14)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>const : Symbol(foo.const, Decl(nullPropertyName.ts, 9, 14)) + +foo.continue = 1; +>foo.continue : Symbol(foo.continue, Decl(nullPropertyName.ts, 10, 14)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>continue : Symbol(foo.continue, Decl(nullPropertyName.ts, 10, 14)) + +foo.debugger = 1; +>foo.debugger : Symbol(foo.debugger, Decl(nullPropertyName.ts, 11, 17)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>debugger : Symbol(foo.debugger, Decl(nullPropertyName.ts, 11, 17)) + +foo.default = 1; +>foo.default : Symbol(foo.default, Decl(nullPropertyName.ts, 12, 17)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>default : Symbol(foo.default, Decl(nullPropertyName.ts, 12, 17)) + +foo.delete = 1; +>foo.delete : Symbol(foo.delete, Decl(nullPropertyName.ts, 13, 16)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>delete : Symbol(foo.delete, Decl(nullPropertyName.ts, 13, 16)) + +foo.do = 1; +>foo.do : Symbol(foo.do, Decl(nullPropertyName.ts, 14, 15)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>do : Symbol(foo.do, Decl(nullPropertyName.ts, 14, 15)) + +foo.else = 1; +>foo.else : Symbol(foo.else, Decl(nullPropertyName.ts, 15, 11)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>else : Symbol(foo.else, Decl(nullPropertyName.ts, 15, 11)) + +foo.enum = 1; +>foo.enum : Symbol(foo.enum, Decl(nullPropertyName.ts, 16, 13)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>enum : Symbol(foo.enum, Decl(nullPropertyName.ts, 16, 13)) + +foo.export = 1; +>foo.export : Symbol(foo.export, Decl(nullPropertyName.ts, 17, 13)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>export : Symbol(foo.export, Decl(nullPropertyName.ts, 17, 13)) + +foo.extends = 1; +>foo.extends : Symbol(foo.extends, Decl(nullPropertyName.ts, 18, 15)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>extends : Symbol(foo.extends, Decl(nullPropertyName.ts, 18, 15)) + +foo.false = 1; +>foo.false : Symbol(foo.false, Decl(nullPropertyName.ts, 19, 16)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>false : Symbol(foo.false, Decl(nullPropertyName.ts, 19, 16)) + +foo.finally = 1; +>foo.finally : Symbol(foo.finally, Decl(nullPropertyName.ts, 20, 14)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>finally : Symbol(foo.finally, Decl(nullPropertyName.ts, 20, 14)) + +foo.for = 1; +>foo.for : Symbol(foo.for, Decl(nullPropertyName.ts, 21, 16)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>for : Symbol(foo.for, Decl(nullPropertyName.ts, 21, 16)) + +foo.function = 1; +>foo.function : Symbol(foo.function, Decl(nullPropertyName.ts, 22, 12)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>function : Symbol(foo.function, Decl(nullPropertyName.ts, 22, 12)) + +foo.if = 1; +>foo.if : Symbol(foo.if, Decl(nullPropertyName.ts, 23, 17)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>if : Symbol(foo.if, Decl(nullPropertyName.ts, 23, 17)) + +foo.import = 1; +>foo.import : Symbol(foo.import, Decl(nullPropertyName.ts, 24, 11)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>import : Symbol(foo.import, Decl(nullPropertyName.ts, 24, 11)) + +foo.in = 1; +>foo.in : Symbol(foo.in, Decl(nullPropertyName.ts, 25, 15)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>in : Symbol(foo.in, Decl(nullPropertyName.ts, 25, 15)) + +foo.instanceof = 1; +>foo.instanceof : Symbol(foo.instanceof, Decl(nullPropertyName.ts, 26, 11)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>instanceof : Symbol(foo.instanceof, Decl(nullPropertyName.ts, 26, 11)) + +foo.new = 1; +>foo.new : Symbol(foo.new, Decl(nullPropertyName.ts, 27, 19)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>new : Symbol(foo.new, Decl(nullPropertyName.ts, 27, 19)) + +foo.null = 1; +>foo.null : Symbol(foo.null, Decl(nullPropertyName.ts, 28, 12)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>null : Symbol(foo.null, Decl(nullPropertyName.ts, 28, 12)) + +foo.return = 1; +>foo.return : Symbol(foo.return, Decl(nullPropertyName.ts, 29, 13)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>return : Symbol(foo.return, Decl(nullPropertyName.ts, 29, 13)) + +foo.super = 1; +>foo.super : Symbol(foo.super, Decl(nullPropertyName.ts, 30, 15)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>super : Symbol(foo.super, Decl(nullPropertyName.ts, 30, 15)) + +foo.switch = 1; +>foo.switch : Symbol(foo.switch, Decl(nullPropertyName.ts, 31, 14)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>switch : Symbol(foo.switch, Decl(nullPropertyName.ts, 31, 14)) + +foo.this = 1; +>foo.this : Symbol(foo.this, Decl(nullPropertyName.ts, 32, 15)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>this : Symbol(foo.this, Decl(nullPropertyName.ts, 32, 15)) + +foo.throw = 1; +>foo.throw : Symbol(foo.throw, Decl(nullPropertyName.ts, 33, 13)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>throw : Symbol(foo.throw, Decl(nullPropertyName.ts, 33, 13)) + +foo.true = 1; +>foo.true : Symbol(foo.true, Decl(nullPropertyName.ts, 34, 14)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>true : Symbol(foo.true, Decl(nullPropertyName.ts, 34, 14)) + +foo.try = 1; +>foo.try : Symbol(foo.try, Decl(nullPropertyName.ts, 35, 13)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>try : Symbol(foo.try, Decl(nullPropertyName.ts, 35, 13)) + +foo.typeof = 1; +>foo.typeof : Symbol(foo.typeof, Decl(nullPropertyName.ts, 36, 12)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>typeof : Symbol(foo.typeof, Decl(nullPropertyName.ts, 36, 12)) + +foo.var = 1; +>foo.var : Symbol(foo.var, Decl(nullPropertyName.ts, 37, 15)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>var : Symbol(foo.var, Decl(nullPropertyName.ts, 37, 15)) + +foo.void = 1; +>foo.void : Symbol(foo.void, Decl(nullPropertyName.ts, 38, 12)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>void : Symbol(foo.void, Decl(nullPropertyName.ts, 38, 12)) + +foo.while = 1; +>foo.while : Symbol(foo.while, Decl(nullPropertyName.ts, 39, 13)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>while : Symbol(foo.while, Decl(nullPropertyName.ts, 39, 13)) + +foo.with = 1; +>foo.with : Symbol(foo.with, Decl(nullPropertyName.ts, 40, 14)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>with : Symbol(foo.with, Decl(nullPropertyName.ts, 40, 14)) + +foo.implements = 1; +>foo.implements : Symbol(foo.implements, Decl(nullPropertyName.ts, 41, 13)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>implements : Symbol(foo.implements, Decl(nullPropertyName.ts, 41, 13)) + +foo.interface = 1; +>foo.interface : Symbol(foo.interface, Decl(nullPropertyName.ts, 42, 19)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>interface : Symbol(foo.interface, Decl(nullPropertyName.ts, 42, 19)) + +foo.let = 1; +>foo.let : Symbol(foo.let, Decl(nullPropertyName.ts, 43, 18)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>let : Symbol(foo.let, Decl(nullPropertyName.ts, 43, 18)) + +foo.package = 1; +>foo.package : Symbol(foo.package, Decl(nullPropertyName.ts, 44, 12)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>package : Symbol(foo.package, Decl(nullPropertyName.ts, 44, 12)) + +foo.private = 1; +>foo.private : Symbol(foo.private, Decl(nullPropertyName.ts, 45, 16)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>private : Symbol(foo.private, Decl(nullPropertyName.ts, 45, 16)) + +foo.protected = 1; +>foo.protected : Symbol(foo.protected, Decl(nullPropertyName.ts, 46, 16)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>protected : Symbol(foo.protected, Decl(nullPropertyName.ts, 46, 16)) + +foo.public = 1; +>foo.public : Symbol(foo.public, Decl(nullPropertyName.ts, 47, 18)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>public : Symbol(foo.public, Decl(nullPropertyName.ts, 47, 18)) + +foo.static = 1; +>foo.static : Symbol(foo.static, Decl(nullPropertyName.ts, 48, 15)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>static : Symbol(foo.static, Decl(nullPropertyName.ts, 48, 15)) + +foo.yield = 1; +>foo.yield : Symbol(foo.yield, Decl(nullPropertyName.ts, 49, 15)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>yield : Symbol(foo.yield, Decl(nullPropertyName.ts, 49, 15)) + +foo.abstract = 1; +>foo.abstract : Symbol(foo.abstract, Decl(nullPropertyName.ts, 50, 14)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>abstract : Symbol(foo.abstract, Decl(nullPropertyName.ts, 50, 14)) + +foo.as = 1; +>foo.as : Symbol(foo.as, Decl(nullPropertyName.ts, 51, 17)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>as : Symbol(foo.as, Decl(nullPropertyName.ts, 51, 17)) + +foo.asserts = 1; +>foo.asserts : Symbol(foo.asserts, Decl(nullPropertyName.ts, 52, 11)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>asserts : Symbol(foo.asserts, Decl(nullPropertyName.ts, 52, 11)) + +foo.any = 1; +>foo.any : Symbol(foo.any, Decl(nullPropertyName.ts, 53, 16)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>any : Symbol(foo.any, Decl(nullPropertyName.ts, 53, 16)) + +foo.async = 1; +>foo.async : Symbol(foo.async, Decl(nullPropertyName.ts, 54, 12)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>async : Symbol(foo.async, Decl(nullPropertyName.ts, 54, 12)) + +foo.await = 1; +>foo.await : Symbol(foo.await, Decl(nullPropertyName.ts, 55, 14)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>await : Symbol(foo.await, Decl(nullPropertyName.ts, 55, 14)) + +foo.boolean = 1; +>foo.boolean : Symbol(foo.boolean, Decl(nullPropertyName.ts, 56, 14)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>boolean : Symbol(foo.boolean, Decl(nullPropertyName.ts, 56, 14)) + +foo.constructor = 1; +>foo.constructor : Symbol(foo.constructor, Decl(nullPropertyName.ts, 57, 16)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>constructor : Symbol(foo.constructor, Decl(nullPropertyName.ts, 57, 16)) + +foo.declare = 1; +>foo.declare : Symbol(foo.declare, Decl(nullPropertyName.ts, 58, 20)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>declare : Symbol(foo.declare, Decl(nullPropertyName.ts, 58, 20)) + +foo.get = 1; +>foo.get : Symbol(foo.get, Decl(nullPropertyName.ts, 59, 16)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>get : Symbol(foo.get, Decl(nullPropertyName.ts, 59, 16)) + +foo.infer = 1; +>foo.infer : Symbol(foo.infer, Decl(nullPropertyName.ts, 60, 12)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>infer : Symbol(foo.infer, Decl(nullPropertyName.ts, 60, 12)) + +foo.is = 1; +>foo.is : Symbol(foo.is, Decl(nullPropertyName.ts, 61, 14)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>is : Symbol(foo.is, Decl(nullPropertyName.ts, 61, 14)) + +foo.keyof = 1; +>foo.keyof : Symbol(foo.keyof, Decl(nullPropertyName.ts, 62, 11)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>keyof : Symbol(foo.keyof, Decl(nullPropertyName.ts, 62, 11)) + +foo.module = 1; +>foo.module : Symbol(foo.module, Decl(nullPropertyName.ts, 63, 14)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>module : Symbol(foo.module, Decl(nullPropertyName.ts, 63, 14)) + +foo.namespace = 1; +>foo.namespace : Symbol(foo.namespace, Decl(nullPropertyName.ts, 64, 15)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>namespace : Symbol(foo.namespace, Decl(nullPropertyName.ts, 64, 15)) + +foo.never = 1; +>foo.never : Symbol(foo.never, Decl(nullPropertyName.ts, 65, 18)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>never : Symbol(foo.never, Decl(nullPropertyName.ts, 65, 18)) + +foo.readonly = 1; +>foo.readonly : Symbol(foo.readonly, Decl(nullPropertyName.ts, 66, 14)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>readonly : Symbol(foo.readonly, Decl(nullPropertyName.ts, 66, 14)) + +foo.require = 1; +>foo.require : Symbol(foo.require, Decl(nullPropertyName.ts, 67, 17)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>require : Symbol(foo.require, Decl(nullPropertyName.ts, 67, 17)) + +foo.number = 1; +>foo.number : Symbol(foo.number, Decl(nullPropertyName.ts, 68, 16)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>number : Symbol(foo.number, Decl(nullPropertyName.ts, 68, 16)) + +foo.object = 1; +>foo.object : Symbol(foo.object, Decl(nullPropertyName.ts, 69, 15)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>object : Symbol(foo.object, Decl(nullPropertyName.ts, 69, 15)) + +foo.set = 1; +>foo.set : Symbol(foo.set, Decl(nullPropertyName.ts, 70, 15)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>set : Symbol(foo.set, Decl(nullPropertyName.ts, 70, 15)) + +foo.string = 1; +>foo.string : Symbol(foo.string, Decl(nullPropertyName.ts, 71, 12)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>string : Symbol(foo.string, Decl(nullPropertyName.ts, 71, 12)) + +foo.symbol = 1; +>foo.symbol : Symbol(foo.symbol, Decl(nullPropertyName.ts, 72, 15)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>symbol : Symbol(foo.symbol, Decl(nullPropertyName.ts, 72, 15)) + +foo.type = 1; +>foo.type : Symbol(foo.type, Decl(nullPropertyName.ts, 73, 15)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>type : Symbol(foo.type, Decl(nullPropertyName.ts, 73, 15)) + +foo.undefined = 1; +>foo.undefined : Symbol(foo.undefined, Decl(nullPropertyName.ts, 74, 13)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>undefined : Symbol(foo.undefined, Decl(nullPropertyName.ts, 74, 13)) + +foo.unique = 1; +>foo.unique : Symbol(foo.unique, Decl(nullPropertyName.ts, 75, 18)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>unique : Symbol(foo.unique, Decl(nullPropertyName.ts, 75, 18)) + +foo.unknown = 1; +>foo.unknown : Symbol(foo.unknown, Decl(nullPropertyName.ts, 76, 15)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>unknown : Symbol(foo.unknown, Decl(nullPropertyName.ts, 76, 15)) + +foo.from = 1; +>foo.from : Symbol(foo.from, Decl(nullPropertyName.ts, 77, 16)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>from : Symbol(foo.from, Decl(nullPropertyName.ts, 77, 16)) + +foo.global = 1; +>foo.global : Symbol(foo.global, Decl(nullPropertyName.ts, 78, 13)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>global : Symbol(foo.global, Decl(nullPropertyName.ts, 78, 13)) + +foo.bigint = 1; +>foo.bigint : Symbol(foo.bigint, Decl(nullPropertyName.ts, 79, 15)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>bigint : Symbol(foo.bigint, Decl(nullPropertyName.ts, 79, 15)) + +foo.of = 1; +>foo.of : Symbol(foo.of, Decl(nullPropertyName.ts, 80, 15)) +>foo : Symbol(foo, Decl(nullPropertyName.ts, 0, 0), Decl(nullPropertyName.ts, 0, 17), Decl(nullPropertyName.ts, 2, 10), Decl(nullPropertyName.ts, 3, 10), Decl(nullPropertyName.ts, 6, 14) ... and 74 more) +>of : Symbol(foo.of, Decl(nullPropertyName.ts, 80, 15)) + diff --git a/tests/baselines/reference/nullPropertyName.types b/tests/baselines/reference/nullPropertyName.types new file mode 100644 index 0000000000000..b2acc69565866 --- /dev/null +++ b/tests/baselines/reference/nullPropertyName.types @@ -0,0 +1,552 @@ +=== tests/cases/conformance/declarationEmit/nullPropertyName.ts === +function foo() {} +>foo : typeof foo + +// properties +foo.x = 1; +>foo.x = 1 : 1 +>foo.x : number +>foo : typeof foo +>x : number +>1 : 1 + +foo.y = 1; +>foo.y = 1 : 1 +>foo.y : number +>foo : typeof foo +>y : number +>1 : 1 + +// keywords +foo.break = 1; +>foo.break = 1 : 1 +>foo.break : number +>foo : typeof foo +>break : number +>1 : 1 + +foo.case = 1; +>foo.case = 1 : 1 +>foo.case : number +>foo : typeof foo +>case : number +>1 : 1 + +foo.catch = 1; +>foo.catch = 1 : 1 +>foo.catch : number +>foo : typeof foo +>catch : number +>1 : 1 + +foo.class = 1; +>foo.class = 1 : 1 +>foo.class : number +>foo : typeof foo +>class : number +>1 : 1 + +foo.const = 1; +>foo.const = 1 : 1 +>foo.const : number +>foo : typeof foo +>const : number +>1 : 1 + +foo.continue = 1; +>foo.continue = 1 : 1 +>foo.continue : number +>foo : typeof foo +>continue : number +>1 : 1 + +foo.debugger = 1; +>foo.debugger = 1 : 1 +>foo.debugger : number +>foo : typeof foo +>debugger : number +>1 : 1 + +foo.default = 1; +>foo.default = 1 : 1 +>foo.default : number +>foo : typeof foo +>default : number +>1 : 1 + +foo.delete = 1; +>foo.delete = 1 : 1 +>foo.delete : number +>foo : typeof foo +>delete : number +>1 : 1 + +foo.do = 1; +>foo.do = 1 : 1 +>foo.do : number +>foo : typeof foo +>do : number +>1 : 1 + +foo.else = 1; +>foo.else = 1 : 1 +>foo.else : number +>foo : typeof foo +>else : number +>1 : 1 + +foo.enum = 1; +>foo.enum = 1 : 1 +>foo.enum : number +>foo : typeof foo +>enum : number +>1 : 1 + +foo.export = 1; +>foo.export = 1 : 1 +>foo.export : number +>foo : typeof foo +>export : number +>1 : 1 + +foo.extends = 1; +>foo.extends = 1 : 1 +>foo.extends : number +>foo : typeof foo +>extends : number +>1 : 1 + +foo.false = 1; +>foo.false = 1 : 1 +>foo.false : number +>foo : typeof foo +>false : number +>1 : 1 + +foo.finally = 1; +>foo.finally = 1 : 1 +>foo.finally : number +>foo : typeof foo +>finally : number +>1 : 1 + +foo.for = 1; +>foo.for = 1 : 1 +>foo.for : number +>foo : typeof foo +>for : number +>1 : 1 + +foo.function = 1; +>foo.function = 1 : 1 +>foo.function : number +>foo : typeof foo +>function : number +>1 : 1 + +foo.if = 1; +>foo.if = 1 : 1 +>foo.if : number +>foo : typeof foo +>if : number +>1 : 1 + +foo.import = 1; +>foo.import = 1 : 1 +>foo.import : number +>foo : typeof foo +>import : number +>1 : 1 + +foo.in = 1; +>foo.in = 1 : 1 +>foo.in : number +>foo : typeof foo +>in : number +>1 : 1 + +foo.instanceof = 1; +>foo.instanceof = 1 : 1 +>foo.instanceof : number +>foo : typeof foo +>instanceof : number +>1 : 1 + +foo.new = 1; +>foo.new = 1 : 1 +>foo.new : number +>foo : typeof foo +>new : number +>1 : 1 + +foo.null = 1; +>foo.null = 1 : 1 +>foo.null : number +>foo : typeof foo +>null : number +>1 : 1 + +foo.return = 1; +>foo.return = 1 : 1 +>foo.return : number +>foo : typeof foo +>return : number +>1 : 1 + +foo.super = 1; +>foo.super = 1 : 1 +>foo.super : number +>foo : typeof foo +>super : number +>1 : 1 + +foo.switch = 1; +>foo.switch = 1 : 1 +>foo.switch : number +>foo : typeof foo +>switch : number +>1 : 1 + +foo.this = 1; +>foo.this = 1 : 1 +>foo.this : number +>foo : typeof foo +>this : number +>1 : 1 + +foo.throw = 1; +>foo.throw = 1 : 1 +>foo.throw : number +>foo : typeof foo +>throw : number +>1 : 1 + +foo.true = 1; +>foo.true = 1 : 1 +>foo.true : number +>foo : typeof foo +>true : number +>1 : 1 + +foo.try = 1; +>foo.try = 1 : 1 +>foo.try : number +>foo : typeof foo +>try : number +>1 : 1 + +foo.typeof = 1; +>foo.typeof = 1 : 1 +>foo.typeof : number +>foo : typeof foo +>typeof : number +>1 : 1 + +foo.var = 1; +>foo.var = 1 : 1 +>foo.var : number +>foo : typeof foo +>var : number +>1 : 1 + +foo.void = 1; +>foo.void = 1 : 1 +>foo.void : number +>foo : typeof foo +>void : number +>1 : 1 + +foo.while = 1; +>foo.while = 1 : 1 +>foo.while : number +>foo : typeof foo +>while : number +>1 : 1 + +foo.with = 1; +>foo.with = 1 : 1 +>foo.with : number +>foo : typeof foo +>with : number +>1 : 1 + +foo.implements = 1; +>foo.implements = 1 : 1 +>foo.implements : number +>foo : typeof foo +>implements : number +>1 : 1 + +foo.interface = 1; +>foo.interface = 1 : 1 +>foo.interface : number +>foo : typeof foo +>interface : number +>1 : 1 + +foo.let = 1; +>foo.let = 1 : 1 +>foo.let : number +>foo : typeof foo +>let : number +>1 : 1 + +foo.package = 1; +>foo.package = 1 : 1 +>foo.package : number +>foo : typeof foo +>package : number +>1 : 1 + +foo.private = 1; +>foo.private = 1 : 1 +>foo.private : number +>foo : typeof foo +>private : number +>1 : 1 + +foo.protected = 1; +>foo.protected = 1 : 1 +>foo.protected : number +>foo : typeof foo +>protected : number +>1 : 1 + +foo.public = 1; +>foo.public = 1 : 1 +>foo.public : number +>foo : typeof foo +>public : number +>1 : 1 + +foo.static = 1; +>foo.static = 1 : 1 +>foo.static : number +>foo : typeof foo +>static : number +>1 : 1 + +foo.yield = 1; +>foo.yield = 1 : 1 +>foo.yield : number +>foo : typeof foo +>yield : number +>1 : 1 + +foo.abstract = 1; +>foo.abstract = 1 : 1 +>foo.abstract : number +>foo : typeof foo +>abstract : number +>1 : 1 + +foo.as = 1; +>foo.as = 1 : 1 +>foo.as : number +>foo : typeof foo +>as : number +>1 : 1 + +foo.asserts = 1; +>foo.asserts = 1 : 1 +>foo.asserts : number +>foo : typeof foo +>asserts : number +>1 : 1 + +foo.any = 1; +>foo.any = 1 : 1 +>foo.any : number +>foo : typeof foo +>any : number +>1 : 1 + +foo.async = 1; +>foo.async = 1 : 1 +>foo.async : number +>foo : typeof foo +>async : number +>1 : 1 + +foo.await = 1; +>foo.await = 1 : 1 +>foo.await : number +>foo : typeof foo +>await : number +>1 : 1 + +foo.boolean = 1; +>foo.boolean = 1 : 1 +>foo.boolean : number +>foo : typeof foo +>boolean : number +>1 : 1 + +foo.constructor = 1; +>foo.constructor = 1 : 1 +>foo.constructor : number +>foo : typeof foo +>constructor : number +>1 : 1 + +foo.declare = 1; +>foo.declare = 1 : 1 +>foo.declare : number +>foo : typeof foo +>declare : number +>1 : 1 + +foo.get = 1; +>foo.get = 1 : 1 +>foo.get : number +>foo : typeof foo +>get : number +>1 : 1 + +foo.infer = 1; +>foo.infer = 1 : 1 +>foo.infer : number +>foo : typeof foo +>infer : number +>1 : 1 + +foo.is = 1; +>foo.is = 1 : 1 +>foo.is : number +>foo : typeof foo +>is : number +>1 : 1 + +foo.keyof = 1; +>foo.keyof = 1 : 1 +>foo.keyof : number +>foo : typeof foo +>keyof : number +>1 : 1 + +foo.module = 1; +>foo.module = 1 : 1 +>foo.module : number +>foo : typeof foo +>module : number +>1 : 1 + +foo.namespace = 1; +>foo.namespace = 1 : 1 +>foo.namespace : number +>foo : typeof foo +>namespace : number +>1 : 1 + +foo.never = 1; +>foo.never = 1 : 1 +>foo.never : number +>foo : typeof foo +>never : number +>1 : 1 + +foo.readonly = 1; +>foo.readonly = 1 : 1 +>foo.readonly : number +>foo : typeof foo +>readonly : number +>1 : 1 + +foo.require = 1; +>foo.require = 1 : 1 +>foo.require : number +>foo : typeof foo +>require : number +>1 : 1 + +foo.number = 1; +>foo.number = 1 : 1 +>foo.number : number +>foo : typeof foo +>number : number +>1 : 1 + +foo.object = 1; +>foo.object = 1 : 1 +>foo.object : number +>foo : typeof foo +>object : number +>1 : 1 + +foo.set = 1; +>foo.set = 1 : 1 +>foo.set : number +>foo : typeof foo +>set : number +>1 : 1 + +foo.string = 1; +>foo.string = 1 : 1 +>foo.string : number +>foo : typeof foo +>string : number +>1 : 1 + +foo.symbol = 1; +>foo.symbol = 1 : 1 +>foo.symbol : number +>foo : typeof foo +>symbol : number +>1 : 1 + +foo.type = 1; +>foo.type = 1 : 1 +>foo.type : number +>foo : typeof foo +>type : number +>1 : 1 + +foo.undefined = 1; +>foo.undefined = 1 : 1 +>foo.undefined : number +>foo : typeof foo +>undefined : number +>1 : 1 + +foo.unique = 1; +>foo.unique = 1 : 1 +>foo.unique : number +>foo : typeof foo +>unique : number +>1 : 1 + +foo.unknown = 1; +>foo.unknown = 1 : 1 +>foo.unknown : number +>foo : typeof foo +>unknown : number +>1 : 1 + +foo.from = 1; +>foo.from = 1 : 1 +>foo.from : number +>foo : typeof foo +>from : number +>1 : 1 + +foo.global = 1; +>foo.global = 1 : 1 +>foo.global : number +>foo : typeof foo +>global : number +>1 : 1 + +foo.bigint = 1; +>foo.bigint = 1 : 1 +>foo.bigint : number +>foo : typeof foo +>bigint : number +>1 : 1 + +foo.of = 1; +>foo.of = 1 : 1 +>foo.of : number +>foo : typeof foo +>of : number +>1 : 1 + diff --git a/tests/cases/conformance/declarationEmit/nullPropertyName.ts b/tests/cases/conformance/declarationEmit/nullPropertyName.ts new file mode 100644 index 0000000000000..fb0b6ae0fb0e2 --- /dev/null +++ b/tests/cases/conformance/declarationEmit/nullPropertyName.ts @@ -0,0 +1,84 @@ +// @declaration: true + +function foo() {} +// properties +foo.x = 1; +foo.y = 1; + +// keywords +foo.break = 1; +foo.case = 1; +foo.catch = 1; +foo.class = 1; +foo.const = 1; +foo.continue = 1; +foo.debugger = 1; +foo.default = 1; +foo.delete = 1; +foo.do = 1; +foo.else = 1; +foo.enum = 1; +foo.export = 1; +foo.extends = 1; +foo.false = 1; +foo.finally = 1; +foo.for = 1; +foo.function = 1; +foo.if = 1; +foo.import = 1; +foo.in = 1; +foo.instanceof = 1; +foo.new = 1; +foo.null = 1; +foo.return = 1; +foo.super = 1; +foo.switch = 1; +foo.this = 1; +foo.throw = 1; +foo.true = 1; +foo.try = 1; +foo.typeof = 1; +foo.var = 1; +foo.void = 1; +foo.while = 1; +foo.with = 1; +foo.implements = 1; +foo.interface = 1; +foo.let = 1; +foo.package = 1; +foo.private = 1; +foo.protected = 1; +foo.public = 1; +foo.static = 1; +foo.yield = 1; +foo.abstract = 1; +foo.as = 1; +foo.asserts = 1; +foo.any = 1; +foo.async = 1; +foo.await = 1; +foo.boolean = 1; +foo.constructor = 1; +foo.declare = 1; +foo.get = 1; +foo.infer = 1; +foo.is = 1; +foo.keyof = 1; +foo.module = 1; +foo.namespace = 1; +foo.never = 1; +foo.readonly = 1; +foo.require = 1; +foo.number = 1; +foo.object = 1; +foo.set = 1; +foo.string = 1; +foo.symbol = 1; +foo.type = 1; +foo.undefined = 1; +foo.unique = 1; +foo.unknown = 1; +foo.from = 1; +foo.global = 1; +foo.bigint = 1; +foo.of = 1; From 944e1da430884f82a827e747242c7beeb86b8ee6 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 8 Jun 2020 11:21:13 -0700 Subject: [PATCH 2/3] Serialize (noncontextual) keyword named namespace members with export declarations in both declaration emitters --- src/compiler/checker.ts | 16 +++++-- src/compiler/transformers/declarations.ts | 25 +++++++++-- .../declarationEmitFunctionKeywordProp.js | 40 +++++++++++++++++ ...declarationEmitFunctionKeywordProp.symbols | 35 +++++++++++++++ .../declarationEmitFunctionKeywordProp.types | 45 +++++++++++++++++++ ...arationsExportAssignmentWithKeywordName.js | 14 +++--- .../jsDeclarationsFunctionKeywordProp.js | 41 +++++++++++++++++ .../jsDeclarationsFunctionKeywordProp.symbols | 35 +++++++++++++++ .../jsDeclarationsFunctionKeywordProp.types | 45 +++++++++++++++++++ .../declarationEmitFunctionKeywordProp.ts | 11 +++++ .../jsDeclarationsFunctionKeywordProp.ts | 16 +++++++ 11 files changed, 309 insertions(+), 14 deletions(-) create mode 100644 tests/baselines/reference/declarationEmitFunctionKeywordProp.js create mode 100644 tests/baselines/reference/declarationEmitFunctionKeywordProp.symbols create mode 100644 tests/baselines/reference/declarationEmitFunctionKeywordProp.types create mode 100644 tests/baselines/reference/jsDeclarationsFunctionKeywordProp.js create mode 100644 tests/baselines/reference/jsDeclarationsFunctionKeywordProp.symbols create mode 100644 tests/baselines/reference/jsDeclarationsFunctionKeywordProp.types create mode 100644 tests/cases/compiler/declarationEmitFunctionKeywordProp.ts create mode 100644 tests/cases/conformance/jsdoc/declarations/jsDeclarationsFunctionKeywordProp.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5c94cf46c969e..1fb889bef0b3f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5987,7 +5987,7 @@ namespace ts { function serializeSymbolWorker(symbol: Symbol, isPrivate: boolean, propertyAsAlias: boolean) { const symbolName = unescapeLeadingUnderscores(symbol.escapedName); const isDefault = symbol.escapedName === InternalSymbolName.Default; - if (!(context.flags & NodeBuilderFlags.AllowAnonymousIdentifier) && isStringANonContextualKeyword(symbolName) && !isDefault) { + if (isPrivate && !(context.flags & NodeBuilderFlags.AllowAnonymousIdentifier) && isStringANonContextualKeyword(symbolName) && !isDefault) { // Oh no. We cannot use this symbol's name as it's name... It's likely some jsdoc had an invalid name like `export` or `default` :( context.encounteredError = true; // TODO: Issue error via symbol tracker? @@ -5997,7 +5997,9 @@ namespace ts { symbol.flags & SymbolFlags.ExportDoesNotSupportDefaultModifier || (symbol.flags & SymbolFlags.Function && length(getPropertiesOfType(getTypeOfSymbol(symbol)))) ) && !(symbol.flags & SymbolFlags.Alias); // An alias symbol should preclude needing to make an alias ourselves - if (needsPostExportDefault) { + let needsExportDeclaration = !needsPostExportDefault && !isPrivate && isStringANonContextualKeyword(symbolName) && !isDefault; + // `serializeVariableOrProperty` will handle adding the export declaration if it is run (since `getInternalSymbolName` will create the name mapping), so we need to ensuer we unset `needsExportDeclaration` if it is + if (needsPostExportDefault || needsExportDeclaration) { isPrivate = true; } const modifierFlags = (!isPrivate ? ModifierFlags.Export : 0) | (isDefault && !needsPostExportDefault ? ModifierFlags.Default : 0); @@ -6019,6 +6021,7 @@ namespace ts { && !(symbol.flags & SymbolFlags.Class) && !isConstMergedWithNSPrintableAsSignatureMerge) { serializeVariableOrProperty(symbol, symbolName, isPrivate, needsPostExportDefault, propertyAsAlias, modifierFlags); + needsExportDeclaration = false; } if (symbol.flags & SymbolFlags.Enum) { serializeEnum(symbol, symbolName, modifierFlags); @@ -6058,6 +6061,13 @@ namespace ts { if (needsPostExportDefault) { addResult(createExportAssignment(/*decorators*/ undefined, /*modifiers*/ undefined, /*isExportAssignment*/ false, createIdentifier(getInternalSymbolName(symbol, symbolName))), ModifierFlags.None); } + else if (needsExportDeclaration) { + addResult(createExportDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, + createNamedExports([createExportSpecifier(getInternalSymbolName(symbol, symbolName), symbolName)]) + ), ModifierFlags.None); + } } function includePrivateSymbol(symbol: Symbol) { @@ -6635,7 +6645,7 @@ namespace ts { !(typeToSerialize.symbol && some(typeToSerialize.symbol.declarations, d => getSourceFileOfNode(d) !== ctxSrc)) && !some(getPropertiesOfType(typeToSerialize), p => isLateBoundName(p.escapedName)) && !some(getPropertiesOfType(typeToSerialize), p => some(p.declarations, d => getSourceFileOfNode(d) !== ctxSrc)) && - every(getPropertiesOfType(typeToSerialize), p => isIdentifierText(symbolName(p), languageVersion) && !isStringAKeyword(symbolName(p))); + every(getPropertiesOfType(typeToSerialize), p => isIdentifierText(symbolName(p), languageVersion)); } function makeSerializePropertySymbol(createProperty: ( diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index 00d01ec950809..5e9ee6b0264da 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -1180,16 +1180,35 @@ namespace ts { fakespace.parent = enclosingDeclaration as SourceFile | NamespaceDeclaration; fakespace.locals = createSymbolTable(props); fakespace.symbol = props[0].parent!; - const declarations = mapDefined(props, p => { + const exportMappings: [Identifier, string][] = []; + const declarations: (VariableStatement | ExportDeclaration)[] = mapDefined(props, p => { if (!isPropertyAccessExpression(p.valueDeclaration)) { return undefined; // TODO GH#33569: Handle element access expressions that created late bound names (rather than silently omitting them) } getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration); const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags, symbolTracker); getSymbolAccessibilityDiagnostic = oldDiag; - const varDecl = createVariableDeclaration(unescapeLeadingUnderscores(p.escapedName), type, /*initializer*/ undefined); - return createVariableStatement(/*modifiers*/ undefined, createVariableDeclarationList([varDecl])); + const nameStr = unescapeLeadingUnderscores(p.escapedName); + const isNonContextualKeywordName = isStringANonContextualKeyword(nameStr); + const name = isNonContextualKeywordName ? getGeneratedNameForNode(p.valueDeclaration) : createIdentifier(nameStr); + if (isNonContextualKeywordName) { + exportMappings.push([name, nameStr]); + } + const varDecl = createVariableDeclaration(name, type, /*initializer*/ undefined); + return createVariableStatement(isNonContextualKeywordName ? undefined : [createToken(SyntaxKind.ExportKeyword)], createVariableDeclarationList([varDecl])); }); + if (!exportMappings.length) { + forEach(declarations, d => d.modifiers = undefined); + } + else { + declarations.push(createExportDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, + createNamedExports(map(exportMappings, ([gen, exp]) => { + return createExportSpecifier(gen, exp); + })) + )); + } const namespaceDecl = createModuleDeclaration(/*decorators*/ undefined, ensureModifiers(input), input.name!, createModuleBlock(declarations), NodeFlags.Namespace); if (!hasEffectiveModifier(clean, ModifierFlags.Default)) { diff --git a/tests/baselines/reference/declarationEmitFunctionKeywordProp.js b/tests/baselines/reference/declarationEmitFunctionKeywordProp.js new file mode 100644 index 0000000000000..38cd07f1ffe66 --- /dev/null +++ b/tests/baselines/reference/declarationEmitFunctionKeywordProp.js @@ -0,0 +1,40 @@ +//// [declarationEmitFunctionKeywordProp.ts] +function foo() {} +foo.null = true; + +function bar() {} +bar.async = true; +bar.normal = false; + +function baz() {} +baz.class = true; +baz.normal = false; + +//// [declarationEmitFunctionKeywordProp.js] +function foo() { } +foo["null"] = true; +function bar() { } +bar.async = true; +bar.normal = false; +function baz() { } +baz["class"] = true; +baz.normal = false; + + +//// [declarationEmitFunctionKeywordProp.d.ts] +declare function foo(): void; +declare namespace foo { + var _a: boolean; + export { _a as null }; +} +declare function bar(): void; +declare namespace bar { + var async: boolean; + var normal: boolean; +} +declare function baz(): void; +declare namespace baz { + var _a: boolean; + export var normal: boolean; + export { _a as class }; +} diff --git a/tests/baselines/reference/declarationEmitFunctionKeywordProp.symbols b/tests/baselines/reference/declarationEmitFunctionKeywordProp.symbols new file mode 100644 index 0000000000000..bc426ecaea36b --- /dev/null +++ b/tests/baselines/reference/declarationEmitFunctionKeywordProp.symbols @@ -0,0 +1,35 @@ +=== tests/cases/compiler/declarationEmitFunctionKeywordProp.ts === +function foo() {} +>foo : Symbol(foo, Decl(declarationEmitFunctionKeywordProp.ts, 0, 0), Decl(declarationEmitFunctionKeywordProp.ts, 0, 17)) + +foo.null = true; +>foo.null : Symbol(foo.null, Decl(declarationEmitFunctionKeywordProp.ts, 0, 17)) +>foo : Symbol(foo, Decl(declarationEmitFunctionKeywordProp.ts, 0, 0), Decl(declarationEmitFunctionKeywordProp.ts, 0, 17)) +>null : Symbol(foo.null, Decl(declarationEmitFunctionKeywordProp.ts, 0, 17)) + +function bar() {} +>bar : Symbol(bar, Decl(declarationEmitFunctionKeywordProp.ts, 1, 16), Decl(declarationEmitFunctionKeywordProp.ts, 3, 17), Decl(declarationEmitFunctionKeywordProp.ts, 4, 17)) + +bar.async = true; +>bar.async : Symbol(bar.async, Decl(declarationEmitFunctionKeywordProp.ts, 3, 17)) +>bar : Symbol(bar, Decl(declarationEmitFunctionKeywordProp.ts, 1, 16), Decl(declarationEmitFunctionKeywordProp.ts, 3, 17), Decl(declarationEmitFunctionKeywordProp.ts, 4, 17)) +>async : Symbol(bar.async, Decl(declarationEmitFunctionKeywordProp.ts, 3, 17)) + +bar.normal = false; +>bar.normal : Symbol(bar.normal, Decl(declarationEmitFunctionKeywordProp.ts, 4, 17)) +>bar : Symbol(bar, Decl(declarationEmitFunctionKeywordProp.ts, 1, 16), Decl(declarationEmitFunctionKeywordProp.ts, 3, 17), Decl(declarationEmitFunctionKeywordProp.ts, 4, 17)) +>normal : Symbol(bar.normal, Decl(declarationEmitFunctionKeywordProp.ts, 4, 17)) + +function baz() {} +>baz : Symbol(baz, Decl(declarationEmitFunctionKeywordProp.ts, 5, 19), Decl(declarationEmitFunctionKeywordProp.ts, 7, 17), Decl(declarationEmitFunctionKeywordProp.ts, 8, 17)) + +baz.class = true; +>baz.class : Symbol(baz.class, Decl(declarationEmitFunctionKeywordProp.ts, 7, 17)) +>baz : Symbol(baz, Decl(declarationEmitFunctionKeywordProp.ts, 5, 19), Decl(declarationEmitFunctionKeywordProp.ts, 7, 17), Decl(declarationEmitFunctionKeywordProp.ts, 8, 17)) +>class : Symbol(baz.class, Decl(declarationEmitFunctionKeywordProp.ts, 7, 17)) + +baz.normal = false; +>baz.normal : Symbol(baz.normal, Decl(declarationEmitFunctionKeywordProp.ts, 8, 17)) +>baz : Symbol(baz, Decl(declarationEmitFunctionKeywordProp.ts, 5, 19), Decl(declarationEmitFunctionKeywordProp.ts, 7, 17), Decl(declarationEmitFunctionKeywordProp.ts, 8, 17)) +>normal : Symbol(baz.normal, Decl(declarationEmitFunctionKeywordProp.ts, 8, 17)) + diff --git a/tests/baselines/reference/declarationEmitFunctionKeywordProp.types b/tests/baselines/reference/declarationEmitFunctionKeywordProp.types new file mode 100644 index 0000000000000..c3edb30359734 --- /dev/null +++ b/tests/baselines/reference/declarationEmitFunctionKeywordProp.types @@ -0,0 +1,45 @@ +=== tests/cases/compiler/declarationEmitFunctionKeywordProp.ts === +function foo() {} +>foo : typeof foo + +foo.null = true; +>foo.null = true : true +>foo.null : boolean +>foo : typeof foo +>null : boolean +>true : true + +function bar() {} +>bar : typeof bar + +bar.async = true; +>bar.async = true : true +>bar.async : boolean +>bar : typeof bar +>async : boolean +>true : true + +bar.normal = false; +>bar.normal = false : false +>bar.normal : boolean +>bar : typeof bar +>normal : boolean +>false : false + +function baz() {} +>baz : typeof baz + +baz.class = true; +>baz.class = true : true +>baz.class : boolean +>baz : typeof baz +>class : boolean +>true : true + +baz.normal = false; +>baz.normal = false : false +>baz.normal : boolean +>baz : typeof baz +>normal : boolean +>false : false + diff --git a/tests/baselines/reference/jsDeclarationsExportAssignmentWithKeywordName.js b/tests/baselines/reference/jsDeclarationsExportAssignmentWithKeywordName.js index 04aa01e247e21..4497c20622342 100644 --- a/tests/baselines/reference/jsDeclarationsExportAssignmentWithKeywordName.js +++ b/tests/baselines/reference/jsDeclarationsExportAssignmentWithKeywordName.js @@ -20,11 +20,9 @@ module.exports = { //// [index.d.ts] -declare const _exports: { - extends: string; - more: { - others: string[]; - }; - x: number; -}; -export = _exports; +export var x: number; +declare const _extends: string; +export declare namespace more { + export const others: string[]; +} +export { _extends as extends }; diff --git a/tests/baselines/reference/jsDeclarationsFunctionKeywordProp.js b/tests/baselines/reference/jsDeclarationsFunctionKeywordProp.js new file mode 100644 index 0000000000000..104a853f2af85 --- /dev/null +++ b/tests/baselines/reference/jsDeclarationsFunctionKeywordProp.js @@ -0,0 +1,41 @@ +//// [source.js] +function foo() {} +foo.null = true; + +function bar() {} +bar.async = true; +bar.normal = false; + +function baz() {} +baz.class = true; +baz.normal = false; + +//// [source.js] +function foo() { } +foo.null = true; +function bar() { } +bar.async = true; +bar.normal = false; +function baz() { } +baz.class = true; +baz.normal = false; + + +//// [source.d.ts] +declare function foo(): void; +declare namespace foo { + const _null: boolean; + export { _null as null }; +} +declare function bar(): void; +declare namespace bar { + const async: boolean; + const normal: boolean; +} +declare function baz(): void; +declare namespace baz { + const _class: boolean; + export { _class as class }; + const normal_1: boolean; + export { normal_1 as normal }; +} diff --git a/tests/baselines/reference/jsDeclarationsFunctionKeywordProp.symbols b/tests/baselines/reference/jsDeclarationsFunctionKeywordProp.symbols new file mode 100644 index 0000000000000..37cd43a8a1c31 --- /dev/null +++ b/tests/baselines/reference/jsDeclarationsFunctionKeywordProp.symbols @@ -0,0 +1,35 @@ +=== tests/cases/conformance/jsdoc/declarations/source.js === +function foo() {} +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17)) + +foo.null = true; +>foo.null : Symbol(foo.null, Decl(source.js, 0, 17)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17)) +>null : Symbol(foo.null, Decl(source.js, 0, 17)) + +function bar() {} +>bar : Symbol(bar, Decl(source.js, 1, 16), Decl(source.js, 3, 17), Decl(source.js, 4, 17)) + +bar.async = true; +>bar.async : Symbol(bar.async, Decl(source.js, 3, 17)) +>bar : Symbol(bar, Decl(source.js, 1, 16), Decl(source.js, 3, 17), Decl(source.js, 4, 17)) +>async : Symbol(bar.async, Decl(source.js, 3, 17)) + +bar.normal = false; +>bar.normal : Symbol(bar.normal, Decl(source.js, 4, 17)) +>bar : Symbol(bar, Decl(source.js, 1, 16), Decl(source.js, 3, 17), Decl(source.js, 4, 17)) +>normal : Symbol(bar.normal, Decl(source.js, 4, 17)) + +function baz() {} +>baz : Symbol(baz, Decl(source.js, 5, 19), Decl(source.js, 7, 17), Decl(source.js, 8, 17)) + +baz.class = true; +>baz.class : Symbol(baz.class, Decl(source.js, 7, 17)) +>baz : Symbol(baz, Decl(source.js, 5, 19), Decl(source.js, 7, 17), Decl(source.js, 8, 17)) +>class : Symbol(baz.class, Decl(source.js, 7, 17)) + +baz.normal = false; +>baz.normal : Symbol(baz.normal, Decl(source.js, 8, 17)) +>baz : Symbol(baz, Decl(source.js, 5, 19), Decl(source.js, 7, 17), Decl(source.js, 8, 17)) +>normal : Symbol(baz.normal, Decl(source.js, 8, 17)) + diff --git a/tests/baselines/reference/jsDeclarationsFunctionKeywordProp.types b/tests/baselines/reference/jsDeclarationsFunctionKeywordProp.types new file mode 100644 index 0000000000000..484040c311b8a --- /dev/null +++ b/tests/baselines/reference/jsDeclarationsFunctionKeywordProp.types @@ -0,0 +1,45 @@ +=== tests/cases/conformance/jsdoc/declarations/source.js === +function foo() {} +>foo : typeof foo + +foo.null = true; +>foo.null = true : true +>foo.null : boolean +>foo : typeof foo +>null : boolean +>true : true + +function bar() {} +>bar : typeof bar + +bar.async = true; +>bar.async = true : true +>bar.async : boolean +>bar : typeof bar +>async : boolean +>true : true + +bar.normal = false; +>bar.normal = false : false +>bar.normal : boolean +>bar : typeof bar +>normal : boolean +>false : false + +function baz() {} +>baz : typeof baz + +baz.class = true; +>baz.class = true : true +>baz.class : boolean +>baz : typeof baz +>class : boolean +>true : true + +baz.normal = false; +>baz.normal = false : false +>baz.normal : boolean +>baz : typeof baz +>normal : boolean +>false : false + diff --git a/tests/cases/compiler/declarationEmitFunctionKeywordProp.ts b/tests/cases/compiler/declarationEmitFunctionKeywordProp.ts new file mode 100644 index 0000000000000..c2557e4a8f536 --- /dev/null +++ b/tests/cases/compiler/declarationEmitFunctionKeywordProp.ts @@ -0,0 +1,11 @@ +// @declaration: true +function foo() {} +foo.null = true; + +function bar() {} +bar.async = true; +bar.normal = false; + +function baz() {} +baz.class = true; +baz.normal = false; \ No newline at end of file diff --git a/tests/cases/conformance/jsdoc/declarations/jsDeclarationsFunctionKeywordProp.ts b/tests/cases/conformance/jsdoc/declarations/jsDeclarationsFunctionKeywordProp.ts new file mode 100644 index 0000000000000..8bb81dda6e33e --- /dev/null +++ b/tests/cases/conformance/jsdoc/declarations/jsDeclarationsFunctionKeywordProp.ts @@ -0,0 +1,16 @@ +// @allowJs: true +// @checkJs: true +// @target: es5 +// @outDir: ./out +// @declaration: true +// @filename: source.js +function foo() {} +foo.null = true; + +function bar() {} +bar.async = true; +bar.normal = false; + +function baz() {} +baz.class = true; +baz.normal = false; \ No newline at end of file From f668e48a98ef5605dbb245d2de4572312eeb6004 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 8 Jun 2020 12:41:26 -0700 Subject: [PATCH 3/3] Add exhaustive keyword emit test for js declaration emitter and fix it up --- src/compiler/checker.ts | 166 +++--- .../jsDeclarationsClassExtendsVisibility.js | 4 +- .../reference/jsDeclarationsClassStatic.js | 4 +- .../reference/jsDeclarationsEnumTag.js | 18 +- ...ExportAssignmentExpressionPlusSecondary.js | 6 +- ...arationsExportAssignmentWithKeywordName.js | 2 +- .../jsDeclarationsExportDefinePropertyEmit.js | 4 +- ...arationsExportDoubleAssignmentInClosure.js | 2 +- .../jsDeclarationsExportSubAssignments.js | 4 +- ...clarationsFunctionKeywordPropExhaustive.js | 295 ++++++++++ ...tionsFunctionKeywordPropExhaustive.symbols | 396 +++++++++++++ ...rationsFunctionKeywordPropExhaustive.types | 552 ++++++++++++++++++ .../reference/jsDeclarationsFunctions.js | 2 +- .../reference/jsDeclarationsFunctionsCjs.js | 2 +- .../jsDeclarationsReactComponents.js | 18 +- ...arationsWithDefaultAsNamespaceLikeMerge.js | 4 +- .../reference/jsdocImplements_class.js | 2 +- ...xDeclarationsWithEsModuleInteropNoCrash.js | 2 +- .../moduleExportsElementAccessAssignment.js | 4 +- ...based-projects-and-emits-them-correctly.js | 4 +- ...ved-json-files-and-emits-them-correctly.js | 2 +- .../files-containing-json-file.js | 2 +- ...ting-json-module-from-project-reference.js | 2 +- .../initial-build/include-and-files.js | 2 +- ...r-include-and-file-name-matches-ts-file.js | 2 +- ...nclude-of-json-along-with-other-include.js | 2 +- .../initial-build/include-only.js | 2 +- .../initial-build/sourcemap.js | 2 +- .../initial-build/without-outDir.js | 2 +- ...clarationsFunctionKeywordPropExhaustive.ts | 88 +++ 30 files changed, 1476 insertions(+), 121 deletions(-) create mode 100644 tests/baselines/reference/jsDeclarationsFunctionKeywordPropExhaustive.js create mode 100644 tests/baselines/reference/jsDeclarationsFunctionKeywordPropExhaustive.symbols create mode 100644 tests/baselines/reference/jsDeclarationsFunctionKeywordPropExhaustive.types create mode 100644 tests/cases/conformance/jsdoc/declarations/jsDeclarationsFunctionKeywordPropExhaustive.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 1fb889bef0b3f..16bf00031ad1e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5832,8 +5832,11 @@ namespace ts { // Pass 1: Flatten `export namespace _exports {} export = _exports;` so long as the `export=` only points at a single namespace declaration if (!find(statements, s => s !== ns && nodeHasName(s, ns.name as Identifier))) { results = []; + // If the namespace contains no export assignments or declarations, and no declarations flagged with `export`, then _everything_ is exported - + // to respect this as the top level, we need to add an `export` modifier to everything + const mixinExportFlag = !some(ns.body.statements, s => hasSyntacticModifier(s, ModifierFlags.Export) || isExportAssignment(s) || isExportDeclaration(s)); forEach(ns.body.statements, s => { - addResult(s, ModifierFlags.None); // Recalculates the ambient (and export, if applicable from above) flag + addResult(s, mixinExportFlag ? ModifierFlags.Export : ModifierFlags.None); // Recalculates the ambient (and export, if applicable from above) flag }); statements = [...filter(statements, s => s !== ns && s !== exportAssignment), ...results]; } @@ -5936,6 +5939,13 @@ namespace ts { statement.modifierFlagsCache = 0; } + function removeExportModifier(statement: Statement) { + const flags = getEffectiveModifierFlags(statement) & ~ModifierFlags.Export; + statement.modifiers = createNodeArray(createModifiersFromModifierFlags(flags)); + statement.modifierFlagsCache = 0; + return statement; + } + function visitSymbolTable(symbolTable: SymbolTable, suppressNewPrivateContext?: boolean, propertyAsAlias?: boolean) { const oldDeferredPrivates = deferredPrivates; if (!suppressNewPrivateContext) { @@ -5993,7 +6003,7 @@ namespace ts { // TODO: Issue error via symbol tracker? return; // If we need to emit a private with a keyword name, we're done for, since something else will try to refer to it by that name } - const needsPostExportDefault = isDefault && !!( + let needsPostExportDefault = isDefault && !!( symbol.flags & SymbolFlags.ExportDoesNotSupportDefaultModifier || (symbol.flags & SymbolFlags.Function && length(getPropertiesOfType(getTypeOfSymbol(symbol)))) ) && !(symbol.flags & SymbolFlags.Alias); // An alias symbol should preclude needing to make an alias ourselves @@ -6020,8 +6030,70 @@ namespace ts { && !(symbol.flags & SymbolFlags.Prototype) && !(symbol.flags & SymbolFlags.Class) && !isConstMergedWithNSPrintableAsSignatureMerge) { - serializeVariableOrProperty(symbol, symbolName, isPrivate, needsPostExportDefault, propertyAsAlias, modifierFlags); - needsExportDeclaration = false; + if (propertyAsAlias) { + const createdExport = serializeMaybeAliasAssignment(symbol); + if (createdExport) { + needsExportDeclaration = false; + needsPostExportDefault = false; + } + } + else { + const type = getTypeOfSymbol(symbol); + const localName = getInternalSymbolName(symbol, symbolName); + if (!(symbol.flags & SymbolFlags.Function) && isTypeRepresentableAsFunctionNamespaceMerge(type, symbol)) { + // If the type looks like a function declaration + ns could represent it, and it's type is sourced locally, rewrite it into a function declaration + ns + serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags); + } + else { + // A Class + Property merge is made for a `module.exports.Member = class {}`, and it doesn't serialize well as either a class _or_ a property symbol - in fact, _it behaves like an alias!_ + // `var` is `FunctionScopedVariable`, `const` and `let` are `BlockScopedVariable`, and `module.exports.thing =` is `Property` + const flags = !(symbol.flags & SymbolFlags.BlockScopedVariable) ? undefined + : isConstVariable(symbol) ? NodeFlags.Const + : NodeFlags.Let; + const name = (needsPostExportDefault || !(symbol.flags & SymbolFlags.Property)) ? localName : getUnusedName(localName, symbol); + let textRange: Node | undefined = symbol.declarations && find(symbol.declarations, d => isVariableDeclaration(d)); + if (textRange && isVariableDeclarationList(textRange.parent) && textRange.parent.declarations.length === 1) { + textRange = textRange.parent.parent; + } + const statement = setTextRange(createVariableStatement(/*modifiers*/ undefined, createVariableDeclarationList([ + createVariableDeclaration(name, serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled)) + ], flags)), textRange); + addResult(statement, name !== localName ? modifierFlags & ~ModifierFlags.Export : modifierFlags); + if (name !== localName && !isPrivate) { + // We rename the variable declaration we generate for Property symbols since they may have a name which + // conflicts with a local declaration. For example, given input: + // ``` + // function g() {} + // module.exports.g = g + // ``` + // In such a situation, we have a local variable named `g`, and a separate exported variable named `g`. + // Naively, we would emit + // ``` + // function g() {} + // export const g: typeof g; + // ``` + // That's obviously incorrect - the `g` in the type annotation needs to refer to the local `g`, but + // the export declaration shadows it. + // To work around that, we instead write + // ``` + // function g() {} + // const g_1: typeof g; + // export { g_1 as g }; + // ``` + // To create an export named `g` that does _not_ shadow the local `g` + addResult( + createExportDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, + createNamedExports([createExportSpecifier(name, localName)]) + ), + ModifierFlags.None + ); + needsExportDeclaration = false; + needsPostExportDefault = false; + } + } + } } if (symbol.flags & SymbolFlags.Enum) { serializeEnum(symbol, symbolName, modifierFlags); @@ -6087,15 +6159,15 @@ namespace ts { function addResult(node: Statement, additionalModifierFlags: ModifierFlags) { let newModifierFlags: ModifierFlags = ModifierFlags.None; if (additionalModifierFlags & ModifierFlags.Export && - enclosingDeclaration && - isExportingScope(enclosingDeclaration) && + context.enclosingDeclaration && + (isExportingScope(context.enclosingDeclaration) || isModuleDeclaration(context.enclosingDeclaration)) && canHaveExportModifier(node) ) { // Classes, namespaces, variables, functions, interfaces, and types should all be `export`ed in a module context if not private newModifierFlags |= ModifierFlags.Export; } if (addingDeclare && !(newModifierFlags & ModifierFlags.Export) && - (!enclosingDeclaration || !(enclosingDeclaration.flags & NodeFlags.Ambient)) && + (!context.enclosingDeclaration || !(context.enclosingDeclaration.flags & NodeFlags.Ambient)) && (isEnumDeclaration(node) || isVariableStatement(node) || isFunctionDeclaration(node) || isClassDeclaration(node) || isModuleDeclaration(node))) { // Classes, namespaces, variables, enums, and functions all need `declare` modifiers to be valid in a declaration file top-level scope newModifierFlags |= ModifierFlags.Ambient; @@ -6214,67 +6286,6 @@ namespace ts { ), modifierFlags); } - function serializeVariableOrProperty(symbol: Symbol, symbolName: string, isPrivate: boolean, needsPostExportDefault: boolean, propertyAsAlias: boolean | undefined, modifierFlags: ModifierFlags) { - if (propertyAsAlias) { - serializeMaybeAliasAssignment(symbol); - } - else { - const type = getTypeOfSymbol(symbol); - const localName = getInternalSymbolName(symbol, symbolName); - if (!(symbol.flags & SymbolFlags.Function) && isTypeRepresentableAsFunctionNamespaceMerge(type, symbol)) { - // If the type looks like a function declaration + ns could represent it, and it's type is sourced locally, rewrite it into a function declaration + ns - serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags); - } - else { - // A Class + Property merge is made for a `module.exports.Member = class {}`, and it doesn't serialize well as either a class _or_ a property symbol - in fact, _it behaves like an alias!_ - // `var` is `FunctionScopedVariable`, `const` and `let` are `BlockScopedVariable`, and `module.exports.thing =` is `Property` - const flags = !(symbol.flags & SymbolFlags.BlockScopedVariable) ? undefined - : isConstVariable(symbol) ? NodeFlags.Const - : NodeFlags.Let; - const name = (needsPostExportDefault || !(symbol.flags & SymbolFlags.Property)) ? localName : getUnusedName(localName, symbol); - let textRange: Node | undefined = symbol.declarations && find(symbol.declarations, d => isVariableDeclaration(d)); - if (textRange && isVariableDeclarationList(textRange.parent) && textRange.parent.declarations.length === 1) { - textRange = textRange.parent.parent; - } - const statement = setTextRange(createVariableStatement(/*modifiers*/ undefined, createVariableDeclarationList([ - createVariableDeclaration(name, serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled)) - ], flags)), textRange); - addResult(statement, name !== localName ? modifierFlags & ~ModifierFlags.Export : modifierFlags); - if (name !== localName && !isPrivate) { - // We rename the variable declaration we generate for Property symbols since they may have a name which - // conflicts with a local declaration. For example, given input: - // ``` - // function g() {} - // module.exports.g = g - // ``` - // In such a situation, we have a local variable named `g`, and a separate exported variable named `g`. - // Naively, we would emit - // ``` - // function g() {} - // export const g: typeof g; - // ``` - // That's obviously incorrect - the `g` in the type annotation needs to refer to the local `g`, but - // the export declaration shadows it. - // To work around that, we instead write - // ``` - // function g() {} - // const g_1: typeof g; - // export { g_1 as g }; - // ``` - // To create an export named `g` that does _not_ shadow the local `g` - addResult( - createExportDeclaration( - /*decorators*/ undefined, - /*modifiers*/ undefined, - createNamedExports([createExportSpecifier(name, localName)]) - ), - ModifierFlags.None - ); - } - } - } - } - function serializeAsFunctionNamespaceMerge(type: Type, symbol: Symbol, localName: string, modifierFlags: ModifierFlags) { const signatures = getSignaturesOfType(type, SignatureKind.Call); for (const sig of signatures) { @@ -6337,7 +6348,13 @@ namespace ts { fakespace.parent = undefined!; fakespace.locals = undefined!; fakespace.symbol = undefined!; - fakespace.body = createModuleBlock(declarations); + const defaultReplaced = map(declarations, d => isExportAssignment(d) && !d.isExportEquals && isIdentifier(d.expression) ? createExportDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, + createNamedExports([createExportSpecifier(d.expression, createIdentifier(InternalSymbolName.Default))]) + ) : d); + const exportModifierStripped = every(defaultReplaced, d => hasSyntacticModifier(d, ModifierFlags.Export)) ? map(defaultReplaced, removeExportModifier) : defaultReplaced; + fakespace.body = createModuleBlock(exportModifierStripped); addResult(fakespace, modifierFlags); // namespaces can never be default exported } } @@ -6538,9 +6555,12 @@ namespace ts { ), ModifierFlags.None); } - function serializeMaybeAliasAssignment(symbol: Symbol) { + /** + * Returns `true` if an export assignment or declaration was produced for the symbol + */ + function serializeMaybeAliasAssignment(symbol: Symbol): boolean { if (symbol.flags & SymbolFlags.Prototype) { - return; + return false; } const name = unescapeLeadingUnderscores(symbol.escapedName); const isExportEquals = name === InternalSymbolName.ExportEquals; @@ -6600,6 +6620,7 @@ namespace ts { } } context.tracker.trackSymbol = oldTrack; + return true; } else { // serialize as an anonymous property declaration @@ -6624,10 +6645,13 @@ namespace ts { isExportEquals, createIdentifier(varName) )); + return true; } else if (name !== varName) { serializeExportSpecifier(name, varName); + return true; } + return false; } } diff --git a/tests/baselines/reference/jsDeclarationsClassExtendsVisibility.js b/tests/baselines/reference/jsDeclarationsClassExtendsVisibility.js index a65f487a81a54..9eb48e8d60379 100644 --- a/tests/baselines/reference/jsDeclarationsClassExtendsVisibility.js +++ b/tests/baselines/reference/jsDeclarationsClassExtendsVisibility.js @@ -63,6 +63,6 @@ declare namespace Foo { export { Strings }; } declare namespace Strings { - export const a: string; - export const b: string; + const a: string; + const b: string; } diff --git a/tests/baselines/reference/jsDeclarationsClassStatic.js b/tests/baselines/reference/jsDeclarationsClassStatic.js index 4af5f3fd83e98..dcb8938ff6e97 100644 --- a/tests/baselines/reference/jsDeclarationsClassStatic.js +++ b/tests/baselines/reference/jsDeclarationsClassStatic.js @@ -63,8 +63,8 @@ declare namespace Handler { } declare function statische(): void; declare namespace Strings { - export const a: string; - export const b: string; + const a: string; + const b: string; } type HandlerOptions = { /** diff --git a/tests/baselines/reference/jsDeclarationsEnumTag.js b/tests/baselines/reference/jsDeclarationsEnumTag.js index 80019f4b45d6b..7dedb929011aa 100644 --- a/tests/baselines/reference/jsDeclarationsEnumTag.js +++ b/tests/baselines/reference/jsDeclarationsEnumTag.js @@ -113,19 +113,19 @@ export function consume(t: Target, s: Second, f: Fs): void; export function ff(s: string): any; export type Target = string; export namespace Target { - export const START: string; - export const MIDDLE: string; - export const END: string; - export const OK_I_GUESS: number; + const START: string; + const MIDDLE: string; + const END: string; + const OK_I_GUESS: number; } export type Second = number; export namespace Second { - export const OK: number; - export const FINE: number; + const OK: number; + const FINE: number; } export type Fs = (arg0: number) => number; export namespace Fs { - export function ADD1(n: any): any; - export function ID(n: any): any; - export function SUB1(n: any): number; + function ADD1(n: any): any; + function ID(n: any): any; + function SUB1(n: any): number; } diff --git a/tests/baselines/reference/jsDeclarationsExportAssignmentExpressionPlusSecondary.js b/tests/baselines/reference/jsDeclarationsExportAssignmentExpressionPlusSecondary.js index 54bc1f49bb2f2..b0ea33b822197 100644 --- a/tests/baselines/reference/jsDeclarationsExportAssignmentExpressionPlusSecondary.js +++ b/tests/baselines/reference/jsDeclarationsExportAssignmentExpressionPlusSecondary.js @@ -30,11 +30,11 @@ module.exports.Strings = Strings; //// [index.d.ts] export namespace Strings { - export const a: string; - export const b: string; + const a: string; + const b: string; } export declare const thing: string; export declare const also: string; export declare namespace desc { - export const item: string; + const item: string; } diff --git a/tests/baselines/reference/jsDeclarationsExportAssignmentWithKeywordName.js b/tests/baselines/reference/jsDeclarationsExportAssignmentWithKeywordName.js index 4497c20622342..ced36f2f1738d 100644 --- a/tests/baselines/reference/jsDeclarationsExportAssignmentWithKeywordName.js +++ b/tests/baselines/reference/jsDeclarationsExportAssignmentWithKeywordName.js @@ -23,6 +23,6 @@ module.exports = { export var x: number; declare const _extends: string; export declare namespace more { - export const others: string[]; + const others: string[]; } export { _extends as extends }; diff --git a/tests/baselines/reference/jsDeclarationsExportDefinePropertyEmit.js b/tests/baselines/reference/jsDeclarationsExportDefinePropertyEmit.js index cac7cda56c549..d7c256a545eed 100644 --- a/tests/baselines/reference/jsDeclarationsExportDefinePropertyEmit.js +++ b/tests/baselines/reference/jsDeclarationsExportDefinePropertyEmit.js @@ -114,7 +114,7 @@ Object.defineProperty(module.exports, "j", { value: function j() { } }); export function a(): void; export function b(): void; export namespace b { - export const cat: string; + const cat: string; } /** * @param {number} a @@ -139,7 +139,7 @@ export namespace f { * @template T * @param {T} a */ - export function self(a: T): T; + function self(a: T): T; } /** * @param {{x: string}} a diff --git a/tests/baselines/reference/jsDeclarationsExportDoubleAssignmentInClosure.js b/tests/baselines/reference/jsDeclarationsExportDoubleAssignmentInClosure.js index 93bec6bfbecc6..bb5a076f1bcb4 100644 --- a/tests/baselines/reference/jsDeclarationsExportDoubleAssignmentInClosure.js +++ b/tests/baselines/reference/jsDeclarationsExportDoubleAssignmentInClosure.js @@ -20,6 +20,6 @@ function foo() { //// [index.d.ts] declare function _exports(o: any): any; declare namespace _exports { - export const methods: any; + const methods: any; } export = _exports; diff --git a/tests/baselines/reference/jsDeclarationsExportSubAssignments.js b/tests/baselines/reference/jsDeclarationsExportSubAssignments.js index 3e9ee20f4b67f..88f9555a0794c 100644 --- a/tests/baselines/reference/jsDeclarationsExportSubAssignments.js +++ b/tests/baselines/reference/jsDeclarationsExportSubAssignments.js @@ -29,6 +29,6 @@ declare namespace Foo { export { Strings }; } declare namespace Strings { - export const a: string; - export const b: string; + const a: string; + const b: string; } diff --git a/tests/baselines/reference/jsDeclarationsFunctionKeywordPropExhaustive.js b/tests/baselines/reference/jsDeclarationsFunctionKeywordPropExhaustive.js new file mode 100644 index 0000000000000..a79090418d30f --- /dev/null +++ b/tests/baselines/reference/jsDeclarationsFunctionKeywordPropExhaustive.js @@ -0,0 +1,295 @@ +//// [source.js] +function foo() {} +// properties +foo.x = 1; +foo.y = 1; + +// keywords +foo.break = 1; +foo.case = 1; +foo.catch = 1; +foo.class = 1; +foo.const = 1; +foo.continue = 1; +foo.debugger = 1; +foo.default = 1; +foo.delete = 1; +foo.do = 1; +foo.else = 1; +foo.enum = 1; +foo.export = 1; +foo.extends = 1; +foo.false = 1; +foo.finally = 1; +foo.for = 1; +foo.function = 1; +foo.if = 1; +foo.import = 1; +foo.in = 1; +foo.instanceof = 1; +foo.new = 1; +foo.null = 1; +foo.return = 1; +foo.super = 1; +foo.switch = 1; +foo.this = 1; +foo.throw = 1; +foo.true = 1; +foo.try = 1; +foo.typeof = 1; +foo.var = 1; +foo.void = 1; +foo.while = 1; +foo.with = 1; +foo.implements = 1; +foo.interface = 1; +foo.let = 1; +foo.package = 1; +foo.private = 1; +foo.protected = 1; +foo.public = 1; +foo.static = 1; +foo.yield = 1; +foo.abstract = 1; +foo.as = 1; +foo.asserts = 1; +foo.any = 1; +foo.async = 1; +foo.await = 1; +foo.boolean = 1; +foo.constructor = 1; +foo.declare = 1; +foo.get = 1; +foo.infer = 1; +foo.is = 1; +foo.keyof = 1; +foo.module = 1; +foo.namespace = 1; +foo.never = 1; +foo.readonly = 1; +foo.require = 1; +foo.number = 1; +foo.object = 1; +foo.set = 1; +foo.string = 1; +foo.symbol = 1; +foo.type = 1; +foo.undefined = 1; +foo.unique = 1; +foo.unknown = 1; +foo.from = 1; +foo.global = 1; +foo.bigint = 1; +foo.of = 1; + +//// [source.js] +function foo() { } +// properties +foo.x = 1; +foo.y = 1; +// keywords +foo.break = 1; +foo.case = 1; +foo.catch = 1; +foo.class = 1; +foo.const = 1; +foo.continue = 1; +foo.debugger = 1; +foo.default = 1; +foo.delete = 1; +foo.do = 1; +foo.else = 1; +foo.enum = 1; +foo.export = 1; +foo.extends = 1; +foo.false = 1; +foo.finally = 1; +foo.for = 1; +foo.function = 1; +foo.if = 1; +foo.import = 1; +foo.in = 1; +foo.instanceof = 1; +foo.new = 1; +foo.null = 1; +foo.return = 1; +foo.super = 1; +foo.switch = 1; +foo.this = 1; +foo.throw = 1; +foo.true = 1; +foo.try = 1; +foo.typeof = 1; +foo.var = 1; +foo.void = 1; +foo.while = 1; +foo.with = 1; +foo.implements = 1; +foo.interface = 1; +foo.let = 1; +foo.package = 1; +foo.private = 1; +foo.protected = 1; +foo.public = 1; +foo.static = 1; +foo.yield = 1; +foo.abstract = 1; +foo.as = 1; +foo.asserts = 1; +foo.any = 1; +foo.async = 1; +foo.await = 1; +foo.boolean = 1; +foo.constructor = 1; +foo.declare = 1; +foo.get = 1; +foo.infer = 1; +foo.is = 1; +foo.keyof = 1; +foo.module = 1; +foo.namespace = 1; +foo.never = 1; +foo.readonly = 1; +foo.require = 1; +foo.number = 1; +foo.object = 1; +foo.set = 1; +foo.string = 1; +foo.symbol = 1; +foo.type = 1; +foo.undefined = 1; +foo.unique = 1; +foo.unknown = 1; +foo.from = 1; +foo.global = 1; +foo.bigint = 1; +foo.of = 1; + + +//// [source.d.ts] +declare function foo(): void; +declare namespace foo { + export const x: number; + export const y: number; + const _break: number; + export { _break as break }; + const _case: number; + export { _case as case }; + const _catch: number; + export { _catch as catch }; + const _class: number; + export { _class as class }; + const _const: number; + export { _const as const }; + const _continue: number; + export { _continue as continue }; + const _debugger: number; + export { _debugger as debugger }; + const _default: number; + export { _default as default }; + const _delete: number; + export { _delete as delete }; + const _do: number; + export { _do as do }; + const _else: number; + export { _else as else }; + const _enum: number; + export { _enum as enum }; + const _export: number; + export { _export as export }; + const _extends: number; + export { _extends as extends }; + const _false: number; + export { _false as false }; + const _finally: number; + export { _finally as finally }; + const _for: number; + export { _for as for }; + const _function: number; + export { _function as function }; + const _if: number; + export { _if as if }; + const _import: number; + export { _import as import }; + const _in: number; + export { _in as in }; + const _instanceof: number; + export { _instanceof as instanceof }; + const _new: number; + export { _new as new }; + const _null: number; + export { _null as null }; + const _return: number; + export { _return as return }; + const _super: number; + export { _super as super }; + const _switch: number; + export { _switch as switch }; + const _this: number; + export { _this as this }; + const _throw: number; + export { _throw as throw }; + const _true: number; + export { _true as true }; + const _try: number; + export { _try as try }; + const _typeof: number; + export { _typeof as typeof }; + const _var: number; + export { _var as var }; + const _void: number; + export { _void as void }; + const _while: number; + export { _while as while }; + const _with: number; + export { _with as with }; + const _implements: number; + export { _implements as implements }; + const _interface: number; + export { _interface as interface }; + const _let: number; + export { _let as let }; + const _package: number; + export { _package as package }; + const _private: number; + export { _private as private }; + const _protected: number; + export { _protected as protected }; + const _public: number; + export { _public as public }; + const _static: number; + export { _static as static }; + const _yield: number; + export { _yield as yield }; + export const abstract: number; + export const as: number; + export const asserts: number; + export const any: number; + export const async: number; + export const await: number; + export const boolean: number; + export const constructor: number; + export const declare: number; + export const get: number; + export const infer: number; + export const is: number; + export const keyof: number; + export const module: number; + export const namespace: number; + export const never: number; + export const readonly: number; + export const require: number; + export const number: number; + export const object: number; + export const set: number; + export const string: number; + export const symbol: number; + export const type: number; + export const undefined: number; + export const unique: number; + export const unknown: number; + export const from: number; + export const global: number; + export const bigint: number; + export const of: number; +} diff --git a/tests/baselines/reference/jsDeclarationsFunctionKeywordPropExhaustive.symbols b/tests/baselines/reference/jsDeclarationsFunctionKeywordPropExhaustive.symbols new file mode 100644 index 0000000000000..cb05bbf125f7a --- /dev/null +++ b/tests/baselines/reference/jsDeclarationsFunctionKeywordPropExhaustive.symbols @@ -0,0 +1,396 @@ +=== tests/cases/conformance/jsdoc/declarations/source.js === +function foo() {} +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) + +// properties +foo.x = 1; +>foo.x : Symbol(foo.x, Decl(source.js, 0, 17)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>x : Symbol(foo.x, Decl(source.js, 0, 17)) + +foo.y = 1; +>foo.y : Symbol(foo.y, Decl(source.js, 2, 10)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>y : Symbol(foo.y, Decl(source.js, 2, 10)) + +// keywords +foo.break = 1; +>foo.break : Symbol(foo.break, Decl(source.js, 3, 10)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>break : Symbol(foo.break, Decl(source.js, 3, 10)) + +foo.case = 1; +>foo.case : Symbol(foo.case, Decl(source.js, 6, 14)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>case : Symbol(foo.case, Decl(source.js, 6, 14)) + +foo.catch = 1; +>foo.catch : Symbol(foo.catch, Decl(source.js, 7, 13)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>catch : Symbol(foo.catch, Decl(source.js, 7, 13)) + +foo.class = 1; +>foo.class : Symbol(foo.class, Decl(source.js, 8, 14)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>class : Symbol(foo.class, Decl(source.js, 8, 14)) + +foo.const = 1; +>foo.const : Symbol(foo.const, Decl(source.js, 9, 14)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>const : Symbol(foo.const, Decl(source.js, 9, 14)) + +foo.continue = 1; +>foo.continue : Symbol(foo.continue, Decl(source.js, 10, 14)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>continue : Symbol(foo.continue, Decl(source.js, 10, 14)) + +foo.debugger = 1; +>foo.debugger : Symbol(foo.debugger, Decl(source.js, 11, 17)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>debugger : Symbol(foo.debugger, Decl(source.js, 11, 17)) + +foo.default = 1; +>foo.default : Symbol(foo.default, Decl(source.js, 12, 17)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>default : Symbol(foo.default, Decl(source.js, 12, 17)) + +foo.delete = 1; +>foo.delete : Symbol(foo.delete, Decl(source.js, 13, 16)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>delete : Symbol(foo.delete, Decl(source.js, 13, 16)) + +foo.do = 1; +>foo.do : Symbol(foo.do, Decl(source.js, 14, 15)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>do : Symbol(foo.do, Decl(source.js, 14, 15)) + +foo.else = 1; +>foo.else : Symbol(foo.else, Decl(source.js, 15, 11)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>else : Symbol(foo.else, Decl(source.js, 15, 11)) + +foo.enum = 1; +>foo.enum : Symbol(foo.enum, Decl(source.js, 16, 13)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>enum : Symbol(foo.enum, Decl(source.js, 16, 13)) + +foo.export = 1; +>foo.export : Symbol(foo.export, Decl(source.js, 17, 13)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>export : Symbol(foo.export, Decl(source.js, 17, 13)) + +foo.extends = 1; +>foo.extends : Symbol(foo.extends, Decl(source.js, 18, 15)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>extends : Symbol(foo.extends, Decl(source.js, 18, 15)) + +foo.false = 1; +>foo.false : Symbol(foo.false, Decl(source.js, 19, 16)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>false : Symbol(foo.false, Decl(source.js, 19, 16)) + +foo.finally = 1; +>foo.finally : Symbol(foo.finally, Decl(source.js, 20, 14)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>finally : Symbol(foo.finally, Decl(source.js, 20, 14)) + +foo.for = 1; +>foo.for : Symbol(foo.for, Decl(source.js, 21, 16)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>for : Symbol(foo.for, Decl(source.js, 21, 16)) + +foo.function = 1; +>foo.function : Symbol(foo.function, Decl(source.js, 22, 12)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>function : Symbol(foo.function, Decl(source.js, 22, 12)) + +foo.if = 1; +>foo.if : Symbol(foo.if, Decl(source.js, 23, 17)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>if : Symbol(foo.if, Decl(source.js, 23, 17)) + +foo.import = 1; +>foo.import : Symbol(foo.import, Decl(source.js, 24, 11)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>import : Symbol(foo.import, Decl(source.js, 24, 11)) + +foo.in = 1; +>foo.in : Symbol(foo.in, Decl(source.js, 25, 15)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>in : Symbol(foo.in, Decl(source.js, 25, 15)) + +foo.instanceof = 1; +>foo.instanceof : Symbol(foo.instanceof, Decl(source.js, 26, 11)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>instanceof : Symbol(foo.instanceof, Decl(source.js, 26, 11)) + +foo.new = 1; +>foo.new : Symbol(foo.new, Decl(source.js, 27, 19)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>new : Symbol(foo.new, Decl(source.js, 27, 19)) + +foo.null = 1; +>foo.null : Symbol(foo.null, Decl(source.js, 28, 12)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>null : Symbol(foo.null, Decl(source.js, 28, 12)) + +foo.return = 1; +>foo.return : Symbol(foo.return, Decl(source.js, 29, 13)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>return : Symbol(foo.return, Decl(source.js, 29, 13)) + +foo.super = 1; +>foo.super : Symbol(foo.super, Decl(source.js, 30, 15)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>super : Symbol(foo.super, Decl(source.js, 30, 15)) + +foo.switch = 1; +>foo.switch : Symbol(foo.switch, Decl(source.js, 31, 14)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>switch : Symbol(foo.switch, Decl(source.js, 31, 14)) + +foo.this = 1; +>foo.this : Symbol(foo.this, Decl(source.js, 32, 15)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>this : Symbol(foo.this, Decl(source.js, 32, 15)) + +foo.throw = 1; +>foo.throw : Symbol(foo.throw, Decl(source.js, 33, 13)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>throw : Symbol(foo.throw, Decl(source.js, 33, 13)) + +foo.true = 1; +>foo.true : Symbol(foo.true, Decl(source.js, 34, 14)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>true : Symbol(foo.true, Decl(source.js, 34, 14)) + +foo.try = 1; +>foo.try : Symbol(foo.try, Decl(source.js, 35, 13)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>try : Symbol(foo.try, Decl(source.js, 35, 13)) + +foo.typeof = 1; +>foo.typeof : Symbol(foo.typeof, Decl(source.js, 36, 12)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>typeof : Symbol(foo.typeof, Decl(source.js, 36, 12)) + +foo.var = 1; +>foo.var : Symbol(foo.var, Decl(source.js, 37, 15)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>var : Symbol(foo.var, Decl(source.js, 37, 15)) + +foo.void = 1; +>foo.void : Symbol(foo.void, Decl(source.js, 38, 12)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>void : Symbol(foo.void, Decl(source.js, 38, 12)) + +foo.while = 1; +>foo.while : Symbol(foo.while, Decl(source.js, 39, 13)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>while : Symbol(foo.while, Decl(source.js, 39, 13)) + +foo.with = 1; +>foo.with : Symbol(foo.with, Decl(source.js, 40, 14)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>with : Symbol(foo.with, Decl(source.js, 40, 14)) + +foo.implements = 1; +>foo.implements : Symbol(foo.implements, Decl(source.js, 41, 13)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>implements : Symbol(foo.implements, Decl(source.js, 41, 13)) + +foo.interface = 1; +>foo.interface : Symbol(foo.interface, Decl(source.js, 42, 19)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>interface : Symbol(foo.interface, Decl(source.js, 42, 19)) + +foo.let = 1; +>foo.let : Symbol(foo.let, Decl(source.js, 43, 18)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>let : Symbol(foo.let, Decl(source.js, 43, 18)) + +foo.package = 1; +>foo.package : Symbol(foo.package, Decl(source.js, 44, 12)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>package : Symbol(foo.package, Decl(source.js, 44, 12)) + +foo.private = 1; +>foo.private : Symbol(foo.private, Decl(source.js, 45, 16)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>private : Symbol(foo.private, Decl(source.js, 45, 16)) + +foo.protected = 1; +>foo.protected : Symbol(foo.protected, Decl(source.js, 46, 16)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>protected : Symbol(foo.protected, Decl(source.js, 46, 16)) + +foo.public = 1; +>foo.public : Symbol(foo.public, Decl(source.js, 47, 18)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>public : Symbol(foo.public, Decl(source.js, 47, 18)) + +foo.static = 1; +>foo.static : Symbol(foo.static, Decl(source.js, 48, 15)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>static : Symbol(foo.static, Decl(source.js, 48, 15)) + +foo.yield = 1; +>foo.yield : Symbol(foo.yield, Decl(source.js, 49, 15)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>yield : Symbol(foo.yield, Decl(source.js, 49, 15)) + +foo.abstract = 1; +>foo.abstract : Symbol(foo.abstract, Decl(source.js, 50, 14)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>abstract : Symbol(foo.abstract, Decl(source.js, 50, 14)) + +foo.as = 1; +>foo.as : Symbol(foo.as, Decl(source.js, 51, 17)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>as : Symbol(foo.as, Decl(source.js, 51, 17)) + +foo.asserts = 1; +>foo.asserts : Symbol(foo.asserts, Decl(source.js, 52, 11)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>asserts : Symbol(foo.asserts, Decl(source.js, 52, 11)) + +foo.any = 1; +>foo.any : Symbol(foo.any, Decl(source.js, 53, 16)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>any : Symbol(foo.any, Decl(source.js, 53, 16)) + +foo.async = 1; +>foo.async : Symbol(foo.async, Decl(source.js, 54, 12)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>async : Symbol(foo.async, Decl(source.js, 54, 12)) + +foo.await = 1; +>foo.await : Symbol(foo.await, Decl(source.js, 55, 14)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>await : Symbol(foo.await, Decl(source.js, 55, 14)) + +foo.boolean = 1; +>foo.boolean : Symbol(foo.boolean, Decl(source.js, 56, 14)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>boolean : Symbol(foo.boolean, Decl(source.js, 56, 14)) + +foo.constructor = 1; +>foo.constructor : Symbol(foo.constructor, Decl(source.js, 57, 16)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>constructor : Symbol(foo.constructor, Decl(source.js, 57, 16)) + +foo.declare = 1; +>foo.declare : Symbol(foo.declare, Decl(source.js, 58, 20)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>declare : Symbol(foo.declare, Decl(source.js, 58, 20)) + +foo.get = 1; +>foo.get : Symbol(foo.get, Decl(source.js, 59, 16)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>get : Symbol(foo.get, Decl(source.js, 59, 16)) + +foo.infer = 1; +>foo.infer : Symbol(foo.infer, Decl(source.js, 60, 12)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>infer : Symbol(foo.infer, Decl(source.js, 60, 12)) + +foo.is = 1; +>foo.is : Symbol(foo.is, Decl(source.js, 61, 14)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>is : Symbol(foo.is, Decl(source.js, 61, 14)) + +foo.keyof = 1; +>foo.keyof : Symbol(foo.keyof, Decl(source.js, 62, 11)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>keyof : Symbol(foo.keyof, Decl(source.js, 62, 11)) + +foo.module = 1; +>foo.module : Symbol(foo.module, Decl(source.js, 63, 14)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>module : Symbol(foo.module, Decl(source.js, 63, 14)) + +foo.namespace = 1; +>foo.namespace : Symbol(foo.namespace, Decl(source.js, 64, 15)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>namespace : Symbol(foo.namespace, Decl(source.js, 64, 15)) + +foo.never = 1; +>foo.never : Symbol(foo.never, Decl(source.js, 65, 18)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>never : Symbol(foo.never, Decl(source.js, 65, 18)) + +foo.readonly = 1; +>foo.readonly : Symbol(foo.readonly, Decl(source.js, 66, 14)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>readonly : Symbol(foo.readonly, Decl(source.js, 66, 14)) + +foo.require = 1; +>foo.require : Symbol(foo.require, Decl(source.js, 67, 17)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>require : Symbol(foo.require, Decl(source.js, 67, 17)) + +foo.number = 1; +>foo.number : Symbol(foo.number, Decl(source.js, 68, 16)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>number : Symbol(foo.number, Decl(source.js, 68, 16)) + +foo.object = 1; +>foo.object : Symbol(foo.object, Decl(source.js, 69, 15)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>object : Symbol(foo.object, Decl(source.js, 69, 15)) + +foo.set = 1; +>foo.set : Symbol(foo.set, Decl(source.js, 70, 15)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>set : Symbol(foo.set, Decl(source.js, 70, 15)) + +foo.string = 1; +>foo.string : Symbol(foo.string, Decl(source.js, 71, 12)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>string : Symbol(foo.string, Decl(source.js, 71, 12)) + +foo.symbol = 1; +>foo.symbol : Symbol(foo.symbol, Decl(source.js, 72, 15)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>symbol : Symbol(foo.symbol, Decl(source.js, 72, 15)) + +foo.type = 1; +>foo.type : Symbol(foo.type, Decl(source.js, 73, 15)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>type : Symbol(foo.type, Decl(source.js, 73, 15)) + +foo.undefined = 1; +>foo.undefined : Symbol(foo.undefined, Decl(source.js, 74, 13)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>undefined : Symbol(foo.undefined, Decl(source.js, 74, 13)) + +foo.unique = 1; +>foo.unique : Symbol(foo.unique, Decl(source.js, 75, 18)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>unique : Symbol(foo.unique, Decl(source.js, 75, 18)) + +foo.unknown = 1; +>foo.unknown : Symbol(foo.unknown, Decl(source.js, 76, 15)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>unknown : Symbol(foo.unknown, Decl(source.js, 76, 15)) + +foo.from = 1; +>foo.from : Symbol(foo.from, Decl(source.js, 77, 16)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>from : Symbol(foo.from, Decl(source.js, 77, 16)) + +foo.global = 1; +>foo.global : Symbol(foo.global, Decl(source.js, 78, 13)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>global : Symbol(foo.global, Decl(source.js, 78, 13)) + +foo.bigint = 1; +>foo.bigint : Symbol(foo.bigint, Decl(source.js, 79, 15)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>bigint : Symbol(foo.bigint, Decl(source.js, 79, 15)) + +foo.of = 1; +>foo.of : Symbol(foo.of, Decl(source.js, 80, 15)) +>foo : Symbol(foo, Decl(source.js, 0, 0), Decl(source.js, 0, 17), Decl(source.js, 2, 10), Decl(source.js, 3, 10), Decl(source.js, 6, 14) ... and 74 more) +>of : Symbol(foo.of, Decl(source.js, 80, 15)) + diff --git a/tests/baselines/reference/jsDeclarationsFunctionKeywordPropExhaustive.types b/tests/baselines/reference/jsDeclarationsFunctionKeywordPropExhaustive.types new file mode 100644 index 0000000000000..88f2166c7da38 --- /dev/null +++ b/tests/baselines/reference/jsDeclarationsFunctionKeywordPropExhaustive.types @@ -0,0 +1,552 @@ +=== tests/cases/conformance/jsdoc/declarations/source.js === +function foo() {} +>foo : typeof foo + +// properties +foo.x = 1; +>foo.x = 1 : 1 +>foo.x : number +>foo : typeof foo +>x : number +>1 : 1 + +foo.y = 1; +>foo.y = 1 : 1 +>foo.y : number +>foo : typeof foo +>y : number +>1 : 1 + +// keywords +foo.break = 1; +>foo.break = 1 : 1 +>foo.break : number +>foo : typeof foo +>break : number +>1 : 1 + +foo.case = 1; +>foo.case = 1 : 1 +>foo.case : number +>foo : typeof foo +>case : number +>1 : 1 + +foo.catch = 1; +>foo.catch = 1 : 1 +>foo.catch : number +>foo : typeof foo +>catch : number +>1 : 1 + +foo.class = 1; +>foo.class = 1 : 1 +>foo.class : number +>foo : typeof foo +>class : number +>1 : 1 + +foo.const = 1; +>foo.const = 1 : 1 +>foo.const : number +>foo : typeof foo +>const : number +>1 : 1 + +foo.continue = 1; +>foo.continue = 1 : 1 +>foo.continue : number +>foo : typeof foo +>continue : number +>1 : 1 + +foo.debugger = 1; +>foo.debugger = 1 : 1 +>foo.debugger : number +>foo : typeof foo +>debugger : number +>1 : 1 + +foo.default = 1; +>foo.default = 1 : 1 +>foo.default : number +>foo : typeof foo +>default : number +>1 : 1 + +foo.delete = 1; +>foo.delete = 1 : 1 +>foo.delete : number +>foo : typeof foo +>delete : number +>1 : 1 + +foo.do = 1; +>foo.do = 1 : 1 +>foo.do : number +>foo : typeof foo +>do : number +>1 : 1 + +foo.else = 1; +>foo.else = 1 : 1 +>foo.else : number +>foo : typeof foo +>else : number +>1 : 1 + +foo.enum = 1; +>foo.enum = 1 : 1 +>foo.enum : number +>foo : typeof foo +>enum : number +>1 : 1 + +foo.export = 1; +>foo.export = 1 : 1 +>foo.export : number +>foo : typeof foo +>export : number +>1 : 1 + +foo.extends = 1; +>foo.extends = 1 : 1 +>foo.extends : number +>foo : typeof foo +>extends : number +>1 : 1 + +foo.false = 1; +>foo.false = 1 : 1 +>foo.false : number +>foo : typeof foo +>false : number +>1 : 1 + +foo.finally = 1; +>foo.finally = 1 : 1 +>foo.finally : number +>foo : typeof foo +>finally : number +>1 : 1 + +foo.for = 1; +>foo.for = 1 : 1 +>foo.for : number +>foo : typeof foo +>for : number +>1 : 1 + +foo.function = 1; +>foo.function = 1 : 1 +>foo.function : number +>foo : typeof foo +>function : number +>1 : 1 + +foo.if = 1; +>foo.if = 1 : 1 +>foo.if : number +>foo : typeof foo +>if : number +>1 : 1 + +foo.import = 1; +>foo.import = 1 : 1 +>foo.import : number +>foo : typeof foo +>import : number +>1 : 1 + +foo.in = 1; +>foo.in = 1 : 1 +>foo.in : number +>foo : typeof foo +>in : number +>1 : 1 + +foo.instanceof = 1; +>foo.instanceof = 1 : 1 +>foo.instanceof : number +>foo : typeof foo +>instanceof : number +>1 : 1 + +foo.new = 1; +>foo.new = 1 : 1 +>foo.new : number +>foo : typeof foo +>new : number +>1 : 1 + +foo.null = 1; +>foo.null = 1 : 1 +>foo.null : number +>foo : typeof foo +>null : number +>1 : 1 + +foo.return = 1; +>foo.return = 1 : 1 +>foo.return : number +>foo : typeof foo +>return : number +>1 : 1 + +foo.super = 1; +>foo.super = 1 : 1 +>foo.super : number +>foo : typeof foo +>super : number +>1 : 1 + +foo.switch = 1; +>foo.switch = 1 : 1 +>foo.switch : number +>foo : typeof foo +>switch : number +>1 : 1 + +foo.this = 1; +>foo.this = 1 : 1 +>foo.this : number +>foo : typeof foo +>this : number +>1 : 1 + +foo.throw = 1; +>foo.throw = 1 : 1 +>foo.throw : number +>foo : typeof foo +>throw : number +>1 : 1 + +foo.true = 1; +>foo.true = 1 : 1 +>foo.true : number +>foo : typeof foo +>true : number +>1 : 1 + +foo.try = 1; +>foo.try = 1 : 1 +>foo.try : number +>foo : typeof foo +>try : number +>1 : 1 + +foo.typeof = 1; +>foo.typeof = 1 : 1 +>foo.typeof : number +>foo : typeof foo +>typeof : number +>1 : 1 + +foo.var = 1; +>foo.var = 1 : 1 +>foo.var : number +>foo : typeof foo +>var : number +>1 : 1 + +foo.void = 1; +>foo.void = 1 : 1 +>foo.void : number +>foo : typeof foo +>void : number +>1 : 1 + +foo.while = 1; +>foo.while = 1 : 1 +>foo.while : number +>foo : typeof foo +>while : number +>1 : 1 + +foo.with = 1; +>foo.with = 1 : 1 +>foo.with : number +>foo : typeof foo +>with : number +>1 : 1 + +foo.implements = 1; +>foo.implements = 1 : 1 +>foo.implements : number +>foo : typeof foo +>implements : number +>1 : 1 + +foo.interface = 1; +>foo.interface = 1 : 1 +>foo.interface : number +>foo : typeof foo +>interface : number +>1 : 1 + +foo.let = 1; +>foo.let = 1 : 1 +>foo.let : number +>foo : typeof foo +>let : number +>1 : 1 + +foo.package = 1; +>foo.package = 1 : 1 +>foo.package : number +>foo : typeof foo +>package : number +>1 : 1 + +foo.private = 1; +>foo.private = 1 : 1 +>foo.private : number +>foo : typeof foo +>private : number +>1 : 1 + +foo.protected = 1; +>foo.protected = 1 : 1 +>foo.protected : number +>foo : typeof foo +>protected : number +>1 : 1 + +foo.public = 1; +>foo.public = 1 : 1 +>foo.public : number +>foo : typeof foo +>public : number +>1 : 1 + +foo.static = 1; +>foo.static = 1 : 1 +>foo.static : number +>foo : typeof foo +>static : number +>1 : 1 + +foo.yield = 1; +>foo.yield = 1 : 1 +>foo.yield : number +>foo : typeof foo +>yield : number +>1 : 1 + +foo.abstract = 1; +>foo.abstract = 1 : 1 +>foo.abstract : number +>foo : typeof foo +>abstract : number +>1 : 1 + +foo.as = 1; +>foo.as = 1 : 1 +>foo.as : number +>foo : typeof foo +>as : number +>1 : 1 + +foo.asserts = 1; +>foo.asserts = 1 : 1 +>foo.asserts : number +>foo : typeof foo +>asserts : number +>1 : 1 + +foo.any = 1; +>foo.any = 1 : 1 +>foo.any : number +>foo : typeof foo +>any : number +>1 : 1 + +foo.async = 1; +>foo.async = 1 : 1 +>foo.async : number +>foo : typeof foo +>async : number +>1 : 1 + +foo.await = 1; +>foo.await = 1 : 1 +>foo.await : number +>foo : typeof foo +>await : number +>1 : 1 + +foo.boolean = 1; +>foo.boolean = 1 : 1 +>foo.boolean : number +>foo : typeof foo +>boolean : number +>1 : 1 + +foo.constructor = 1; +>foo.constructor = 1 : 1 +>foo.constructor : number +>foo : typeof foo +>constructor : number +>1 : 1 + +foo.declare = 1; +>foo.declare = 1 : 1 +>foo.declare : number +>foo : typeof foo +>declare : number +>1 : 1 + +foo.get = 1; +>foo.get = 1 : 1 +>foo.get : number +>foo : typeof foo +>get : number +>1 : 1 + +foo.infer = 1; +>foo.infer = 1 : 1 +>foo.infer : number +>foo : typeof foo +>infer : number +>1 : 1 + +foo.is = 1; +>foo.is = 1 : 1 +>foo.is : number +>foo : typeof foo +>is : number +>1 : 1 + +foo.keyof = 1; +>foo.keyof = 1 : 1 +>foo.keyof : number +>foo : typeof foo +>keyof : number +>1 : 1 + +foo.module = 1; +>foo.module = 1 : 1 +>foo.module : number +>foo : typeof foo +>module : number +>1 : 1 + +foo.namespace = 1; +>foo.namespace = 1 : 1 +>foo.namespace : number +>foo : typeof foo +>namespace : number +>1 : 1 + +foo.never = 1; +>foo.never = 1 : 1 +>foo.never : number +>foo : typeof foo +>never : number +>1 : 1 + +foo.readonly = 1; +>foo.readonly = 1 : 1 +>foo.readonly : number +>foo : typeof foo +>readonly : number +>1 : 1 + +foo.require = 1; +>foo.require = 1 : 1 +>foo.require : number +>foo : typeof foo +>require : number +>1 : 1 + +foo.number = 1; +>foo.number = 1 : 1 +>foo.number : number +>foo : typeof foo +>number : number +>1 : 1 + +foo.object = 1; +>foo.object = 1 : 1 +>foo.object : number +>foo : typeof foo +>object : number +>1 : 1 + +foo.set = 1; +>foo.set = 1 : 1 +>foo.set : number +>foo : typeof foo +>set : number +>1 : 1 + +foo.string = 1; +>foo.string = 1 : 1 +>foo.string : number +>foo : typeof foo +>string : number +>1 : 1 + +foo.symbol = 1; +>foo.symbol = 1 : 1 +>foo.symbol : number +>foo : typeof foo +>symbol : number +>1 : 1 + +foo.type = 1; +>foo.type = 1 : 1 +>foo.type : number +>foo : typeof foo +>type : number +>1 : 1 + +foo.undefined = 1; +>foo.undefined = 1 : 1 +>foo.undefined : number +>foo : typeof foo +>undefined : number +>1 : 1 + +foo.unique = 1; +>foo.unique = 1 : 1 +>foo.unique : number +>foo : typeof foo +>unique : number +>1 : 1 + +foo.unknown = 1; +>foo.unknown = 1 : 1 +>foo.unknown : number +>foo : typeof foo +>unknown : number +>1 : 1 + +foo.from = 1; +>foo.from = 1 : 1 +>foo.from : number +>foo : typeof foo +>from : number +>1 : 1 + +foo.global = 1; +>foo.global = 1 : 1 +>foo.global : number +>foo : typeof foo +>global : number +>1 : 1 + +foo.bigint = 1; +>foo.bigint = 1 : 1 +>foo.bigint : number +>foo : typeof foo +>bigint : number +>1 : 1 + +foo.of = 1; +>foo.of = 1 : 1 +>foo.of : number +>foo : typeof foo +>of : number +>1 : 1 + diff --git a/tests/baselines/reference/jsDeclarationsFunctions.js b/tests/baselines/reference/jsDeclarationsFunctions.js index 1ac0a02f31f44..03c7bc576e178 100644 --- a/tests/baselines/reference/jsDeclarationsFunctions.js +++ b/tests/baselines/reference/jsDeclarationsFunctions.js @@ -126,7 +126,7 @@ exports.jj = j; export function a(): void; export function b(): void; export namespace b { - export const cat: string; + const cat: string; } export function c(): void; export namespace c { diff --git a/tests/baselines/reference/jsDeclarationsFunctionsCjs.js b/tests/baselines/reference/jsDeclarationsFunctionsCjs.js index cc29b4daf6c17..41d6e017dbd58 100644 --- a/tests/baselines/reference/jsDeclarationsFunctionsCjs.js +++ b/tests/baselines/reference/jsDeclarationsFunctionsCjs.js @@ -117,7 +117,7 @@ module.exports.j = function j() { }; export function a(): void; export function b(): void; export namespace b { - export const cat: string; + const cat: string; } export function c(): void; export namespace c { diff --git a/tests/baselines/reference/jsDeclarationsReactComponents.js b/tests/baselines/reference/jsDeclarationsReactComponents.js index fc9efa409d6ed..9c0373e83e739 100644 --- a/tests/baselines/reference/jsDeclarationsReactComponents.js +++ b/tests/baselines/reference/jsDeclarationsReactComponents.js @@ -189,11 +189,11 @@ exports.default = Tree; export default TabbedShowLayout; declare function TabbedShowLayout({}: {}): JSX.Element; declare namespace TabbedShowLayout { - export namespace propTypes { - export const version: PropTypes.Requireable; + namespace propTypes { + const version: PropTypes.Requireable; } - export namespace defaultProps { - export const tabs: undefined; + namespace defaultProps { + const tabs: undefined; } } import PropTypes from "prop-types"; @@ -223,8 +223,8 @@ declare function TabbedShowLayout(prop: { className: string; }): JSX.Element; declare namespace TabbedShowLayout { - export namespace defaultProps { - export const tabs: string; + namespace defaultProps { + const tabs: string; } } //// [jsDeclarationsReactComponents5.d.ts] @@ -234,10 +234,10 @@ declare function Tree({ allowDropOnRoot }: { allowDropOnRoot: any; }): JSX.Element; declare namespace Tree { - export namespace propTypes { - export const classes: PropTypes.Requireable; + namespace propTypes { + const classes: PropTypes.Requireable; } - export namespace defaultProps { + namespace defaultProps { const classes_1: {}; export { classes_1 as classes }; export const parentSource: string; diff --git a/tests/baselines/reference/jsDeclarationsWithDefaultAsNamespaceLikeMerge.js b/tests/baselines/reference/jsDeclarationsWithDefaultAsNamespaceLikeMerge.js index c414934c4be76..ce8ba7c2342b5 100644 --- a/tests/baselines/reference/jsDeclarationsWithDefaultAsNamespaceLikeMerge.js +++ b/tests/baselines/reference/jsDeclarationsWithDefaultAsNamespaceLikeMerge.js @@ -24,8 +24,8 @@ export default { //// [index.d.ts] declare namespace _default { - export namespace computed { - export const panels: import("./helper").Computed; + namespace computed { + const panels: import("./helper").Computed; } } export default _default; diff --git a/tests/baselines/reference/jsdocImplements_class.js b/tests/baselines/reference/jsdocImplements_class.js index f9df57c800f1b..de40a604ebca7 100644 --- a/tests/baselines/reference/jsdocImplements_class.js +++ b/tests/baselines/reference/jsdocImplements_class.js @@ -73,7 +73,7 @@ declare class B3 implements A { } declare namespace Ns { export { C1 }; - const C5: { + export const C5: { new (): { method(): number; }; diff --git a/tests/baselines/reference/jsxDeclarationsWithEsModuleInteropNoCrash.js b/tests/baselines/reference/jsxDeclarationsWithEsModuleInteropNoCrash.js index 2aefd95141a2a..6b5117f906a43 100644 --- a/tests/baselines/reference/jsxDeclarationsWithEsModuleInteropNoCrash.js +++ b/tests/baselines/reference/jsxDeclarationsWithEsModuleInteropNoCrash.js @@ -33,7 +33,7 @@ declare namespace Foo { export { defaultProps }; } declare namespace propTypes { - export const bar: PropTypes.Requireable; + const bar: PropTypes.Requireable; } declare namespace defaultProps { const bar_1: boolean; diff --git a/tests/baselines/reference/moduleExportsElementAccessAssignment.js b/tests/baselines/reference/moduleExportsElementAccessAssignment.js index daae7593d103d..bcaa27ce775ea 100644 --- a/tests/baselines/reference/moduleExportsElementAccessAssignment.js +++ b/tests/baselines/reference/moduleExportsElementAccessAssignment.js @@ -21,7 +21,7 @@ mod1.default; //// [mod1.d.ts] export namespace a { - export const x: string; + const x: string; } export namespace b { const x_1: string; @@ -37,7 +37,7 @@ export namespace c { export { x_3 as x }; } export namespace d { - export const e: number; + const e: number; } //// [mod2.d.ts] export {}; diff --git a/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-js-based-projects-and-emits-them-correctly.js b/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-js-based-projects-and-emits-them-correctly.js index 9be011499262a..d60d47bb28ae7 100644 --- a/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-js-based-projects-and-emits-them-correctly.js +++ b/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-js-based-projects-and-emits-them-correctly.js @@ -232,7 +232,7 @@ exports.__esModule = true; */ export function getVar(): keyof typeof variable; declare namespace variable { - export const key: MyNominal; + const key: MyNominal; } import { MyNominal } from "../sub-project"; export {}; @@ -270,7 +270,7 @@ exports.getVar = getVar; }, "../../src/sub-project-2/index.js": { "version": "9520601400-import { MyNominal } from '../sub-project/index';\n\nconst variable = {\n key: /** @type {MyNominal} */('value'),\n};\n\n/**\n * @return {keyof typeof variable}\n */\nexport function getVar() {\n return 'key';\n}\n", - "signature": "-14896620483-/**\r\n * @return {keyof typeof variable}\r\n */\r\nexport function getVar(): keyof typeof variable;\r\ndeclare namespace variable {\r\n export const key: MyNominal;\r\n}\r\nimport { MyNominal } from \"../sub-project\";\r\nexport {};\r\n", + "signature": "-24091164549-/**\r\n * @return {keyof typeof variable}\r\n */\r\nexport function getVar(): keyof typeof variable;\r\ndeclare namespace variable {\r\n const key: MyNominal;\r\n}\r\nimport { MyNominal } from \"../sub-project\";\r\nexport {};\r\n", "affectsGlobalScope": false } }, diff --git a/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-js-based-projects-with-non-moved-json-files-and-emits-them-correctly.js b/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-js-based-projects-with-non-moved-json-files-and-emits-them-correctly.js index 6b7f9e60e5932..cac333aadfbb9 100644 --- a/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-js-based-projects-with-non-moved-json-files-and-emits-them-correctly.js +++ b/tests/baselines/reference/tsbuild/javascriptProjectEmit/initial-build/loads-js-based-projects-with-non-moved-json-files-and-emits-them-correctly.js @@ -285,7 +285,7 @@ module.exports = x; }, "./obj.json": { "version": "2151907832-{\n \"val\": 42\n}", - "signature": "-6323167306-export declare const val: number;\r\n", + "signature": "-5546159834-export const val: number;\r\n", "affectsGlobalScope": true }, "./index.ts": { diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/files-containing-json-file.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/files-containing-json-file.js index 5be549694cfda..05a2b06a00a52 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/files-containing-json-file.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/files-containing-json-file.js @@ -89,7 +89,7 @@ exports["default"] = hello_json_1["default"].hello; }, "../src/hello.json": { "version": "6651571919-{\n \"hello\": \"world\"\n}", - "signature": "-4341462827-export declare const hello: string;\r\n", + "signature": "-17173785019-export const hello: string;\r\n", "affectsGlobalScope": true }, "../src/index.ts": { diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/importing-json-module-from-project-reference.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/importing-json-module-from-project-reference.js index 6efbfbbf25467..07b823a44f064 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/importing-json-module-from-project-reference.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/importing-json-module-from-project-reference.js @@ -153,7 +153,7 @@ console.log(foo_json_1.foo); }, "./foo.json": { "version": "4395333385-{\n \"foo\": \"bar baz\"\n}", - "signature": "-1457151099-export declare const foo: string;\r\n", + "signature": "-13565045515-export const foo: string;\r\n", "affectsGlobalScope": true } }, diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-and-files.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-and-files.js index c3260fe00e4bc..5c11ac3c8bad3 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-and-files.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-and-files.js @@ -92,7 +92,7 @@ exports["default"] = hello_json_1["default"].hello; }, "../src/hello.json": { "version": "6651571919-{\n \"hello\": \"world\"\n}", - "signature": "-4341462827-export declare const hello: string;\r\n", + "signature": "-17173785019-export const hello: string;\r\n", "affectsGlobalScope": true }, "../src/index.ts": { diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include-and-file-name-matches-ts-file.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include-and-file-name-matches-ts-file.js index 65a6887df6724..9286ef881d046 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include-and-file-name-matches-ts-file.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include-and-file-name-matches-ts-file.js @@ -85,7 +85,7 @@ exports["default"] = index_json_1["default"].hello; }, "../src/index.json": { "version": "-2379406821-{\"hello\":\"world\"}", - "signature": "-4341462827-export declare const hello: string;\r\n", + "signature": "-17173785019-export const hello: string;\r\n", "affectsGlobalScope": true }, "../src/index.ts": { diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include.js index 25917941f674d..ae07e6404cb10 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include.js @@ -89,7 +89,7 @@ exports["default"] = hello_json_1["default"].hello; }, "../src/hello.json": { "version": "6651571919-{\n \"hello\": \"world\"\n}", - "signature": "-4341462827-export declare const hello: string;\r\n", + "signature": "-17173785019-export const hello: string;\r\n", "affectsGlobalScope": true }, "../src/index.ts": { diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-only.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-only.js index 408fd4c55240c..f479d2ac0bc9b 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-only.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-only.js @@ -76,7 +76,7 @@ exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped }, "../src/hello.json": { "version": "6651571919-{\n \"hello\": \"world\"\n}", - "signature": "-4341462827-export declare const hello: string;\r\n", + "signature": "-17173785019-export const hello: string;\r\n", "affectsGlobalScope": true }, "../src/index.ts": { diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/sourcemap.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/sourcemap.js index 0d39b0a6f2901..e1ef669806e12 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/sourcemap.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/sourcemap.js @@ -99,7 +99,7 @@ exports["default"] = hello_json_1["default"].hello; }, "../src/hello.json": { "version": "6651571919-{\n \"hello\": \"world\"\n}", - "signature": "-4341462827-export declare const hello: string;\r\n", + "signature": "-17173785019-export const hello: string;\r\n", "affectsGlobalScope": true }, "../src/index.ts": { diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/without-outDir.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/without-outDir.js index 6c0344367f713..f58de06d0b2ed 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/without-outDir.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/without-outDir.js @@ -90,7 +90,7 @@ exports["default"] = hello_json_1["default"].hello; }, "./src/hello.json": { "version": "6651571919-{\n \"hello\": \"world\"\n}", - "signature": "-4341462827-export declare const hello: string;\r\n", + "signature": "-17173785019-export const hello: string;\r\n", "affectsGlobalScope": true }, "./src/index.ts": { diff --git a/tests/cases/conformance/jsdoc/declarations/jsDeclarationsFunctionKeywordPropExhaustive.ts b/tests/cases/conformance/jsdoc/declarations/jsDeclarationsFunctionKeywordPropExhaustive.ts new file mode 100644 index 0000000000000..d40beef870918 --- /dev/null +++ b/tests/cases/conformance/jsdoc/declarations/jsDeclarationsFunctionKeywordPropExhaustive.ts @@ -0,0 +1,88 @@ +// @allowJs: true +// @checkJs: true +// @target: es5 +// @outDir: ./out +// @declaration: true +// @filename: source.js +function foo() {} +// properties +foo.x = 1; +foo.y = 1; + +// keywords +foo.break = 1; +foo.case = 1; +foo.catch = 1; +foo.class = 1; +foo.const = 1; +foo.continue = 1; +foo.debugger = 1; +foo.default = 1; +foo.delete = 1; +foo.do = 1; +foo.else = 1; +foo.enum = 1; +foo.export = 1; +foo.extends = 1; +foo.false = 1; +foo.finally = 1; +foo.for = 1; +foo.function = 1; +foo.if = 1; +foo.import = 1; +foo.in = 1; +foo.instanceof = 1; +foo.new = 1; +foo.null = 1; +foo.return = 1; +foo.super = 1; +foo.switch = 1; +foo.this = 1; +foo.throw = 1; +foo.true = 1; +foo.try = 1; +foo.typeof = 1; +foo.var = 1; +foo.void = 1; +foo.while = 1; +foo.with = 1; +foo.implements = 1; +foo.interface = 1; +foo.let = 1; +foo.package = 1; +foo.private = 1; +foo.protected = 1; +foo.public = 1; +foo.static = 1; +foo.yield = 1; +foo.abstract = 1; +foo.as = 1; +foo.asserts = 1; +foo.any = 1; +foo.async = 1; +foo.await = 1; +foo.boolean = 1; +foo.constructor = 1; +foo.declare = 1; +foo.get = 1; +foo.infer = 1; +foo.is = 1; +foo.keyof = 1; +foo.module = 1; +foo.namespace = 1; +foo.never = 1; +foo.readonly = 1; +foo.require = 1; +foo.number = 1; +foo.object = 1; +foo.set = 1; +foo.string = 1; +foo.symbol = 1; +foo.type = 1; +foo.undefined = 1; +foo.unique = 1; +foo.unknown = 1; +foo.from = 1; +foo.global = 1; +foo.bigint = 1; +foo.of = 1; \ No newline at end of file