From bb4469527a65d5625a3098520bc59d93db0d2c08 Mon Sep 17 00:00:00 2001 From: Egor Aristov Date: Wed, 15 Oct 2025 10:12:44 +0300 Subject: [PATCH] ... --- Makefile | 16 + go.work.sum | 20 +- kitcom/go.mod | 7 +- kitcom/go.sum | 18 +- kitcom/internal/tsgo/api/api.go | 320 + kitcom/internal/tsgo/api/encoder/encoder.go | 815 + .../internal/tsgo/api/encoder/encoder_test.go | 94 + .../internal/tsgo/api/encoder/stringtable.go | 68 + kitcom/internal/tsgo/api/proto.go | 218 + kitcom/internal/tsgo/api/server.go | 497 + .../internal/tsgo/api/stringer_generated.go | 29 + kitcom/internal/tsgo/ast/ast.go | 11118 + kitcom/internal/tsgo/ast/checkflags.go | 35 + kitcom/internal/tsgo/ast/deepclone.go | 86 + kitcom/internal/tsgo/ast/deepclone_test.go | 599 + kitcom/internal/tsgo/ast/diagnostic.go | 272 + kitcom/internal/tsgo/ast/flow.go | 75 + kitcom/internal/tsgo/ast/ids.go | 6 + kitcom/internal/tsgo/ast/kind.go | 430 + .../tsgo/ast/kind_stringer_generated.go | 378 + kitcom/internal/tsgo/ast/modifierflags.go | 53 + kitcom/internal/tsgo/ast/nodeflags.go | 65 + kitcom/internal/tsgo/ast/parseoptions.go | 168 + kitcom/internal/tsgo/ast/precedence.go | 714 + kitcom/internal/tsgo/ast/subtreefacts.go | 131 + kitcom/internal/tsgo/ast/symbol.go | 60 + kitcom/internal/tsgo/ast/symbolflags.go | 86 + kitcom/internal/tsgo/ast/tokenflags.go | 31 + kitcom/internal/tsgo/ast/utilities.go | 3892 + kitcom/internal/tsgo/ast/visitor.go | 278 + kitcom/internal/tsgo/astnav/tokens.go | 653 + kitcom/internal/tsgo/astnav/tokens_test.go | 474 + kitcom/internal/tsgo/binder/binder.go | 2820 + kitcom/internal/tsgo/binder/binder_test.go | 51 + kitcom/internal/tsgo/binder/nameresolver.go | 503 + .../internal/tsgo/binder/referenceresolver.go | 251 + kitcom/internal/tsgo/bundled/bundled.go | 53 + kitcom/internal/tsgo/bundled/bundled_test.go | 48 + kitcom/internal/tsgo/bundled/embed.go | 212 + .../internal/tsgo/bundled/embed_generated.go | 420 + kitcom/internal/tsgo/bundled/generate.go | 228 + kitcom/internal/tsgo/bundled/libs/lib.d.ts | 22 + .../tsgo/bundled/libs/lib.decorators.d.ts | 384 + .../bundled/libs/lib.decorators.legacy.d.ts | 22 + .../bundled/libs/lib.dom.asynciterable.d.ts | 41 + .../internal/tsgo/bundled/libs/lib.dom.d.ts | 39429 + .../tsgo/bundled/libs/lib.dom.iterable.d.ts | 571 + .../bundled/libs/lib.es2015.collection.d.ts | 147 + .../tsgo/bundled/libs/lib.es2015.core.d.ts | 597 + .../tsgo/bundled/libs/lib.es2015.d.ts | 28 + .../bundled/libs/lib.es2015.generator.d.ts | 77 + .../bundled/libs/lib.es2015.iterable.d.ts | 605 + .../tsgo/bundled/libs/lib.es2015.promise.d.ts | 81 + .../tsgo/bundled/libs/lib.es2015.proxy.d.ts | 128 + .../tsgo/bundled/libs/lib.es2015.reflect.d.ts | 144 + .../tsgo/bundled/libs/lib.es2015.symbol.d.ts | 46 + .../libs/lib.es2015.symbol.wellknown.d.ts | 326 + .../libs/lib.es2016.array.include.d.ts | 116 + .../tsgo/bundled/libs/lib.es2016.d.ts | 21 + .../tsgo/bundled/libs/lib.es2016.full.d.ts | 23 + .../tsgo/bundled/libs/lib.es2016.intl.d.ts | 31 + .../bundled/libs/lib.es2017.arraybuffer.d.ts | 21 + .../tsgo/bundled/libs/lib.es2017.d.ts | 26 + .../tsgo/bundled/libs/lib.es2017.date.d.ts | 31 + .../tsgo/bundled/libs/lib.es2017.full.d.ts | 23 + .../tsgo/bundled/libs/lib.es2017.intl.d.ts | 44 + .../tsgo/bundled/libs/lib.es2017.object.d.ts | 49 + .../bundled/libs/lib.es2017.sharedmemory.d.ts | 135 + .../tsgo/bundled/libs/lib.es2017.string.d.ts | 45 + .../bundled/libs/lib.es2017.typedarrays.d.ts | 53 + .../libs/lib.es2018.asyncgenerator.d.ts | 77 + .../libs/lib.es2018.asynciterable.d.ts | 53 + .../tsgo/bundled/libs/lib.es2018.d.ts | 24 + .../tsgo/bundled/libs/lib.es2018.full.d.ts | 24 + .../tsgo/bundled/libs/lib.es2018.intl.d.ts | 83 + .../tsgo/bundled/libs/lib.es2018.promise.d.ts | 30 + .../tsgo/bundled/libs/lib.es2018.regexp.d.ts | 37 + .../tsgo/bundled/libs/lib.es2019.array.d.ts | 79 + .../tsgo/bundled/libs/lib.es2019.d.ts | 24 + .../tsgo/bundled/libs/lib.es2019.full.d.ts | 24 + .../tsgo/bundled/libs/lib.es2019.intl.d.ts | 23 + .../tsgo/bundled/libs/lib.es2019.object.d.ts | 33 + .../tsgo/bundled/libs/lib.es2019.string.d.ts | 37 + .../tsgo/bundled/libs/lib.es2019.symbol.d.ts | 24 + .../tsgo/bundled/libs/lib.es2020.bigint.d.ts | 765 + .../tsgo/bundled/libs/lib.es2020.d.ts | 27 + .../tsgo/bundled/libs/lib.es2020.date.d.ts | 42 + .../tsgo/bundled/libs/lib.es2020.full.d.ts | 24 + .../tsgo/bundled/libs/lib.es2020.intl.d.ts | 474 + .../tsgo/bundled/libs/lib.es2020.number.d.ts | 28 + .../tsgo/bundled/libs/lib.es2020.promise.d.ts | 47 + .../bundled/libs/lib.es2020.sharedmemory.d.ts | 99 + .../tsgo/bundled/libs/lib.es2020.string.d.ts | 44 + .../libs/lib.es2020.symbol.wellknown.d.ts | 41 + .../tsgo/bundled/libs/lib.es2021.d.ts | 23 + .../tsgo/bundled/libs/lib.es2021.full.d.ts | 24 + .../tsgo/bundled/libs/lib.es2021.intl.d.ts | 166 + .../tsgo/bundled/libs/lib.es2021.promise.d.ts | 48 + .../tsgo/bundled/libs/lib.es2021.string.d.ts | 33 + .../tsgo/bundled/libs/lib.es2021.weakref.d.ts | 78 + .../tsgo/bundled/libs/lib.es2022.array.d.ts | 121 + .../tsgo/bundled/libs/lib.es2022.d.ts | 25 + .../tsgo/bundled/libs/lib.es2022.error.d.ts | 75 + .../tsgo/bundled/libs/lib.es2022.full.d.ts | 24 + .../tsgo/bundled/libs/lib.es2022.intl.d.ts | 145 + .../tsgo/bundled/libs/lib.es2022.object.d.ts | 26 + .../tsgo/bundled/libs/lib.es2022.regexp.d.ts | 39 + .../tsgo/bundled/libs/lib.es2022.string.d.ts | 25 + .../tsgo/bundled/libs/lib.es2023.array.d.ts | 924 + .../bundled/libs/lib.es2023.collection.d.ts | 21 + .../tsgo/bundled/libs/lib.es2023.d.ts | 22 + .../tsgo/bundled/libs/lib.es2023.full.d.ts | 24 + .../tsgo/bundled/libs/lib.es2023.intl.d.ts | 56 + .../bundled/libs/lib.es2024.arraybuffer.d.ts | 65 + .../bundled/libs/lib.es2024.collection.d.ts | 29 + .../tsgo/bundled/libs/lib.es2024.d.ts | 26 + .../tsgo/bundled/libs/lib.es2024.full.d.ts | 24 + .../tsgo/bundled/libs/lib.es2024.object.d.ts | 29 + .../tsgo/bundled/libs/lib.es2024.promise.d.ts | 35 + .../tsgo/bundled/libs/lib.es2024.regexp.d.ts | 25 + .../bundled/libs/lib.es2024.sharedmemory.d.ts | 68 + .../tsgo/bundled/libs/lib.es2024.string.d.ts | 29 + .../internal/tsgo/bundled/libs/lib.es5.d.ts | 4601 + .../internal/tsgo/bundled/libs/lib.es6.d.ts | 23 + .../tsgo/bundled/libs/lib.esnext.array.d.ts | 35 + .../bundled/libs/lib.esnext.collection.d.ts | 96 + .../tsgo/bundled/libs/lib.esnext.d.ts | 29 + .../bundled/libs/lib.esnext.decorators.d.ts | 28 + .../bundled/libs/lib.esnext.disposable.d.ts | 193 + .../tsgo/bundled/libs/lib.esnext.error.d.ts | 24 + .../tsgo/bundled/libs/lib.esnext.float16.d.ts | 445 + .../tsgo/bundled/libs/lib.esnext.full.d.ts | 24 + .../tsgo/bundled/libs/lib.esnext.intl.d.ts | 21 + .../bundled/libs/lib.esnext.iterator.d.ts | 148 + .../tsgo/bundled/libs/lib.esnext.promise.d.ts | 34 + .../bundled/libs/lib.esnext.sharedmemory.d.ts | 25 + .../tsgo/bundled/libs/lib.scripthost.d.ts | 322 + .../libs/lib.webworker.asynciterable.d.ts | 41 + .../tsgo/bundled/libs/lib.webworker.d.ts | 13150 + .../libs/lib.webworker.importscripts.d.ts | 23 + .../bundled/libs/lib.webworker.iterable.d.ts | 340 + .../internal/tsgo/bundled/libs_generated.go | 108 + kitcom/internal/tsgo/bundled/noembed.go | 46 + kitcom/internal/tsgo/checker/checker.go | 30925 + kitcom/internal/tsgo/checker/checker_test.go | 103 + kitcom/internal/tsgo/checker/emitresolver.go | 1112 + kitcom/internal/tsgo/checker/exports.go | 172 + kitcom/internal/tsgo/checker/flow.go | 2724 + kitcom/internal/tsgo/checker/grammarchecks.go | 2260 + kitcom/internal/tsgo/checker/inference.go | 1620 + kitcom/internal/tsgo/checker/jsdoc.go | 97 + kitcom/internal/tsgo/checker/jsx.go | 1467 + kitcom/internal/tsgo/checker/mapper.go | 294 + kitcom/internal/tsgo/checker/nodebuilder.go | 186 + .../internal/tsgo/checker/nodebuilderimpl.go | 3112 + .../tsgo/checker/nodebuilderscopes.go | 246 + kitcom/internal/tsgo/checker/printer.go | 379 + kitcom/internal/tsgo/checker/relater.go | 4923 + kitcom/internal/tsgo/checker/services.go | 811 + .../tsgo/checker/stringer_generated.go | 24 + .../tsgo/checker/symbolaccessibility.go | 759 + kitcom/internal/tsgo/checker/symboltracker.go | 138 + kitcom/internal/tsgo/checker/types.go | 1287 + kitcom/internal/tsgo/checker/utilities.go | 1860 + kitcom/internal/tsgo/collections/multimap.go | 69 + .../internal/tsgo/collections/ordered_map.go | 317 + .../tsgo/collections/ordered_map_test.go | 187 + .../internal/tsgo/collections/ordered_set.go | 54 + .../tsgo/collections/ordered_set_test.go | 53 + kitcom/internal/tsgo/collections/set.go | 77 + kitcom/internal/tsgo/collections/syncmap.go | 84 + kitcom/internal/tsgo/collections/syncset.go | 67 + kitcom/internal/tsgo/compiler/checkerpool.go | 90 + kitcom/internal/tsgo/compiler/emitHost.go | 128 + kitcom/internal/tsgo/compiler/emitter.go | 482 + kitcom/internal/tsgo/compiler/fileInclude.go | 341 + kitcom/internal/tsgo/compiler/fileloader.go | 744 + kitcom/internal/tsgo/compiler/filesparser.go | 280 + kitcom/internal/tsgo/compiler/host.go | 88 + .../tsgo/compiler/includeprocessor.go | 144 + .../internal/tsgo/compiler/knownsymlinks.go | 53 + kitcom/internal/tsgo/compiler/pkg.go | 2 + .../tsgo/compiler/processingDiagnostic.go | 134 + kitcom/internal/tsgo/compiler/program.go | 1722 + kitcom/internal/tsgo/compiler/program_test.go | 314 + .../compiler/projectreferencedtsfakinghost.go | 226 + .../compiler/projectreferencefilemapper.go | 166 + .../tsgo/compiler/projectreferenceparser.go | 111 + kitcom/internal/tsgo/core/bfs.go | 206 + kitcom/internal/tsgo/core/bfs_test.go | 152 + kitcom/internal/tsgo/core/binarysearch.go | 26 + kitcom/internal/tsgo/core/buildoptions.go | 15 + kitcom/internal/tsgo/core/compileroptions.go | 545 + kitcom/internal/tsgo/core/context.go | 36 + kitcom/internal/tsgo/core/core.go | 670 + kitcom/internal/tsgo/core/languagevariant.go | 11 + .../languagevariant_stringer_generated.go | 24 + kitcom/internal/tsgo/core/linkstore.go | 30 + .../core/modulekind_stringer_generated.go | 52 + kitcom/internal/tsgo/core/nodemodules.go | 88 + kitcom/internal/tsgo/core/parsedoptions.go | 10 + kitcom/internal/tsgo/core/pattern.go | 52 + kitcom/internal/tsgo/core/pool.go | 66 + kitcom/internal/tsgo/core/projectreference.go | 20 + kitcom/internal/tsgo/core/scriptkind.go | 21 + .../core/scriptkind_stringer_generated.go | 30 + .../core/scripttarget_stringer_generated.go | 49 + kitcom/internal/tsgo/core/stack.go | 33 + kitcom/internal/tsgo/core/text.go | 66 + kitcom/internal/tsgo/core/textchange.go | 30 + kitcom/internal/tsgo/core/tristate.go | 71 + .../tsgo/core/tristate_stringer_generated.go | 25 + kitcom/internal/tsgo/core/typeacquisition.go | 24 + kitcom/internal/tsgo/core/version.go | 33 + kitcom/internal/tsgo/core/watchoptions.go | 53 + kitcom/internal/tsgo/core/workgroup.go | 125 + kitcom/internal/tsgo/debug/debug.go | 198 + kitcom/internal/tsgo/debug/release.go | 26 + kitcom/internal/tsgo/debug/shared.go | 43 + .../internal/tsgo/diagnostics/diagnostics.go | 63 + .../tsgo/diagnostics/diagnostics_generated.go | 4255 + .../diagnostics/extraDiagnosticMessages.json | 42 + kitcom/internal/tsgo/diagnostics/generate.go | 183 + .../tsgo/diagnostics/stringer_generated.go | 26 + .../tsgo/diagnosticwriter/diagnosticwriter.go | 418 + kitcom/internal/tsgo/evaluator/evaluator.go | 170 + .../internal/tsgo/execute/build/buildtask.go | 855 + .../tsgo/execute/build/compilerHost.go | 40 + .../internal/tsgo/execute/build/graph_test.go | 153 + kitcom/internal/tsgo/execute/build/host.go | 113 + .../tsgo/execute/build/orchestrator.go | 400 + .../internal/tsgo/execute/build/parseCache.go | 48 + .../tsgo/execute/build/uptodatestatus.go | 133 + .../incremental/affectedfileshandler.go | 384 + .../tsgo/execute/incremental/buildInfo.go | 584 + .../incremental/buildinfotosnapshot.go | 171 + .../execute/incremental/emitfileshandler.go | 329 + .../internal/tsgo/execute/incremental/host.go | 39 + .../tsgo/execute/incremental/incremental.go | 56 + .../tsgo/execute/incremental/program.go | 364 + .../execute/incremental/programtosnapshot.go | 300 + .../tsgo/execute/incremental/referencemap.go | 52 + .../tsgo/execute/incremental/snapshot.go | 323 + .../incremental/snapshottobuildinfo.go | 363 + kitcom/internal/tsgo/execute/tsc.go | 319 + kitcom/internal/tsgo/execute/tsc/compile.go | 78 + .../internal/tsgo/execute/tsc/diagnostics.go | 166 + kitcom/internal/tsgo/execute/tsc/emit.go | 142 + .../tsgo/execute/tsc/extendedconfigcache.go | 45 + kitcom/internal/tsgo/execute/tsc/help.go | 394 + .../internal/tsgo/execute/tsc/statistics.go | 157 + kitcom/internal/tsgo/execute/tsctests/fs.go | 86 + .../execute/tsctests/readablebuildinfo.go | 422 + .../internal/tsgo/execute/tsctests/runner.go | 192 + kitcom/internal/tsgo/execute/tsctests/sys.go | 627 + .../tsgo/execute/tsctests/tsc_test.go | 3989 + .../tsgo/execute/tsctests/tscbuild_test.go | 3934 + .../tsgo/execute/tsctests/tscwatch_test.go | 131 + kitcom/internal/tsgo/execute/watcher.go | 160 + kitcom/internal/tsgo/format/README.md | 26 + kitcom/internal/tsgo/format/api.go | 185 + kitcom/internal/tsgo/format/api_test.go | 114 + kitcom/internal/tsgo/format/comment_test.go | 71 + kitcom/internal/tsgo/format/context.go | 215 + kitcom/internal/tsgo/format/indent.go | 559 + kitcom/internal/tsgo/format/rule.go | 109 + kitcom/internal/tsgo/format/rulecontext.go | 644 + kitcom/internal/tsgo/format/rules.go | 446 + kitcom/internal/tsgo/format/rulesmap.go | 156 + kitcom/internal/tsgo/format/scanner.go | 355 + kitcom/internal/tsgo/format/span.go | 1215 + kitcom/internal/tsgo/format/util.go | 190 + .../fourslash/_scripts/convertFourslash.mts | 1576 + .../tsgo/fourslash/_scripts/failingTests.txt | 466 + .../tsgo/fourslash/_scripts/makeManual.mts | 71 + .../tsgo/fourslash/_scripts/manualTests.txt | 7 + .../tsgo/fourslash/_scripts/tsconfig.json | 9 + .../tsgo/fourslash/_scripts/updateFailing.mts | 38 + .../internal/tsgo/fourslash/baselineutil.go | 609 + kitcom/internal/tsgo/fourslash/fourslash.go | 1744 + kitcom/internal/tsgo/fourslash/test_parser.go | 447 + .../tests/autoImportCompletion_test.go | 143 + .../fourslash/tests/basicBackspace_test.go | 42 + .../tests/basicClassElementKeywords_test.go | 27 + .../tsgo/fourslash/tests/basicEdit_test.go | 43 + .../tests/basicGlobalCompletions_test.go | 25 + .../tests/basicInterfaceMembers_test.go | 40 + .../tests/basicJSDocCompletions_test.go | 123 + .../tests/basicMultifileCompletions_test.go | 38 + .../fourslash/tests/basicQuickInfo_test.go | 32 + .../fourslash/tests/basicReplaceLine_test.go | 42 + .../tests/chineseCharacterDisplay_test.go | 50 + .../completionAfterCallExpression_test.go | 31 + .../tests/completionDetailSignature_test.go | 42 + .../tests/completionFilterText1_test.go | 235 + .../tests/completionFilterText2_test.go | 64 + .../tests/completionFilterText3_test.go | 152 + .../tests/completionFilterText4_test.go | 43 + ...efaultTypeArgumentPositionTypeOnly_test.go | 26 + ...pletionListInUnclosedTypeArguments_test.go | 78 + .../tests/completionResolveKeyword_test.go | 36 + .../tests/completionsInJsxTag_test.go | 67 + .../tests/completionsSelfDeclaring2_test.go | 32 + .../tests/documentHighlightImportPath_test.go | 21 + .../tests/gen/addDeclareToModule_test.go | 20 + .../tests/gen/addDuplicateSetter_test.go | 21 + ...tionAboveMultiLineLambdaExpression_test.go | 21 + .../gen/addInterfaceMemberAboveClass_test.go | 28 + ...addInterfaceToNotSatisfyConstraint_test.go | 26 + .../tests/gen/addMemberToModule_test.go | 27 + .../tests/gen/addSignaturePartial_test.go | 18 + .../gen/aliasMergingWithNamespace_test.go | 18 + .../tests/gen/aliasToVarUsedAsType_test.go | 23 + .../gen/ambientShorthandFindAllRefs_test.go | 22 + .../ambientShorthandGotoDefinition_test.go | 28 + ...AvailableAfterEditsAtEndOfFunction_test.go | 42 + .../gen/argumentsIndexExpression_test.go | 20 + .../gen/arrayCallAndConstructTypings_test.go | 35 + .../tests/gen/asOperatorCompletion2_test.go | 32 + .../tests/gen/asOperatorCompletion3_test.go | 31 + .../tests/gen/asOperatorCompletion_test.go | 31 + .../tests/gen/assertContextualType_test.go | 17 + .../tests/gen/augmentedTypesClass1_test.go | 53 + .../gen/augmentedTypesClass3Fourslash_test.go | 37 + .../tests/gen/augmentedTypesModule1_test.go | 35 + .../tests/gen/augmentedTypesModule4_test.go | 49 + .../tests/gen/augmentedTypesModule5_test.go | 49 + ...autoImportProvider_referencesCrash_test.go | 44 + ...ImportsWithRootDirsAndRootedPath01_test.go | 37 + .../tests/gen/basicClassMembers_test.go | 38 + .../gen/bestCommonTypeObjectLiterals1_test.go | 35 + .../gen/bestCommonTypeObjectLiterals_test.go | 34 + .../tests/gen/classInterfaceInsert_test.go | 27 + .../gen/closedCommentsInConstructor_test.go | 19 + .../tests/gen/codeCompletionEscaping_test.go | 42 + .../tests/gen/commentsEnumsFourslash_test.go | 85 + .../gen/commentsLinePreservation_test.go | 151 + .../fourslash/tests/gen/commentsUnion_test.go | 18 + .../tests/gen/completionAfterAtChar_test.go | 27 + ...etionAfterBackslashFollowingString_test.go | 27 + .../tests/gen/completionAfterBrace_test.go | 29 + .../gen/completionAfterDotDotDot_test.go | 27 + .../tests/gen/completionAfterNewline2_test.go | 35 + .../tests/gen/completionAfterNewline_test.go | 36 + .../gen/completionAfterQuestionDot_test.go | 91 + ...mpletionAmbientPropertyDeclaration_test.go | 40 + .../tests/gen/completionAsKeyword_test.go | 37 + .../tests/gen/completionAtCaseClause_test.go | 27 + .../gen/completionAtDottedNamespace_test.go | 27 + .../completionAutoInsertQuestionDot_test.go | 59 + .../gen/completionCloneQuestionToken_test.go | 45 + ...OfContextSensitiveParameterNoCrash_test.go | 103 + ...tionEntryAfterASIExpressionInClass_test.go | 45 + ...ersWithInferredFunctionReturnType1_test.go | 45 + ...ntryForArgumentConstrainedToString_test.go | 33 + ...orArrayElementConstrainedToString2_test.go | 32 + ...ForArrayElementConstrainedToString_test.go | 32 + ...rs_StaticWhenBaseTypeIsNotResolved_test.go | 52 + .../tests/gen/completionEntryForConst_test.go | 71 + ...nEntryForDeferredMappedTypeMembers_test.go | 37 + ...ntryForPropertyConstrainedToString_test.go | 32 + ...ryForPropertyFromUnionOfModuleType_test.go | 42 + ...ntryForShorthandPropertyAssignment_test.go | 33 + .../completionEntryForUnionProperty2_test.go | 88 + .../completionEntryForUnionProperty_test.go | 49 + .../gen/completionEntryOnNarrowedType_test.go | 71 + .../tests/gen/completionExportFrom_test.go | 35 + ...pletionForComputedStringProperties_test.go | 50 + .../gen/completionForMetaProperty_test.go | 60 + ...uotedPropertyInPropertyAssignment1_test.go | 68 + ...uotedPropertyInPropertyAssignment2_test.go | 73 + ...uotedPropertyInPropertyAssignment3_test.go | 72 + ...uotedPropertyInPropertyAssignment4_test.go | 68 + .../gen/completionForStringLiteral11_test.go | 35 + .../gen/completionForStringLiteral12_test.go | 41 + .../gen/completionForStringLiteral13_test.go | 35 + .../gen/completionForStringLiteral14_test.go | 61 + .../gen/completionForStringLiteral15_test.go | 40 + .../gen/completionForStringLiteral16_test.go | 45 + .../gen/completionForStringLiteral2_test.go | 99 + .../gen/completionForStringLiteral3_test.go | 77 + .../gen/completionForStringLiteral4_test.go | 62 + .../gen/completionForStringLiteral5_test.go | 36 + .../gen/completionForStringLiteral8_test.go | 33 + .../completionForStringLiteralExport_test.go | 88 + ...tionForStringLiteralFromSignature2_test.go | 29 + ...etionForStringLiteralFromSignature_test.go | 40 + .../completionForStringLiteralImport1_test.go | 87 + .../completionForStringLiteralImport2_test.go | 78 + ...nForStringLiteralInIndexedAccess01_test.go | 52 + ...orStringLiteralNonrelativeImport10_test.go | 42 + ...orStringLiteralNonrelativeImport12_test.go | 42 + ...orStringLiteralNonrelativeImport14_test.go | 98 + ...orStringLiteralNonrelativeImport16_test.go | 61 + ...orStringLiteralNonrelativeImport17_test.go | 40 + ...orStringLiteralNonrelativeImport18_test.go | 40 + ...ForStringLiteralNonrelativeImport2_test.go | 49 + ...ForStringLiteralNonrelativeImport3_test.go | 54 + ...ForStringLiteralNonrelativeImport4_test.go | 46 + ...ForStringLiteralNonrelativeImport7_test.go | 40 + ...ForStringLiteralNonrelativeImport8_test.go | 61 + ...ForStringLiteralNonrelativeImport9_test.go | 47 + ...ngLiteralNonrelativeImportTypings1_test.go | 44 + ...ngLiteralNonrelativeImportTypings2_test.go | 42 + ...ngLiteralNonrelativeImportTypings3_test.go | 42 + ...ionForStringLiteralRelativeImport4_test.go | 75 + ...ionForStringLiteralRelativeImport5_test.go | 74 + ...ionForStringLiteralRelativeImport6_test.go | 55 + ...ngLiteralRelativeImportAllowJSTrue_test.go | 59 + ...nForStringLiteralWithDynamicImport_test.go | 87 + ...completionForStringLiteral_details_test.go | 115 + ...ForStringLiteral_mappedTypeMembers_test.go | 53 + ...nForStringLiteral_quotePreference1_test.go | 48 + ...nForStringLiteral_quotePreference2_test.go | 42 + ...nForStringLiteral_quotePreference3_test.go | 42 + ...nForStringLiteral_quotePreference4_test.go | 36 + ...nForStringLiteral_quotePreference5_test.go | 36 + ...nForStringLiteral_quotePreference6_test.go | 36 + ...nForStringLiteral_quotePreference7_test.go | 46 + ...nForStringLiteral_quotePreference8_test.go | 46 + ...onForStringLiteral_quotePreference_test.go | 48 + .../gen/completionForStringLiteral_test.go | 98 + ...ionImportMetaWithGlobalDeclaration_test.go | 83 + .../tests/gen/completionImportMeta_test.go | 47 + ...tionImportModuleSpecifierEndingDts_test.go | 49 + ...etionImportModuleSpecifierEndingJs_test.go | 52 + ...tionImportModuleSpecifierEndingJsx_test.go | 51 + ...etionImportModuleSpecifierEndingTs_test.go | 51 + ...rtModuleSpecifierEndingTsxPreserve_test.go | 50 + ...mportModuleSpecifierEndingTsxReact_test.go | 50 + ...pecifierEndingUnsupportedExtension_test.go | 44 + .../completionInAugmentedClassModule_test.go | 31 + .../tests/gen/completionInChecks1_test.go | 89 + ...ionLikeBody_includesPrimitiveTypes_test.go | 60 + ...mpletionInIncompleteCallExpression_test.go | 33 + .../gen/completionInJSDocFunctionNew_test.go | 37 + .../gen/completionInJSDocFunctionThis_test.go | 37 + .../completionInJsDocQualifiedNames_test.go | 47 + .../tests/gen/completionInJsDoc_test.go | 143 + .../completionInNamedImportLocation_test.go | 172 + .../tests/gen/completionInTypeOf1_test.go | 20 + .../tests/gen/completionInTypeOf2_test.go | 32 + .../gen/completionInUncheckedJSFile_test.go | 47 + ...etionInfoWithExplicitTypeArguments_test.go | 70 + ...ionInsideFunctionContainsArguments_test.go | 49 + ...xpressionWithInstantiatedClassType_test.go | 77 + .../tests/gen/completionJSDocNamePath_test.go | 36 + .../gen/completionListAfterAnyType_test.go | 35 + .../completionListAfterClassExtends_test.go | 39 + .../gen/completionListAfterFunction2_test.go | 57 + .../gen/completionListAfterFunction3_test.go | 44 + .../gen/completionListAfterFunction_test.go | 75 + ...ompletionListAfterInvalidCharacter_test.go | 34 + ...completionListAfterNumericLiteral1_test.go | 34 + .../completionListAfterNumericLiteral_test.go | 43 + .../completionListAfterObjectLiteral1_test.go | 30 + .../completionListAfterPropertyName_test.go | 83 + ...istAfterRegularExpressionLiteral01_test.go | 42 + ...istAfterRegularExpressionLiteral02_test.go | 18 + ...istAfterRegularExpressionLiteral03_test.go | 31 + ...istAfterRegularExpressionLiteral04_test.go | 30 + ...istAfterRegularExpressionLiteral05_test.go | 18 + ...ListAfterRegularExpressionLiteral1_test.go | 41 + .../gen/completionListAfterSlash_test.go | 18 + ...ompletionListAfterSpreadOperator01_test.go | 30 + .../completionListAfterStringLiteral1_test.go | 54 + ...eWithNoSubstitutionTemplateLiteral_test.go | 48 + ...ionListAndMemberListOnCommentedDot_test.go | 28 + ...onListAndMemberListOnCommentedLine_test.go | 18 + ...AndMemberListOnCommentedWhiteSpace_test.go | 28 + .../completionListAtBeginningOfFile01_test.go | 36 + ...nningOfIdentifierInArrowFunction01_test.go | 29 + ...onListAtDeclarationOfParameterType_test.go | 37 + .../tests/gen/completionListAtEOF1_test.go | 30 + .../tests/gen/completionListAtEOF2_test.go | 35 + .../tests/gen/completionListAtEOF_test.go | 56 + ...onListAtEndOfWordInArrowFunction01_test.go | 29 + ...onListAtEndOfWordInArrowFunction02_test.go | 36 + ...onListAtEndOfWordInArrowFunction03_test.go | 37 + ...tifierDefinitionLocations_Generics_test.go | 22 + ...dentifierDefinitionLocations_catch_test.go | 19 + ...ntifierDefinitionLocations_classes_test.go | 19 + ...rDefinitionLocations_destructuring_test.go | 32 + ...erDefinitionLocations_enumMembers2_test.go | 18 + ...ierDefinitionLocations_enumMembers_test.go | 18 + ...dentifierDefinitionLocations_enums_test.go | 20 + ...ifierDefinitionLocations_functions_test.go | 19 + ...entifierDefinitionLocations_infers_test.go | 20 + ...fierDefinitionLocations_interfaces_test.go | 19 + ...fierDefinitionLocations_properties_test.go | 48 + ...efinitionLocations_varDeclarations_test.go | 21 + .../completionListAtInvalidLocations_test.go | 47 + .../gen/completionListAtNodeBoundary_test.go | 44 + .../gen/completionListAtThisType_test.go | 42 + .../gen/completionListBeforeKeyword_test.go | 44 + .../completionListBeforeNewScope01_test.go | 34 + .../completionListBeforeNewScope02_test.go | 33 + ...letionListBuilderLocations_Modules_test.go | 38 + ...lderLocations_VariableDeclarations_test.go | 59 + ...ionListBuilderLocations_parameters_test.go | 33 + ...ionListBuilderLocations_properties_test.go | 33 + .../tests/gen/completionListCladule_test.go | 71 + ...WithSuperClassFromUnknownNamespace_test.go | 29 + .../gen/completionListClassMembers_test.go | 123 + .../completionListClassPrivateFields_test.go | 33 + .../gen/completionListClassThisJS_test.go | 45 + ...efaultTypeArgumentPositionTypeOnly_test.go | 28 + .../gen/completionListEnumMembers_test.go | 54 + .../gen/completionListEnumValues_test.go | 58 + .../gen/completionListForDerivedType1_test.go | 61 + .../completionListForExportEquals2_test.go | 42 + .../gen/completionListForExportEquals_test.go | 45 + .../completionListForGenericInstance1_test.go | 37 + ...AmbientModuleWithExportAssignment1_test.go | 23 + .../gen/completionListForObjectSpread_test.go | 93 + .../tests/gen/completionListForRest_test.go | 44 + ...istForShorthandPropertyAssignment2_test.go | 30 + ...ListForShorthandPropertyAssignment_test.go | 30 + ...stForTransitivelyExportedMembers01_test.go | 58 + ...stForTransitivelyExportedMembers02_test.go | 57 + ...stForTransitivelyExportedMembers03_test.go | 58 + ...stForTransitivelyExportedMembers04_test.go | 56 + ...completionListForUnicodeEscapeName_test.go | 59 + .../completionListFunctionExpression_test.go | 43 + .../gen/completionListFunctionMembers_test.go | 32 + ...ListImplementingInterfaceFunctions_test.go | 42 + ...nArrowFunctionInUnclosedCallSite01_test.go | 34 + ...InClassExpressionWithTypeParameter_test.go | 52 + .../completionListInClassStaticBlocks_test.go | 61 + .../completionListInClosedFunction01_test.go | 33 + .../completionListInClosedFunction02_test.go | 38 + .../completionListInClosedFunction03_test.go | 39 + .../completionListInClosedFunction04_test.go | 38 + .../completionListInClosedFunction06_test.go | 39 + .../completionListInClosedFunction07_test.go | 48 + ...osedObjectTypeLiteralInSignature01_test.go | 40 + ...osedObjectTypeLiteralInSignature02_test.go | 40 + ...osedObjectTypeLiteralInSignature03_test.go | 40 + ...osedObjectTypeLiteralInSignature04_test.go | 39 + .../gen/completionListInComments2_test.go | 17 + .../gen/completionListInComments3_test.go | 33 + .../gen/completionListInComments_test.go | 18 + ...ionListInContextuallyTypedArgument_test.go | 45 + .../gen/completionListInEmptyFile_test.go | 30 + .../completionListInExportClause01_test.go | 82 + .../completionListInExportClause02_test.go | 41 + .../completionListInExportClause03_test.go | 43 + ...completionListInExtendsClauseAtEOF_test.go | 32 + .../gen/completionListInExtendsClause_test.go | 52 + .../gen/completionListInFatArrow_test.go | 35 + ...ompletionListInFunctionDeclaration_test.go | 38 + .../completionListInImportClause01_test.go | 43 + .../completionListInImportClause02_test.go | 41 + .../completionListInImportClause03_test.go | 43 + .../completionListInImportClause05_test.go | 36 + .../completionListInImportClause06_test.go | 35 + ...iddleOfIdentifierInArrowFunction01_test.go | 29 + ...nNamedClassExpressionWithShadowing_test.go | 87 + ...mpletionListInNamedClassExpression_test.go | 49 + ...tionListInNamedFunctionExpression1_test.go | 36 + ...medFunctionExpressionWithShadowing_test.go | 57 + ...etionListInNamedFunctionExpression_test.go | 43 + ...pletionListInNamespaceImportName01_test.go | 20 + ...letionListInObjectBindingPattern01_test.go | 36 + ...letionListInObjectBindingPattern02_test.go | 35 + ...letionListInObjectBindingPattern03_test.go | 23 + ...letionListInObjectBindingPattern04_test.go | 36 + ...letionListInObjectBindingPattern05_test.go | 36 + ...letionListInObjectBindingPattern06_test.go | 23 + ...letionListInObjectBindingPattern07_test.go | 40 + ...letionListInObjectBindingPattern08_test.go | 39 + ...letionListInObjectBindingPattern09_test.go | 39 + ...letionListInObjectBindingPattern10_test.go | 52 + ...letionListInObjectBindingPattern11_test.go | 34 + ...letionListInObjectBindingPattern12_test.go | 38 + ...letionListInObjectBindingPattern13_test.go | 41 + ...letionListInObjectBindingPattern14_test.go | 20 + ...letionListInObjectBindingPattern15_test.go | 87 + ...letionListInObjectBindingPattern16_test.go | 42 + .../completionListInObjectLiteral2_test.go | 50 + .../completionListInObjectLiteral3_test.go | 36 + .../completionListInObjectLiteral4_test.go | 48 + .../completionListInObjectLiteral5_test.go | 95 + .../completionListInObjectLiteral6_test.go | 53 + .../completionListInObjectLiteral7_test.go | 38 + .../completionListInObjectLiteral8_test.go | 43 + ...tInObjectLiteralAssignmentPattern1_test.go | 31 + ...tInObjectLiteralAssignmentPattern2_test.go | 30 + ...tInObjectLiteralPropertyAssignment_test.go | 34 + ...teralThatIsParameterOfFunctionCall_test.go | 33 + .../gen/completionListInObjectLiteral_test.go | 39 + ...tionListInReturnWithContextualThis_test.go | 58 + ...nScope_doesNotIncludeAugmentations_test.go | 36 + .../tests/gen/completionListInScope_test.go | 139 + .../completionListInStringLiterals1_test.go | 28 + .../completionListInStringLiterals2_test.go | 29 + ...pletionListInTemplateLiteralParts1_test.go | 39 + ...stInTemplateLiteralPartsNegatives1_test.go | 19 + ...nListInTypeLiteralInTypeParameter1_test.go | 49 + ...nListInTypeLiteralInTypeParameter2_test.go | 39 + ...nListInTypeLiteralInTypeParameter3_test.go | 38 + ...nListInTypeLiteralInTypeParameter4_test.go | 38 + ...nListInTypeLiteralInTypeParameter5_test.go | 39 + ...nListInTypeLiteralInTypeParameter6_test.go | 39 + ...nListInTypeLiteralInTypeParameter7_test.go | 41 + ...nListInTypeLiteralInTypeParameter8_test.go | 74 + ...tInTypeParameterOfClassExpression1_test.go | 35 + ...ionListInTypeParameterOfTypeAlias1_test.go | 48 + ...ionListInTypeParameterOfTypeAlias2_test.go | 35 + ...ionListInTypeParameterOfTypeAlias3_test.go | 17 + ...mpletionListInTypedObjectLiterals2_test.go | 33 + ...mpletionListInTypedObjectLiterals3_test.go | 33 + ...mpletionListInTypedObjectLiterals4_test.go | 36 + ...tLiteralsWithPartialPropertyNames2_test.go | 36 + ...ctLiteralsWithPartialPropertyNames_test.go | 77 + ...ionListInUnclosedCommaExpression01_test.go | 31 + ...ionListInUnclosedCommaExpression02_test.go | 31 + ...onListInUnclosedDeleteExpression01_test.go | 30 + ...onListInUnclosedDeleteExpression02_test.go | 31 + ...nUnclosedElementAccessExpression01_test.go | 30 + ...nUnclosedElementAccessExpression02_test.go | 31 + .../completionListInUnclosedForLoop01_test.go | 29 + .../completionListInUnclosedForLoop02_test.go | 29 + ...completionListInUnclosedFunction01_test.go | 34 + ...completionListInUnclosedFunction02_test.go | 36 + ...completionListInUnclosedFunction03_test.go | 37 + ...completionListInUnclosedFunction04_test.go | 36 + ...completionListInUnclosedFunction05_test.go | 37 + ...completionListInUnclosedFunction06_test.go | 36 + ...completionListInUnclosedFunction07_test.go | 36 + ...completionListInUnclosedFunction08_test.go | 38 + ...completionListInUnclosedFunction09_test.go | 39 + ...completionListInUnclosedFunction10_test.go | 34 + ...completionListInUnclosedFunction11_test.go | 34 + ...completionListInUnclosedFunction12_test.go | 35 + ...completionListInUnclosedFunction13_test.go | 36 + ...completionListInUnclosedFunction14_test.go | 45 + ...completionListInUnclosedFunction15_test.go | 44 + ...completionListInUnclosedFunction16_test.go | 43 + ...completionListInUnclosedFunction17_test.go | 43 + ...completionListInUnclosedFunction18_test.go | 44 + ...completionListInUnclosedFunction19_test.go | 43 + ...tionListInUnclosedIndexSignature01_test.go | 32 + ...tionListInUnclosedIndexSignature02_test.go | 48 + ...tionListInUnclosedIndexSignature03_test.go | 32 + ...osedObjectTypeLiteralInSignature01_test.go | 40 + ...osedObjectTypeLiteralInSignature02_test.go | 40 + ...osedObjectTypeLiteralInSignature03_test.go | 40 + ...osedObjectTypeLiteralInSignature04_test.go | 39 + ...onListInUnclosedSpreadExpression01_test.go | 30 + ...onListInUnclosedSpreadExpression02_test.go | 31 + ...tionListInUnclosedTaggedTemplate01_test.go | 31 + ...tionListInUnclosedTaggedTemplate02_test.go | 31 + ...completionListInUnclosedTemplate01_test.go | 31 + ...completionListInUnclosedTemplate02_test.go | 31 + ...onListInUnclosedTypeOfExpression01_test.go | 30 + ...onListInUnclosedTypeOfExpression02_test.go | 31 + ...tionListInUnclosedVoidExpression01_test.go | 31 + .../gen/completionListInferKeyword_test.go | 37 + ...etionListInsideTargetTypedFunction_test.go | 36 + ...etionListInstanceProtectedMembers2_test.go | 129 + ...etionListInstanceProtectedMembers3_test.go | 52 + ...etionListInstanceProtectedMembers4_test.go | 52 + ...letionListInstanceProtectedMembers_test.go | 82 + .../completionListInvalidMemberNames2_test.go | 38 + ...ListInvalidMemberNames_escapeQuote_test.go | 61 + ...tInvalidMemberNames_startWithSpace_test.go | 40 + .../completionListInvalidMemberNames_test.go | 159 + ...MemberNames_withExistingIdentifier_test.go | 51 + .../tests/gen/completionListKeywords_test.go | 29 + .../gen/completionListModuleMembers_test.go | 64 + ...ionListNewIdentifierBindingElement_test.go | 17 + ...stNewIdentifierFunctionDeclaration_test.go | 28 + ...stNewIdentifierVariableDeclaration_test.go | 17 + ...ectMembersInTypeLocationWithTypeof_test.go | 53 + .../gen/completionListObjectMembers_test.go | 44 + .../gen/completionListOfGenericSymbol_test.go | 52 + .../completionListOfSplitInterface_test.go | 80 + .../tests/gen/completionListOfUnion_test.go | 60 + .../gen/completionListOnAliasedModule_test.go | 36 + .../gen/completionListOnAliases2_test.go | 151 + .../gen/completionListOnAliases3_test.go | 35 + .../tests/gen/completionListOnAliases_test.go | 51 + ...OnFunctionCallWithOptionalArgument_test.go | 30 + ...ompletionListOnMethodParameterName_test.go | 20 + .../gen/completionListOnParamInClass_test.go | 34 + .../tests/gen/completionListOnParam_test.go | 35 + ...etionListOnPrivateVariableInModule_test.go | 33 + .../tests/gen/completionListOnSuper_test.go | 44 + .../completionListOnVarBetweenModules_test.go | 40 + ...ListOutsideOfClosedArrowFunction01_test.go | 31 + ...ListOutsideOfClosedArrowFunction02_test.go | 31 + ...tsideOfClosedFunctionDeclaration01_test.go | 31 + .../completionListOutsideOfForLoop01_test.go | 29 + .../completionListOutsideOfForLoop02_test.go | 29 + .../gen/completionListPrivateMembers2_test.go | 49 + .../gen/completionListPrivateMembers3_test.go | 45 + .../gen/completionListPrivateMembers_test.go | 39 + ...ompletionListPrivateNamesAccessors_test.go | 101 + .../completionListPrivateNamesMethods_test.go | 92 + .../gen/completionListPrivateNames_test.go | 93 + .../completionListProtectedMembers_test.go | 96 + .../gen/completionListStaticMembers_test.go | 47 + ...pletionListStaticProtectedMembers2_test.go | 166 + ...pletionListStaticProtectedMembers3_test.go | 63 + ...mpletionListStaticProtectedMembers_test.go | 124 + ...nListStringParenthesizedExpression_test.go | 85 + ...pletionListStringParenthesizedType_test.go | 186 + .../gen/completionListSuperMembers_test.go | 57 + ...mpletionListWithAmbientDeclaration_test.go | 48 + .../tests/gen/completionListWithLabel_test.go | 65 + ...completionListWithUnresolvedModule_test.go | 37 + ...tionListWithoutVariableinitializer_test.go | 218 + .../completionList_getExportsOfModule_test.go | 34 + ...teralTypeAsIndexedAccessTypeObject_test.go | 56 + ...tionNoAutoInsertQuestionDotForThis_test.go | 54 + ...oInsertQuestionDotForTypeParameter_test.go | 51 + ...tQuestionDotWithUserPreferencesOff_test.go | 35 + .../gen/completionOfAwaitPromise1_test.go | 42 + .../gen/completionOfAwaitPromise2_test.go | 43 + .../gen/completionOfAwaitPromise3_test.go | 43 + .../gen/completionOfAwaitPromise4_test.go | 34 + .../gen/completionOfAwaitPromise5_test.go | 43 + .../gen/completionOfAwaitPromise6_test.go | 32 + .../gen/completionOfAwaitPromise7_test.go | 43 + .../gen/completionOfInterfaceAndVar_test.go | 40 + .../completionPreferredSuggestions1_test.go | 94 + ...PropertyShorthandForObjectLiteral2_test.go | 54 + ...PropertyShorthandForObjectLiteral3_test.go | 34 + ...PropertyShorthandForObjectLiteral4_test.go | 34 + .../completionReturnConstAssertion_test.go | 42 + .../gen/completionSatisfiesKeyword_test.go | 37 + .../tests/gen/completionTypeAssertion_test.go | 31 + .../tests/gen/completionTypeGuard_test.go | 51 + .../gen/completionTypeofExpressions_test.go | 43 + .../tests/gen/completionUsingKeyword_test.go | 49 + ...ithConditionalOperatorMissingColon_test.go | 30 + ...nWithDotFollowedByNamespaceKeyword_test.go | 39 + ...pletionWithNamespaceInsideFunction_test.go | 120 + .../fourslash/tests/gen/completions01_test.go | 48 + .../fourslash/tests/gen/completions03_test.go | 39 + ...mpletionsAfterAsyncInObjectLiteral_test.go | 29 + .../tests/gen/completionsAfterJSDoc_test.go | 38 + .../completionsAfterKeywordsInBlock_test.go | 88 + .../gen/completionsAfterLessThanToken_test.go | 37 + .../gen/completionsAssertKeyword_test.go | 132 + .../tests/gen/completionsAsserts_test.go | 32 + .../completionsAtGenericTypeArguments_test.go | 73 + .../gen/completionsAtTypeArguments_test.go | 35 + .../completionsAugmentedTypesClass2_test.go | 50 + .../gen/completionsBeforeRestArg1_test.go | 29 + ...completionsBigIntShowNoCompletions_test.go | 28 + ...lassPropertiesAfterPrivateProperty_test.go | 35 + ...ionsCombineOverloads_restParameter_test.go | 51 + ...letionsCombineOverloads_returnType_test.go | 34 + .../gen/completionsCombineOverloads_test.go | 34 + .../gen/completionsConditionalMember_test.go | 51 + .../gen/completionsDefaultExport_test.go | 37 + ...tKeywordWhenDefaultExportAvailable_test.go | 37 + .../gen/completionsDestructuring_test.go | 33 + .../gen/completionsDiscriminatedUnion_test.go | 31 + ...mpletionsDotDotDotInObjectLiteral1_test.go | 42 + ...sECMAPrivateMemberTriggerCharacter_test.go | 50 + .../gen/completionsECMAPrivateMember_test.go | 42 + .../completionsElementAccessNumeric_test.go | 75 + .../tests/gen/completionsExportImport_test.go | 46 + ...ResolutionOrderInImportDeclaration_test.go | 43 + ...etionsExternalModuleRenamedExports_test.go | 40 + ...LatterTypeParametersInConstraints1_test.go | 49 + ...ionsForRecursiveGenericTypesMember_test.go | 41 + ...sForSelfTypeParameterInConstraint1_test.go | 35 + ...ependingOnContexSensitiveSignature_test.go | 77 + .../gen/completionsGeneratorFunctions_test.go | 71 + .../completionsGenericIndexedAccess1_test.go | 40 + .../completionsGenericIndexedAccess2_test.go | 56 + .../completionsGenericIndexedAccess3_test.go | 69 + .../completionsGenericIndexedAccess4_test.go | 88 + .../completionsGenericIndexedAccess5_test.go | 55 + .../completionsGenericIndexedAccess6_test.go | 46 + ...tionsGenericTypeWithMultipleBases1_test.go | 51 + .../completionsGenericUnconstrained_test.go | 39 + ...ionAttributesEmptyModuleSpecifier1_test.go | 35 + ...ionAttributesErrorModuleSpecifier1_test.go | 35 + ...mpletionsImportDefaultExportCrash1_test.go | 60 + ...completionsImportOrExportSpecifier_test.go | 411 + ...mpletionsImport_computedSymbolName_test.go | 59 + ...Import_notFromUnrelatedNodeModules_test.go | 33 + ...completionsImport_promoteTypeOnly2_test.go | 38 + .../completionsImport_shadowedByLocal_test.go | 39 + ...mpletionsImport_umdDefaultNoCrash2_test.go | 63 + .../gen/completionsInExport_invalid_test.go | 39 + .../completionsInExport_moduleBlock_test.go | 127 + .../tests/gen/completionsInExport_test.go | 123 + .../tests/gen/completionsInJsxTag_test.go | 69 + .../tests/gen/completionsInRequire_test.go | 43 + ...mpletionsIndexSignatureConstraint1_test.go | 61 + .../gen/completionsInterfaceElement_test.go | 43 + .../completionsIsTypeOnlyCompletion_test.go | 35 + ...TagAttributesEmptyModuleSpecifier1_test.go | 37 + ...TagAttributesErrorModuleSpecifier1_test.go | 37 + ...SDocImportTagEmptyModuleSpecifier1_test.go | 36 + .../gen/completionsJSDocNoCrash1_test.go | 47 + .../gen/completionsJSDocNoCrash2_test.go | 43 + .../gen/completionsJSDocNoCrash3_test.go | 46 + .../completionsJsPropertyAssignment_test.go | 51 + ...ompletionsJsdocParamTypeBeforeName_test.go | 52 + .../tests/gen/completionsJsdocTag_test.go | 37 + .../gen/completionsJsdocTypeTagCast_test.go | 37 + .../gen/completionsJsxAttribute2_test.go | 86 + ...ompletionsJsxAttributeInitializer2_test.go | 63 + .../gen/completionsJsxExpression_test.go | 43 + .../tests/gen/completionsKeyof_test.go | 72 + .../gen/completionsKeywordsExtends_test.go | 36 + ...lyInArgumentWithNullableConstraint_test.go | 36 + ...rectlyInRestConstrainedToArrayType_test.go | 36 + ...rectlyInRestConstrainedToTupleType_test.go | 42 + ...alFromInferenceWithinInferredType1_test.go | 62 + ...alFromInferenceWithinInferredType2_test.go | 77 + ...alFromInferenceWithinInferredType3_test.go | 61 + ...onsLiteralMatchingGenericSignature_test.go | 35 + ...eralOnPropertyValueMatchingGeneric_test.go | 35 + .../gen/completionsLiteralOverload_test.go | 60 + .../tests/gen/completionsLiterals_test.go | 79 + .../completionsMergedDeclarations1_test.go | 58 + .../completionsMergedDeclarations2_test.go | 52 + ...ompletionsNamespaceMergedWithClass_test.go | 61 + ...mpletionsNamespaceMergedWithObject_test.go | 46 + .../gen/completionsNamespaceName_test.go | 57 + .../tests/gen/completionsNewTarget_test.go | 50 + .../gen/completionsNonExistentImport_test.go | 30 + .../completionsObjectLiteralMethod6_test.go | 40 + ...pletionsObjectLiteralModuleExports_test.go | 38 + ...bjectLiteralUnionStringMappingType_test.go | 62 + ...ectLiteralUnionTemplateLiteralType_test.go | 62 + ...ObjectLiteralWithPartialConstraint_test.go | 171 + .../completionsOptionalKindModifier_test.go | 44 + .../gen/completionsOptionalMethod_test.go | 31 + .../gen/completionsOverridingMethod10_test.go | 58 + .../gen/completionsOverridingMethod11_test.go | 65 + .../gen/completionsOverridingMethod14_test.go | 44 + .../gen/completionsOverridingMethod17_test.go | 46 + .../gen/completionsOverridingMethod1_test.go | 45 + .../gen/completionsOverridingMethod3_test.go | 44 + .../gen/completionsOverridingMethod4_test.go | 69 + .../gen/completionsOverridingMethod9_test.go | 50 + .../completionsOverridingMethodCrash1_test.go | 44 + .../completionsOverridingProperties1_test.go | 44 + .../completionsPathsJsonModuleWithAmd_test.go | 32 + ...JsonModuleWithoutResolveJsonModule_test.go | 31 + .../gen/completionsPathsJsonModule_test.go | 38 + ...completionsPathsRelativeJsonModule_test.go | 38 + .../gen/completionsPaths_importType_test.go | 78 + .../tests/gen/completionsPaths_kinds_test.go | 52 + ...s_pathMapping_nonTrailingWildcard1_test.go | 119 + ...s_pathMapping_notInNestedDirectory_test.go | 37 + ...sPaths_pathMapping_parentDirectory_test.go | 45 + .../gen/completionsPaths_pathMapping_test.go | 71 + .../completionsPrivateProperties_Js_test.go | 47 + .../completionsPropertiesPriorities_test.go | 68 + ...ionsPropertiesWithPromiseUnionType_test.go | 42 + ...ompletionsQuotedObjectLiteralUnion_test.go | 40 + .../gen/completionsRecommended_equals_test.go | 38 + ...onsRecommended_nonAccessibleSymbol_test.go | 33 + .../gen/completionsRecommended_switch_test.go | 40 + .../gen/completionsRecommended_union_test.go | 55 + .../gen/completionsRecursiveNamespace_test.go | 20 + ...completionsRedeclareModuleAsGlobal_test.go | 50 + .../gen/completionsSelfDeclaring2_test.go | 46 + .../gen/completionsSelfDeclaring3_test.go | 62 + ...nsStringLiteral_fromTypeConstraint_test.go | 48 + ...letionsStringsWithTriggerCharacter_test.go | 240 + .../gen/completionsSymbolMembers_test.go | 72 + .../gen/completionsTriggerCharacter_test.go | 184 + .../tests/gen/completionsTuple_test.go | 54 + .../completionsTypeAssertionKeywords_test.go | 35 + .../tests/gen/completionsTypeKeywords_test.go | 32 + .../gen/completionsTypeOnlyNamespace_test.go | 45 + ...pletionsUnionStringLiteralProperty_test.go | 125 + .../tests/gen/completionsUnion_test.go | 32 + .../gen/completionsUniqueSymbol1_test.go | 54 + .../gen/completionsWithDeprecatedTag1_test.go | 118 + .../gen/completionsWithDeprecatedTag2_test.go | 40 + .../gen/completionsWithDeprecatedTag3_test.go | 40 + .../gen/completionsWithDeprecatedTag5_test.go | 44 + .../gen/completionsWithDeprecatedTag6_test.go | 39 + .../gen/completionsWithDeprecatedTag7_test.go | 46 + .../gen/completionsWithDeprecatedTag9_test.go | 54 + ...ompletionsWithGenericStringLiteral_test.go | 32 + ...tionalPropertiesGenericConstructor_test.go | 52 + ...sWithOptionalPropertiesGenericDeep_test.go | 46 + ...hOptionalPropertiesGenericPartial2_test.go | 47 + ...hOptionalPropertiesGenericPartial3_test.go | 53 + ...thOptionalPropertiesGenericPartial_test.go | 62 + ...ionalPropertiesGenericValidBoolean_test.go | 42 + ...tionsWithOptionalPropertiesGeneric_test.go | 42 + .../completionsWithOptionalProperties_test.go | 46 + .../gen/completionsWithOverride1_test.go | 36 + .../gen/completionsWithOverride2_test.go | 42 + ...pletionsWithStringReplacementMode1_test.go | 192 + .../tests/gen/completionsWrappedClass_test.go | 43 + .../completionsWritingSpreadArgument_test.go | 34 + ...onstEnumQuickInfoAndCompletionList_test.go | 40 + .../constQuickInfoAndCompletionList_test.go | 105 + .../gen/constructorFindAllReferences1_test.go | 22 + .../gen/constructorFindAllReferences2_test.go | 22 + .../gen/constructorFindAllReferences3_test.go | 22 + .../gen/constructorFindAllReferences4_test.go | 22 + .../tests/gen/constructorQuickInfo_test.go | 23 + ...contextualTypingFromTypeAssertion1_test.go | 17 + .../contextualTypingGenericFunction1_test.go | 26 + ...tualTypingOfGenericCallSignatures1_test.go | 21 + .../contextualTypingReturnExpressions_test.go | 20 + ...llyTypedFunctionExpressionGeneric1_test.go | 26 + ...ectLiteralMethodDeclarationParam01_test.go | 41 + .../gen/contextuallyTypedParameters_test.go | 70 + .../gen/declarationMapGoToDefinition_test.go | 53 + ...psGoToDefinitionRelativeSourceRoot_test.go | 53 + ...finitionSameNameDifferentDirectory_test.go | 70 + .../declarationMapsOutOfDateMapping_test.go | 38 + .../defaultParamsAndContextualTypes_test.go | 28 + .../fourslash/tests/gen/definition01_test.go | 21 + .../gen/definitionNameOnEnumMember_test.go | 22 + .../fourslash/tests/gen/definition_test.go | 21 + .../deprecatedInheritedJSDocOverload_test.go | 41 + ...entHighlightAtInheritedProperties1_test.go | 22 + ...entHighlightAtInheritedProperties2_test.go | 22 + ...entHighlightAtInheritedProperties3_test.go | 26 + ...entHighlightAtInheritedProperties4_test.go | 26 + ...entHighlightAtInheritedProperties5_test.go | 30 + ...entHighlightAtInheritedProperties6_test.go | 30 + ...ghtAtParameterPropertyDeclaration1_test.go | 33 + ...ghtAtParameterPropertyDeclaration2_test.go | 34 + ...ghtAtParameterPropertyDeclaration3_test.go | 34 + .../documentHighlightDefaultInKeyword_test.go | 19 + .../documentHighlightDefaultInSwitch_test.go | 23 + .../gen/documentHighlightInExport1_test.go | 19 + .../gen/documentHighlightInKeyword_test.go | 24 + .../gen/documentHighlightInTypeExport_test.go | 28 + .../gen/documentHighlightJSDocTypedef_test.go | 32 + ...tHighlightMultilineTemplateStrings_test.go | 21 + .../documentHighlightTemplateStrings_test.go | 29 + ...documentHighlightVarianceModifiers_test.go | 19 + .../tests/gen/documentHighlights01_test.go | 21 + ...ocumentHighlightsInvalidGlobalThis_test.go | 20 + ...HighlightsInvalidModifierLocations_test.go | 26 + ...htsTypeParameterInHeritageClause01_test.go | 19 + .../gen/documentHighlights_33722_test.go | 27 + .../gen/documentHighlights_40082_test.go | 21 + .../documentHighlights_filesToSearch_test.go | 21 + .../gen/doubleUnderscoreCompletions_test.go | 48 + .../tests/gen/doubleUnderscoreRenames_test.go | 24 + .../duplicateFunctionImplementation_test.go | 22 + .../tests/gen/duplicateIndexers_test.go | 22 + .../tests/gen/duplicateTypeParameters_test.go | 18 + .../fourslash/tests/gen/editJsdocType_test.go | 24 + .../tests/gen/editTemplateConstraint_test.go | 22 + .../tests/gen/emptyArrayInference_test.go | 19 + .../gen/emptyExportFindReferences_test.go | 21 + .../fourslash/tests/gen/enumAddition_test.go | 18 + .../esModuleInteropFindAllReferences2_test.go | 23 + .../esModuleInteropFindAllReferences_test.go | 24 + ...sivelyLargeArrayLiteralCompletions_test.go | 39 + ...ainFilesNodeNextWithTypesReference_test.go | 52 + .../tests/gen/exportDefaultClass_test.go | 37 + .../tests/gen/exportDefaultFunction_test.go | 37 + .../gen/exportEqualCallableInterface_test.go | 40 + ...EqualNamespaceClassESModuleInterop_test.go | 43 + .../tests/gen/exportEqualsInterfaceA_test.go | 25 + .../gen/extendsKeywordCompletion1_test.go | 34 + .../gen/extendsKeywordCompletion2_test.go | 35 + ...ertyAccessExpressionHeritageClause_test.go | 22 + .../findAllReferencesDynamicImport1_test.go | 20 + .../findAllReferencesDynamicImport2_test.go | 23 + .../findAllReferencesDynamicImport3_test.go | 20 + ...erencesFilteringMappedTypeProperty_test.go | 19 + ...AllReferencesFromLinkTagReference1_test.go | 20 + ...AllReferencesFromLinkTagReference2_test.go | 24 + ...AllReferencesFromLinkTagReference3_test.go | 25 + ...AllReferencesFromLinkTagReference4_test.go | 21 + ...AllReferencesFromLinkTagReference5_test.go | 20 + .../gen/findAllReferencesImportMeta_test.go | 19 + .../findAllReferencesJSDocFunctionNew_test.go | 20 + ...findAllReferencesJSDocFunctionThis_test.go | 20 + .../findAllReferencesJsDocTypeLiteral_test.go | 28 + ...encesJsOverloadedFunctionParameter_test.go | 34 + ...lReferencesJsRequireDestructuring1_test.go | 23 + ...llReferencesJsRequireDestructuring_test.go | 25 + .../gen/findAllReferencesLinkTag1_test.go | 79 + .../gen/findAllReferencesLinkTag2_test.go | 42 + .../gen/findAllReferencesLinkTag3_test.go | 42 + ...ReferencesNonExistentExportBinding_test.go | 22 + ...eferencesOfConstructor_badOverload_test.go | 20 + .../findAllReferencesOfConstructor_test.go | 48 + .../gen/findAllReferencesOfJsonModule_test.go | 24 + .../gen/findAllReferencesTripleSlash_test.go | 27 + ...llReferencesUmdModuleAsGlobalConst_test.go | 49 + .../gen/findAllReferencesUndefined_test.go | 22 + .../tests/gen/findAllRefsBadImport_test.go | 17 + .../tests/gen/findAllRefsCatchClause_test.go | 20 + .../gen/findAllRefsClassExpression0_test.go | 23 + .../gen/findAllRefsClassExpression1_test.go | 22 + .../gen/findAllRefsClassExpression2_test.go | 22 + .../gen/findAllRefsClassStaticBlocks_test.go | 24 + ...ndAllRefsClassWithStaticThisAccess_test.go | 28 + .../gen/findAllRefsCommonJsRequire2_test.go | 23 + .../gen/findAllRefsCommonJsRequire3_test.go | 23 + .../gen/findAllRefsCommonJsRequire_test.go | 23 + .../findAllRefsConstructorFunctions_test.go | 25 + .../tests/gen/findAllRefsDeclareClass_test.go | 19 + .../gen/findAllRefsDefaultImport_test.go | 20 + .../tests/gen/findAllRefsDefinition_test.go | 18 + .../gen/findAllRefsDestructureGeneric_test.go | 21 + .../gen/findAllRefsDestructureGetter_test.go | 23 + .../gen/findAllRefsEnumAsNamespace_test.go | 18 + .../tests/gen/findAllRefsEnumMember_test.go | 18 + ...findAllRefsExportConstEqualToClass_test.go | 21 + ...lRefsExportDefaultClassConstructor_test.go | 19 + .../tests/gen/findAllRefsExportEquals_test.go | 21 + .../findAllRefsExportNotAtTopLevel_test.go | 20 + .../findAllRefsForComputedProperties2_test.go | 27 + .../findAllRefsForComputedProperties_test.go | 27 + .../gen/findAllRefsForDefaultExport01_test.go | 22 + .../gen/findAllRefsForDefaultExport02_test.go | 26 + .../gen/findAllRefsForDefaultExport03_test.go | 29 + .../gen/findAllRefsForDefaultExport04_test.go | 22 + .../gen/findAllRefsForDefaultExport09_test.go | 43 + ...dAllRefsForDefaultExport_anonymous_test.go | 20 + ...ndAllRefsForDefaultExport_reExport_test.go | 23 + .../gen/findAllRefsForDefaultExport_test.go | 24 + .../gen/findAllRefsForDefaultKeyword_test.go | 28 + ...findAllRefsForFunctionExpression01_test.go | 23 + .../gen/findAllRefsForImportCallType_test.go | 24 + .../gen/findAllRefsForImportCall_test.go | 28 + .../gen/findAllRefsForMappedType_test.go | 21 + .../tests/gen/findAllRefsForModule_test.go | 26 + ...dAllRefsForObjectLiteralProperties_test.go | 23 + .../gen/findAllRefsForObjectSpread_test.go | 23 + .../tests/gen/findAllRefsForRest_test.go | 24 + ...ForStaticInstanceMethodInheritance_test.go | 37 + ...rStaticInstancePropertyInheritance_test.go | 37 + .../findAllRefsForStringLiteralTypes_test.go | 18 + .../gen/findAllRefsForStringLiteral_test.go | 26 + .../gen/findAllRefsForUMDModuleAlias1_test.go | 23 + ...llRefsForVariableInExtendsClause01_test.go | 18 + ...llRefsForVariableInExtendsClause02_test.go | 21 + ...efsForVariableInImplementsClause01_test.go | 18 + ...ndAllRefsGlobalThisKeywordInModule_test.go | 19 + .../tests/gen/findAllRefsImportEquals_test.go | 18 + .../tests/gen/findAllRefsImportType_test.go | 22 + .../gen/findAllRefsInClassExpression_test.go | 20 + .../gen/findAllRefsIndexedAccessTypes_test.go | 24 + .../findAllRefsInheritedProperties1_test.go | 24 + .../findAllRefsInheritedProperties2_test.go | 24 + .../findAllRefsInheritedProperties3_test.go | 32 + .../findAllRefsInheritedProperties4_test.go | 28 + .../findAllRefsInheritedProperties5_test.go | 28 + .../gen/findAllRefsInsideTemplates1_test.go | 18 + .../gen/findAllRefsInsideTemplates2_test.go | 18 + .../gen/findAllRefsInsideWithBlock_test.go | 24 + .../tests/gen/findAllRefsIsDefinition_test.go | 41 + .../gen/findAllRefsJsDocImportTag2_test.go | 42 + .../gen/findAllRefsJsDocImportTag3_test.go | 42 + .../gen/findAllRefsJsDocImportTag4_test.go | 42 + .../gen/findAllRefsJsDocImportTag5_test.go | 21 + .../gen/findAllRefsJsDocImportTag_test.go | 29 + ...ndAllRefsJsDocTemplateTag_class_js_test.go | 25 + .../findAllRefsJsDocTemplateTag_class_test.go | 18 + ...llRefsJsDocTemplateTag_function_js_test.go | 23 + ...ndAllRefsJsDocTemplateTag_function_test.go | 18 + .../gen/findAllRefsJsDocTypeDef_js_test.go | 29 + .../tests/gen/findAllRefsJsDocTypeDef_test.go | 18 + ...ndAllRefsJsThisPropertyAssignment2_test.go | 40 + ...indAllRefsJsThisPropertyAssignment_test.go | 40 + ...ndAllRefsMappedType_nonHomomorphic_test.go | 21 + .../tests/gen/findAllRefsMappedType_test.go | 22 + ...issingModulesOverlappingSpecifiers_test.go | 19 + .../gen/findAllRefsModuleDotExports_test.go | 21 + .../gen/findAllRefsNoImportClause_test.go | 20 + ...ubstitutionTemplateLiteralNoCrash1_test.go | 17 + .../tests/gen/findAllRefsNonModule_test.go | 28 + ...AllRefsNonexistentPropertyNoCrash1_test.go | 61 + ...ObjectBindingElementPropertyName01_test.go | 23 + ...ObjectBindingElementPropertyName02_test.go | 23 + ...ObjectBindingElementPropertyName03_test.go | 23 + ...ObjectBindingElementPropertyName04_test.go | 27 + ...ObjectBindingElementPropertyName05_test.go | 24 + ...ObjectBindingElementPropertyName06_test.go | 31 + ...ObjectBindingElementPropertyName07_test.go | 19 + ...ObjectBindingElementPropertyName10_test.go | 23 + ...dAllRefsOfConstructor_withModifier_test.go | 20 + .../tests/gen/findAllRefsOnDecorators_test.go | 27 + .../gen/findAllRefsOnDefinition2_test.go | 28 + .../tests/gen/findAllRefsOnDefinition_test.go | 37 + .../gen/findAllRefsOnImportAliases2_test.go | 24 + .../gen/findAllRefsOnImportAliases_test.go | 25 + ...AllRefsOnPrivateParameterProperty1_test.go | 24 + ...lRefsParameterPropertyDeclaration1_test.go | 22 + ...lRefsParameterPropertyDeclaration2_test.go | 22 + ...lRefsParameterPropertyDeclaration3_test.go | 22 + ...terPropertyDeclaration_inheritance_test.go | 26 + .../gen/findAllRefsPrimitiveJsDoc_test.go | 22 + .../findAllRefsPrivateNameAccessors_test.go | 36 + .../gen/findAllRefsPrivateNameMethods_test.go | 34 + .../findAllRefsPrivateNameProperties_test.go | 35 + ...ertyContextuallyTypedByTypeParam01_test.go | 32 + .../gen/findAllRefsReExport_broken2_test.go | 18 + .../gen/findAllRefsReExport_broken_test.go | 18 + ...declaredPropertyInDerivedInterface_test.go | 25 + .../tests/gen/findAllRefsRootSymbols_test.go | 20 + ...indAllRefsThisKeywordMultipleFiles_test.go | 25 + .../tests/gen/findAllRefsThisKeyword_test.go | 39 + ...RefsTypeParameterInMergedInterface_test.go | 18 + .../gen/findAllRefsTypedef_importType_test.go | 24 + .../tests/gen/findAllRefsTypedef_test.go | 26 + .../tests/gen/findAllRefsTypeofImport_test.go | 20 + .../gen/findAllRefsUnionProperty_test.go | 29 + .../gen/findAllRefsUnresolvedSymbols1_test.go | 22 + .../gen/findAllRefsUnresolvedSymbols2_test.go | 24 + .../gen/findAllRefsUnresolvedSymbols3_test.go | 24 + ...AllRefsWithLeadingUnderscoreNames1_test.go | 22 + ...AllRefsWithLeadingUnderscoreNames2_test.go | 22 + ...AllRefsWithLeadingUnderscoreNames3_test.go | 22 + ...AllRefsWithLeadingUnderscoreNames4_test.go | 22 + ...AllRefsWithLeadingUnderscoreNames5_test.go | 28 + ...AllRefsWithLeadingUnderscoreNames6_test.go | 28 + ...AllRefsWithLeadingUnderscoreNames7_test.go | 19 + ...AllRefsWithLeadingUnderscoreNames8_test.go | 19 + ...AllRefsWithLeadingUnderscoreNames9_test.go | 19 + ...fsWithShorthandPropertyAssignment2_test.go | 24 + ...efsWithShorthandPropertyAssignment_test.go | 21 + .../tests/gen/findAllRefsWriteAccess_test.go | 33 + .../gen/findAllRefs_importType_js4_test.go | 28 + ...lRefs_importType_meaningAtLocation_test.go | 22 + .../gen/findAllRefs_importType_named_test.go | 22 + ...indAllRefs_importType_typeofImport_test.go | 21 + .../tests/gen/findAllRefs_jsEnum_test.go | 23 + ...ndReferencesAcrossMultipleProjects_test.go | 24 + .../tests/gen/findReferencesAfterEdit_test.go | 29 + ...encesBindingPatternInJsdocNoCrash1_test.go | 42 + ...encesBindingPatternInJsdocNoCrash2_test.go | 42 + ...ndReferencesDefinitionDisplayParts_test.go | 25 + .../gen/findReferencesJSXTagName2_test.go | 19 + .../gen/findReferencesJSXTagName3_test.go | 36 + .../gen/findReferencesJSXTagName_test.go | 25 + .../gen/findReferencesSeeTagInTs_test.go | 21 + .../gen/fixingTypeParametersQuickInfo_test.go | 21 + .../tests/gen/forwardReference_test.go | 35 + ...icCallSignaturesInNonGenericTypes1_test.go | 25 + ...icCallSignaturesInNonGenericTypes2_test.go | 23 + .../genericCallsWithOptionalParams1_test.go | 27 + .../gen/genericCloduleCompletionList_test.go | 32 + .../genericCombinatorWithConstraints1_test.go | 21 + .../tests/gen/genericCombinators3_test.go | 32 + ...icDerivedTypeAcrossModuleBoundary1_test.go | 29 + .../genericFunctionWithGenericParams1_test.go | 20 + .../genericInterfacesWithConstraints1_test.go | 28 + ...icTypeAliasIntersectionCompletions_test.go | 58 + ...ericTypeParamUnrelatedToArguments1_test.go | 30 + ...ricTypeWithMultipleBases1MultiFile_test.go | 56 + .../genericWithSpecializedProperties1_test.go | 29 + .../genericWithSpecializedProperties2_test.go | 29 + .../genericWithSpecializedProperties3_test.go | 29 + .../gen/getJavaScriptCompletions10_test.go | 38 + .../gen/getJavaScriptCompletions11_test.go | 41 + .../gen/getJavaScriptCompletions12_test.go | 86 + .../gen/getJavaScriptCompletions13_test.go | 70 + .../gen/getJavaScriptCompletions14_test.go | 40 + .../gen/getJavaScriptCompletions15_test.go | 101 + .../gen/getJavaScriptCompletions18_test.go | 61 + .../gen/getJavaScriptCompletions19_test.go | 66 + .../gen/getJavaScriptCompletions1_test.go | 37 + .../gen/getJavaScriptCompletions20_test.go | 60 + .../gen/getJavaScriptCompletions21_test.go | 44 + .../gen/getJavaScriptCompletions22_test.go | 22 + .../gen/getJavaScriptCompletions2_test.go | 37 + .../gen/getJavaScriptCompletions3_test.go | 37 + .../gen/getJavaScriptCompletions4_test.go | 37 + .../gen/getJavaScriptCompletions5_test.go | 41 + .../gen/getJavaScriptCompletions8_test.go | 39 + .../gen/getJavaScriptCompletions9_test.go | 39 + .../getJavaScriptCompletions_tsCheck_test.go | 35 + .../getJavaScriptGlobalCompletions1_test.go | 44 + .../tests/gen/getJavaScriptQuickInfo1_test.go | 20 + .../tests/gen/getJavaScriptQuickInfo2_test.go | 20 + .../tests/gen/getJavaScriptQuickInfo3_test.go | 20 + .../tests/gen/getJavaScriptQuickInfo4_test.go | 20 + .../tests/gen/getJavaScriptQuickInfo5_test.go | 20 + .../tests/gen/getJavaScriptQuickInfo6_test.go | 20 + .../tests/gen/getJavaScriptQuickInfo7_test.go | 31 + .../tests/gen/getJavaScriptQuickInfo8_test.go | 70 + ...etJavaScriptSyntacticDiagnostics24_test.go | 27 + .../gen/getOccurrencesAbstract01_test.go | 28 + .../gen/getOccurrencesAbstract02_test.go | 28 + .../gen/getOccurrencesAbstract03_test.go | 29 + .../tests/gen/getOccurrencesAfterEdit_test.go | 26 + .../gen/getOccurrencesAsyncAwait2_test.go | 24 + .../gen/getOccurrencesAsyncAwait3_test.go | 20 + .../gen/getOccurrencesAsyncAwait_test.go | 35 + ...urrencesClassExpressionConstructor_test.go | 29 + ...tOccurrencesClassExpressionPrivate_test.go | 33 + ...etOccurrencesClassExpressionPublic_test.go | 33 + ...currencesClassExpressionStaticThis_test.go | 62 + ...etOccurrencesClassExpressionStatic_test.go | 35 + .../getOccurrencesClassExpressionThis_test.go | 60 + .../tests/gen/getOccurrencesConst01_test.go | 24 + .../tests/gen/getOccurrencesConst04_test.go | 21 + .../gen/getOccurrencesConstructor2_test.go | 34 + .../gen/getOccurrencesConstructor_test.go | 34 + .../tests/gen/getOccurrencesDeclare1_test.go | 69 + .../tests/gen/getOccurrencesDeclare2_test.go | 70 + .../tests/gen/getOccurrencesDeclare3_test.go | 77 + .../tests/gen/getOccurrencesExport1_test.go | 69 + .../tests/gen/getOccurrencesExport2_test.go | 70 + .../tests/gen/getOccurrencesExport3_test.go | 77 + .../tests/gen/getOccurrencesIfElse2_test.go | 38 + .../tests/gen/getOccurrencesIfElse3_test.go | 38 + .../gen/getOccurrencesIfElseBroken_test.go | 25 + .../tests/gen/getOccurrencesIfElse_test.go | 38 + ...rrencesIsDefinitionOfArrowFunction_test.go | 18 + ...rencesIsDefinitionOfBindingPattern_test.go | 18 + .../getOccurrencesIsDefinitionOfClass_test.go | 23 + ...ncesIsDefinitionOfComputedProperty_test.go | 19 + .../getOccurrencesIsDefinitionOfEnum_test.go | 21 + ...getOccurrencesIsDefinitionOfExport_test.go | 21 + ...tOccurrencesIsDefinitionOfFunction_test.go | 19 + ...sIsDefinitionOfInterfaceClassMerge_test.go | 29 + ...OccurrencesIsDefinitionOfInterface_test.go | 20 + ...OccurrencesIsDefinitionOfNamespace_test.go | 20 + ...sIsDefinitionOfNumberNamedProperty_test.go | 18 + ...OccurrencesIsDefinitionOfParameter_test.go | 19 + ...sIsDefinitionOfStringNamedProperty_test.go | 18 + ...OccurrencesIsDefinitionOfTypeAlias_test.go | 18 + ...tOccurrencesIsDefinitionOfVariable_test.go | 33 + .../getOccurrencesLoopBreakContinue2_test.go | 79 + .../getOccurrencesLoopBreakContinue3_test.go | 79 + .../getOccurrencesLoopBreakContinue4_test.go | 79 + .../getOccurrencesLoopBreakContinue5_test.go | 79 + .../getOccurrencesLoopBreakContinue_test.go | 79 + .../getOccurrencesModifiersNegatives1_test.go | 50 + ...ccurrencesNonStringImportAssertion_test.go | 19 + ...currencesNonStringImportAttributes_test.go | 19 + ...getOccurrencesOfAnonymousFunction2_test.go | 25 + .../getOccurrencesOfAnonymousFunction_test.go | 21 + .../gen/getOccurrencesOfDecorators_test.go | 25 + .../getOccurrencesOfUndefinedSymbol_test.go | 29 + .../tests/gen/getOccurrencesPrivate1_test.go | 70 + .../tests/gen/getOccurrencesPrivate2_test.go | 70 + ...urrencesPropertyInAliasedInterface_test.go | 34 + .../gen/getOccurrencesProtected1_test.go | 70 + .../gen/getOccurrencesProtected2_test.go | 70 + .../tests/gen/getOccurrencesPublic1_test.go | 70 + .../tests/gen/getOccurrencesPublic2_test.go | 70 + .../tests/gen/getOccurrencesReadonly1_test.go | 20 + .../tests/gen/getOccurrencesReadonly2_test.go | 20 + .../tests/gen/getOccurrencesReadonly3_test.go | 26 + .../tests/gen/getOccurrencesReturn2_test.go | 35 + .../tests/gen/getOccurrencesReturn3_test.go | 35 + .../tests/gen/getOccurrencesReturn_test.go | 35 + .../gen/getOccurrencesSetAndGet2_test.go | 39 + .../gen/getOccurrencesSetAndGet3_test.go | 39 + .../tests/gen/getOccurrencesSetAndGet_test.go | 39 + .../tests/gen/getOccurrencesStatic1_test.go | 70 + .../getOccurrencesStringLiteralTypes_test.go | 19 + .../gen/getOccurrencesStringLiterals_test.go | 19 + .../tests/gen/getOccurrencesSuper2_test.go | 66 + .../tests/gen/getOccurrencesSuper3_test.go | 29 + .../gen/getOccurrencesSuperNegatives_test.go | 36 + .../tests/gen/getOccurrencesSuper_test.go | 66 + .../getOccurrencesSwitchCaseDefault2_test.go | 34 + .../getOccurrencesSwitchCaseDefault3_test.go | 32 + .../getOccurrencesSwitchCaseDefault_test.go | 34 + .../tests/gen/getOccurrencesThis2_test.go | 156 + .../tests/gen/getOccurrencesThis3_test.go | 156 + .../tests/gen/getOccurrencesThis4_test.go | 156 + .../tests/gen/getOccurrencesThis5_test.go | 156 + .../tests/gen/getOccurrencesThis_test.go | 156 + .../tests/gen/getOccurrencesThrow2_test.go | 58 + .../tests/gen/getOccurrencesThrow3_test.go | 58 + .../tests/gen/getOccurrencesThrow4_test.go | 58 + .../tests/gen/getOccurrencesThrow5_test.go | 58 + .../tests/gen/getOccurrencesThrow6_test.go | 30 + .../tests/gen/getOccurrencesThrow7_test.go | 35 + .../tests/gen/getOccurrencesThrow8_test.go | 35 + .../tests/gen/getOccurrencesThrow_test.go | 58 + .../tests/gen/getOccurrencesYield_test.go | 29 + ...rtySymbolsFromBaseTypesDoesntCrash_test.go | 21 + .../getQuickInfoForIntersectionTypes_test.go | 21 + .../tests/gen/getRenameInfoTests1_test.go | 20 + .../tests/gen/getRenameInfoTests2_test.go | 20 + .../tests/gen/globalThisCompletion_test.go | 34 + ...ToDefinitionAcrossMultipleProjects_test.go | 30 + .../tests/gen/goToDefinitionAlias_test.go | 36 + .../tests/gen/goToDefinitionAmbiants_test.go | 29 + ...ToDefinitionApparentTypeProperties_test.go | 23 + .../tests/gen/goToDefinitionAwait1_test.go | 22 + .../tests/gen/goToDefinitionAwait2_test.go | 17 + .../tests/gen/goToDefinitionAwait3_test.go | 25 + .../tests/gen/goToDefinitionAwait4_test.go | 21 + .../gen/goToDefinitionBuiltInTypes_test.go | 20 + .../gen/goToDefinitionBuiltInValues_test.go | 21 + ...oDefinitionCSSPatternAmbientModule_test.go | 26 + .../goToDefinitionClassConstructors_test.go | 42 + .../goToDefinitionClassStaticBlocks_test.go | 24 + ...tionConstructorOfClassExpression01_test.go | 38 + ...ssWhenClassIsPrecededByNamespace01_test.go | 26 + ...goToDefinitionConstructorOverloads_test.go | 30 + .../goToDefinitionDecoratorOverloads_test.go | 29 + .../tests/gen/goToDefinitionDecorator_test.go | 29 + ...goToDefinitionDestructuredRequire1_test.go | 23 + ...goToDefinitionDestructuredRequire2_test.go | 26 + ...oDefinitionDifferentFileIndirectly_test.go | 34 + .../gen/goToDefinitionDifferentFile_test.go | 28 + .../gen/goToDefinitionDynamicImport1_test.go | 20 + .../gen/goToDefinitionDynamicImport2_test.go | 22 + .../gen/goToDefinitionDynamicImport3_test.go | 19 + .../gen/goToDefinitionDynamicImport4_test.go | 19 + .../gen/goToDefinitionExpandoClass1_test.go | 27 + .../gen/goToDefinitionExpandoClass2_test.go | 29 + ...goToDefinitionExpandoElementAccess_test.go | 19 + .../goToDefinitionExternalModuleName2_test.go | 22 + .../goToDefinitionExternalModuleName3_test.go | 23 + .../goToDefinitionExternalModuleName4_test.go | 18 + .../goToDefinitionExternalModuleName5_test.go | 20 + .../goToDefinitionExternalModuleName6_test.go | 22 + .../goToDefinitionExternalModuleName7_test.go | 22 + .../goToDefinitionExternalModuleName8_test.go | 22 + .../goToDefinitionExternalModuleName9_test.go | 22 + .../goToDefinitionExternalModuleName_test.go | 21 + ...DefinitionFunctionOverloadsInClass_test.go | 26 + .../goToDefinitionFunctionOverloads_test.go | 23 + .../gen/goToDefinitionFunctionType_test.go | 27 + .../goToDefinitionImplicitConstructor_test.go | 19 + .../tests/gen/goToDefinitionImport1_test.go | 20 + .../tests/gen/goToDefinitionImport2_test.go | 20 + .../tests/gen/goToDefinitionImport3_test.go | 20 + .../gen/goToDefinitionImportedNames10_test.go | 25 + .../gen/goToDefinitionImportedNames11_test.go | 25 + .../gen/goToDefinitionImportedNames2_test.go | 27 + .../gen/goToDefinitionImportedNames3_test.go | 34 + .../gen/goToDefinitionImportedNames4_test.go | 27 + .../gen/goToDefinitionImportedNames5_test.go | 27 + .../gen/goToDefinitionImportedNames6_test.go | 27 + .../gen/goToDefinitionImportedNames7_test.go | 23 + .../gen/goToDefinitionImportedNames8_test.go | 24 + .../gen/goToDefinitionImportedNames9_test.go | 25 + .../gen/goToDefinitionImportedNames_test.go | 27 + .../tests/gen/goToDefinitionImports_test.go | 30 + .../goToDefinitionInMemberDeclaration_test.go | 34 + .../gen/goToDefinitionInTypeArgument_test.go | 21 + .../gen/goToDefinitionIndexSignature2_test.go | 20 + .../gen/goToDefinitionIndexSignature_test.go | 34 + .../gen/goToDefinitionInstanceof1_test.go | 20 + .../gen/goToDefinitionInstanceof2_test.go | 23 + ...oDefinitionInterfaceAfterImplement_test.go | 26 + .../gen/goToDefinitionJsDocImportTag1_test.go | 24 + .../gen/goToDefinitionJsDocImportTag2_test.go | 24 + .../gen/goToDefinitionJsDocImportTag3_test.go | 24 + .../gen/goToDefinitionJsDocImportTag4_test.go | 24 + .../gen/goToDefinitionJsDocImportTag5_test.go | 29 + .../gen/goToDefinitionJsModuleExports_test.go | 22 + ...DefinitionJsModuleNameAtImportName_test.go | 29 + .../gen/goToDefinitionJsModuleName_test.go | 21 + .../tests/gen/goToDefinitionJsxCall_test.go | 23 + .../tests/gen/goToDefinitionJsxNotSet_test.go | 25 + .../tests/gen/goToDefinitionLabels_test.go | 24 + .../tests/gen/goToDefinitionMember_test.go | 20 + .../gen/goToDefinitionMetaProperty_test.go | 22 + .../gen/goToDefinitionMethodOverloads_test.go | 31 + .../tests/gen/goToDefinitionModifiers_test.go | 31 + .../goToDefinitionMultipleDefinitions_test.go | 40 + ...initionNewExpressionTargetNotClass_test.go | 25 + ...ObjectBindingElementPropertyName01_test.go | 23 + ...DefinitionObjectLiteralProperties1_test.go | 27 + ...oDefinitionObjectLiteralProperties_test.go | 29 + .../gen/goToDefinitionObjectSpread_test.go | 22 + ...verloadsInMultiplePropertyAccesses_test.go | 24 + .../goToDefinitionOverriddenMember10_test.go | 26 + .../goToDefinitionOverriddenMember11_test.go | 28 + .../goToDefinitionOverriddenMember12_test.go | 23 + .../goToDefinitionOverriddenMember13_test.go | 23 + .../goToDefinitionOverriddenMember14_test.go | 24 + .../goToDefinitionOverriddenMember15_test.go | 24 + .../goToDefinitionOverriddenMember16_test.go | 28 + .../goToDefinitionOverriddenMember17_test.go | 28 + .../goToDefinitionOverriddenMember18_test.go | 28 + .../goToDefinitionOverriddenMember19_test.go | 28 + .../goToDefinitionOverriddenMember1_test.go | 23 + .../goToDefinitionOverriddenMember20_test.go | 28 + .../goToDefinitionOverriddenMember21_test.go | 26 + .../goToDefinitionOverriddenMember22_test.go | 26 + .../goToDefinitionOverriddenMember23_test.go | 28 + .../goToDefinitionOverriddenMember24_test.go | 28 + .../goToDefinitionOverriddenMember25_test.go | 26 + .../goToDefinitionOverriddenMember26_test.go | 26 + .../goToDefinitionOverriddenMember2_test.go | 24 + .../goToDefinitionOverriddenMember3_test.go | 24 + .../goToDefinitionOverriddenMember4_test.go | 25 + .../goToDefinitionOverriddenMember5_test.go | 22 + .../goToDefinitionOverriddenMember6_test.go | 23 + .../goToDefinitionOverriddenMember7_test.go | 20 + .../goToDefinitionOverriddenMember8_test.go | 26 + .../goToDefinitionOverriddenMember9_test.go | 26 + ...oToDefinitionPartialImplementation_test.go | 30 + .../gen/goToDefinitionPrimitives_test.go | 17 + .../gen/goToDefinitionPrivateName_test.go | 27 + .../goToDefinitionPropertyAssignment_test.go | 22 + .../tests/gen/goToDefinitionRest_test.go | 24 + .../tests/gen/goToDefinitionReturn1_test.go | 19 + .../tests/gen/goToDefinitionReturn2_test.go | 21 + .../tests/gen/goToDefinitionReturn3_test.go | 21 + .../tests/gen/goToDefinitionReturn4_test.go | 17 + .../tests/gen/goToDefinitionReturn5_test.go | 21 + .../tests/gen/goToDefinitionReturn6_test.go | 21 + .../tests/gen/goToDefinitionReturn7_test.go | 21 + .../tests/gen/goToDefinitionSameFile_test.go | 28 + ...goToDefinitionSatisfiesExpression1_test.go | 22 + .../goToDefinitionScriptImportServer_test.go | 26 + .../gen/goToDefinitionScriptImport_test.go | 25 + ...finitionShadowVariableInsideModule_test.go | 20 + .../gen/goToDefinitionShadowVariable_test.go | 21 + .../goToDefinitionShorthandProperty01_test.go | 22 + .../goToDefinitionShorthandProperty02_test.go | 19 + .../goToDefinitionShorthandProperty03_test.go | 22 + .../goToDefinitionShorthandProperty04_test.go | 23 + .../goToDefinitionShorthandProperty05_test.go | 23 + .../goToDefinitionShorthandProperty06_test.go | 23 + ...ToDefinitionSignatureAlias_require_test.go | 25 + .../tests/gen/goToDefinitionSimple_test.go | 21 + .../gen/goToDefinitionSourceUnit_test.go | 30 + .../gen/goToDefinitionSwitchCase1_test.go | 19 + .../gen/goToDefinitionSwitchCase2_test.go | 19 + .../gen/goToDefinitionSwitchCase3_test.go | 23 + .../gen/goToDefinitionSwitchCase4_test.go | 23 + .../gen/goToDefinitionSwitchCase5_test.go | 17 + .../gen/goToDefinitionSwitchCase6_test.go | 19 + .../gen/goToDefinitionSwitchCase7_test.go | 19 + ...oDefinitionTaggedTemplateOverloads_test.go | 22 + .../tests/gen/goToDefinitionThis_test.go | 23 + .../gen/goToDefinitionTypeOnlyImport_test.go | 24 + .../gen/goToDefinitionTypePredicate_test.go | 20 + ...ToDefinitionTypeReferenceDirective_test.go | 22 + .../gen/goToDefinitionTypeofThis_test.go | 23 + .../goToDefinitionUndefinedSymbols_test.go | 20 + .../goToDefinitionUnionTypeProperty1_test.go | 30 + .../goToDefinitionUnionTypeProperty2_test.go | 32 + .../goToDefinitionUnionTypeProperty3_test.go | 24 + .../goToDefinitionUnionTypeProperty4_test.go | 33 + ...ionUnionTypeProperty_discriminated_test.go | 36 + .../goToDefinitionVariableAssignment1_test.go | 23 + .../goToDefinitionVariableAssignment2_test.go | 22 + .../goToDefinitionVariableAssignment3_test.go | 21 + .../goToDefinitionVariableAssignment_test.go | 24 + .../tests/gen/goToDefinitionYield1_test.go | 23 + .../tests/gen/goToDefinitionYield2_test.go | 22 + .../tests/gen/goToDefinitionYield3_test.go | 25 + .../tests/gen/goToDefinitionYield4_test.go | 19 + ...inition_filteringGenericMappedType_test.go | 37 + ...goToDefinition_filteringMappedType_test.go | 19 + .../gen/goToDefinition_mappedType_test.go | 19 + .../tests/gen/goToDefinition_super_test.go | 34 + .../gen/goToDefinition_untypedModule_test.go | 21 + .../gen/goToModuleAliasDefinition_test.go | 21 + .../gotoDefinitionConstructorFunction_test.go | 28 + ...oDefinitionInObjectBindingPattern1_test.go | 23 + ...oDefinitionInObjectBindingPattern2_test.go | 18 + .../tests/gen/gotoDefinitionLinkTag1_test.go | 40 + .../tests/gen/gotoDefinitionLinkTag2_test.go | 20 + .../tests/gen/gotoDefinitionLinkTag3_test.go | 24 + .../tests/gen/gotoDefinitionLinkTag4_test.go | 25 + .../tests/gen/gotoDefinitionLinkTag5_test.go | 21 + .../tests/gen/gotoDefinitionLinkTag6_test.go | 20 + ...ertyAccessExpressionHeritageClause_test.go | 22 + .../gen/gotoDefinitionSatisfiesTag_test.go | 27 + .../tests/gen/gotoDefinitionThrowsTag_test.go | 22 + ...ghlightsForExportFromUnfoundModule_test.go | 27 + .../tests/gen/hoverOverComment_test.go | 22 + .../tests/gen/hoverOverPrivateName_test.go | 37 + ...ackageJsonExportsSpecifierEndsInTs_test.go | 47 + ...nsPackageJsonExportsTrailingSlash1_test.go | 61 + ...tionsPackageJsonImportsConditions1_test.go | 42 + ...mpletionsPackageJsonImportsLength1_test.go | 90 + ...mpletionsPackageJsonImportsLength2_test.go | 89 + ...pletionsPackageJsonImportsPattern2_test.go | 40 + ...kageJsonImportsPattern_capsInPath1_test.go | 39 + ...kageJsonImportsPattern_capsInPath2_test.go | 39 + ...etionsPackageJsonImportsPattern_js_test.go | 39 + ...onsPackageJsonImportsPattern_js_ts_test.go | 39 + ...mpletionsPackageJsonImportsPattern_test.go | 39 + ...onsPackageJsonImportsPattern_ts_js_test.go | 39 + ...etionsPackageJsonImportsPattern_ts_test.go | 39 + ...onsPackageJsonImportsPattern_ts_ts_test.go | 39 + ...rtCompletionsPackageJsonImports_js_test.go | 39 + ...rtCompletionsPackageJsonImports_ts_test.go | 39 + .../gen/importCompletions_importsMap1_test.go | 52 + .../gen/importCompletions_importsMap2_test.go | 60 + .../gen/importCompletions_importsMap3_test.go | 60 + .../gen/importCompletions_importsMap4_test.go | 50 + .../gen/importCompletions_importsMap5_test.go | 51 + .../gen/importStatementCompletions4_test.go | 42 + ...tementCompletions_noPatternAmbient_test.go | 40 + ...tatementCompletions_pnpmTransitive_test.go | 45 + .../tests/gen/importTypeCompletions2_test.go | 32 + .../gen/importTypeMemberCompletions_test.go | 163 + .../gen/importTypeNodeGoToDefinition_test.go | 25 + .../tests/gen/importValueUsedAsType_test.go | 23 + ...ncrementalParsingInsertIntoMethod1_test.go | 24 + .../indexSignatureWithoutAnnotation_test.go | 25 + .../tests/gen/indexerReturnTypes1_test.go | 91 + .../gen/indirectClassInstantiation_test.go | 74 + .../tests/gen/indirectJsRequireRename_test.go | 24 + ...rgumentBeforeOverloadedConstructor_test.go | 23 + ...tInterfaceAndCheckTypeLiteralField_test.go | 22 + .../gen/insertMethodCallAboveOthers_test.go | 20 + .../gen/insertPublicBeforeSetter_test.go | 21 + .../gen/insertSecondTryCatchBlock_test.go | 19 + .../insertVarAfterEmptyTypeParamList_test.go | 20 + .../gen/instanceTypesForGenericType1_test.go | 23 + .../gen/intellisenseInObjectLiteral_test.go | 23 + .../isDefinitionAcrossGlobalProjects_test.go | 97 + .../isDefinitionAcrossModuleProjects_test.go | 136 + ...sDefinitionInterfaceImplementation_test.go | 26 + .../tests/gen/isDefinitionOverloads_test.go | 22 + .../gen/isDefinitionShorthandProperty_test.go | 18 + .../gen/isDefinitionSingleImport_test.go | 20 + .../gen/isDefinitionSingleReference_test.go | 18 + .../tests/gen/javaScriptClass2_test.go | 27 + .../tests/gen/javaScriptClass3_test.go | 28 + .../tests/gen/javaScriptClass4_test.go | 46 + .../tests/gen/javaScriptModules12_test.go | 145 + .../tests/gen/javaScriptModules13_test.go | 81 + .../tests/gen/javaScriptModules14_test.go | 52 + .../tests/gen/javaScriptModules18_test.go | 33 + .../tests/gen/javaScriptModules19_test.go | 79 + .../tests/gen/javaScriptModulesError1_test.go | 21 + .../javaScriptModulesWithBackticks_test.go | 34 + .../tests/gen/javascriptModules20_test.go | 45 + .../tests/gen/javascriptModules21_test.go | 46 + .../tests/gen/javascriptModules23_test.go | 34 + .../tests/gen/javascriptModules25_test.go | 35 + ...javascriptModulesTypeImportAsValue_test.go | 37 + .../gen/javascriptModulesTypeImport_test.go | 42 + .../tests/gen/jsDocAliasQuickInfo_test.go | 24 + .../fourslash/tests/gen/jsDocAugments_test.go | 32 + .../gen/jsDocDontBreakWithNamespaces_test.go | 33 + .../fourslash/tests/gen/jsDocExtends_test.go | 32 + .../tests/gen/jsDocForTypeAlias_test.go | 19 + .../gen/jsDocFunctionSignatures10_test.go | 28 + .../gen/jsDocFunctionSignatures11_test.go | 23 + .../gen/jsDocFunctionSignatures12_test.go | 36 + .../gen/jsDocFunctionSignatures13_test.go | 22 + .../gen/jsDocFunctionSignatures3_test.go | 72 + .../gen/jsDocFunctionSignatures5_test.go | 30 + .../gen/jsDocFunctionSignatures6_test.go | 26 + .../gen/jsDocFunctionSignatures7_test.go | 30 + .../gen/jsDocFunctionSignatures8_test.go | 31 + ...sDocFunctionTypeCompletionsNoCrash_test.go | 32 + .../tests/gen/jsDocGenerics1_test.go | 52 + .../tests/gen/jsDocGenerics2_test.go | 31 + .../gen/jsDocIndentationPreservation1_test.go | 25 + .../gen/jsDocIndentationPreservation2_test.go | 25 + .../gen/jsDocIndentationPreservation3_test.go | 25 + .../tests/gen/jsDocInheritDoc_test.go | 77 + .../gen/jsDocPropertyDescription10_test.go | 23 + .../gen/jsDocPropertyDescription11_test.go | 25 + .../gen/jsDocPropertyDescription12_test.go | 23 + .../gen/jsDocPropertyDescription1_test.go | 27 + .../gen/jsDocPropertyDescription2_test.go | 23 + .../gen/jsDocPropertyDescription3_test.go | 25 + .../gen/jsDocPropertyDescription4_test.go | 23 + .../gen/jsDocPropertyDescription5_test.go | 23 + .../gen/jsDocPropertyDescription6_test.go | 28 + .../gen/jsDocPropertyDescription7_test.go | 23 + .../gen/jsDocPropertyDescription8_test.go | 23 + .../gen/jsDocPropertyDescription9_test.go | 29 + .../fourslash/tests/gen/jsDocSee1_test.go | 34 + .../fourslash/tests/gen/jsDocSee2_test.go | 30 + .../fourslash/tests/gen/jsDocSee3_test.go | 23 + .../fourslash/tests/gen/jsDocSee4_test.go | 32 + .../tests/gen/jsDocSee_rename1_test.go | 22 + .../tests/gen/jsDocSignature-43394_test.go | 21 + .../tests/gen/jsDocTagsWithHyphen_test.go | 44 + .../tests/gen/jsDocTypeTagQuickInfo1_test.go | 44 + .../tests/gen/jsDocTypeTagQuickInfo2_test.go | 42 + .../tests/gen/jsDocTypedefQuickInfo1_test.go | 44 + ...bjectDefinePropertyRenameLocations_test.go | 29 + ...jsQuickInfoGenerallyAcceptableSize_test.go | 224 + .../tests/gen/jsRequireQuickInfo_test.go | 21 + .../gen/jsdocCallbackTagRename01_test.go | 26 + .../tests/gen/jsdocCallbackTag_test.go | 47 + .../gen/jsdocExtendsTagCompletion_test.go | 31 + .../gen/jsdocImplementsTagCompletion_test.go | 31 + .../gen/jsdocImportTagCompletion1_test.go | 34 + .../fourslash/tests/gen/jsdocLink1_test.go | 28 + .../fourslash/tests/gen/jsdocLink2_test.go | 30 + .../fourslash/tests/gen/jsdocLink3_test.go | 31 + .../fourslash/tests/gen/jsdocLink4_test.go | 30 + .../fourslash/tests/gen/jsdocLink5_test.go | 24 + .../fourslash/tests/gen/jsdocLink6_test.go | 26 + .../gen/jsdocLink_findAllReferences1_test.go | 21 + .../tests/gen/jsdocLink_rename1_test.go | 21 + .../tests/gen/jsdocNullableUnion_test.go | 66 + .../gen/jsdocOnInheritedMembers1_test.go | 32 + .../gen/jsdocOnInheritedMembers2_test.go | 32 + .../gen/jsdocOverloadTagCompletion_test.go | 34 + .../gen/jsdocParamTagSpecialKeywords_test.go | 36 + .../gen/jsdocParameterNameCompletion_test.go | 72 + .../tests/gen/jsdocPropTagCompletion_test.go | 32 + .../gen/jsdocPropertyTagCompletion_test.go | 30 + .../tests/gen/jsdocReturnsTag_test.go | 28 + .../gen/jsdocSatisfiesTagCompletion1_test.go | 34 + .../gen/jsdocSatisfiesTagCompletion2_test.go | 36 + ...jsdocSatisfiesTagFindAllReferences_test.go | 27 + .../tests/gen/jsdocSatisfiesTagRename_test.go | 27 + .../jsdocTemplatePrototypeCompletions_test.go | 40 + .../gen/jsdocTemplateTagCompletion_test.go | 31 + .../gen/jsdocThrowsTagCompletion_test.go | 30 + .../jsdocThrowsTag_findAllReferences_test.go | 21 + .../tests/gen/jsdocThrowsTag_rename_test.go | 21 + .../tests/gen/jsdocTypedefTag1_test.go | 41 + .../tests/gen/jsdocTypedefTag2_test.go | 59 + .../gen/jsdocTypedefTagGoToDefinition_test.go | 33 + .../gen/jsdocTypedefTagNamespace_test.go | 59 + .../tests/gen/jsdocTypedefTagRename01_test.go | 27 + .../tests/gen/jsdocTypedefTagRename02_test.go | 24 + .../tests/gen/jsdocTypedefTagRename03_test.go | 30 + .../tests/gen/jsdocTypedefTagRename04_test.go | 36 + .../jsdocTypedefTagSemanticMeaning0_test.go | 22 + .../jsdocTypedefTagSemanticMeaning1_test.go | 22 + .../tests/gen/jsdocTypedefTagServices_test.go | 32 + ...TypedefTagTypeExpressionCompletion_test.go | 191 + .../tests/gen/jsdocTypedefTag_test.go | 227 + .../tests/gen/jsxAriaLikeCompletions_test.go | 45 + ...jsxElementMissingOpeningTagNoCrash_test.go | 19 + ...eferencesOnRuntimeImportWithPaths1_test.go | 43 + .../gen/jsxQualifiedTagCompletion_test.go | 37 + .../tests/gen/jsxSpreadReference_test.go | 33 + .../tests/gen/lambdaThisMembers_test.go | 37 + .../gen/letQuickInfoAndCompletionList_test.go | 81 + .../fourslash/tests/gen/localFunction_test.go | 27 + .../tests/gen/localGetReferences_test.go | 199 + .../memberCompletionFromFunctionCall_test.go | 35 + ...emberCompletionOnRightSideOfImport_test.go | 17 + .../memberCompletionOnTypeParameters2_test.go | 42 + .../memberCompletionOnTypeParameters_test.go | 67 + .../gen/memberListAfterDoubleDot_test.go | 17 + .../gen/memberListAfterSingleDot_test.go | 17 + .../tests/gen/memberListErrorRecovery_test.go | 37 + .../gen/memberListInFunctionCall2_test.go | 43 + .../gen/memberListInFunctionCall_test.go | 37 + .../gen/memberListInReopenedEnum_test.go | 53 + .../tests/gen/memberListInWithBlock2_test.go | 23 + .../tests/gen/memberListInWithBlock3_test.go | 30 + .../tests/gen/memberListInWithBlock_test.go | 44 + .../memberListInsideObjectLiterals_test.go | 74 + .../tests/gen/memberListOfClass_test.go | 44 + ...memberListOfEnumFromExternalModule_test.go | 35 + .../gen/memberListOfEnumInModule_test.go | 36 + .../gen/memberListOfExportedClass_test.go | 41 + ...erListOfModuleAfterInvalidCharater_test.go | 37 + .../memberListOfModuleBeforeKeyword_test.go | 42 + .../tests/gen/memberListOfModule_test.go | 40 + .../memberListOfVarInArrowExpression_test.go | 45 + .../gen/memberListOnConstructorType_test.go | 28 + .../gen/memberListOnContextualThis_test.go | 38 + .../gen/memberListOnExplicitThis_test.go | 71 + .../gen/memberListOnFunctionParameter_test.go | 35 + ...emberListOnThisInClassWithPrivates_test.go | 50 + .../tests/gen/memberlistOnDDot_test.go | 21 + .../tests/gen/moduleEnumModule_test.go | 26 + .../gen/moduleMembersOfGenericType_test.go | 36 + ...oduleReexportedIntoGlobalQuickInfo_test.go | 27 + .../tsgo/fourslash/tests/gen/ngProxy1_test.go | 30 + .../tsgo/fourslash/tests/gen/ngProxy2_test.go | 30 + .../tsgo/fourslash/tests/gen/ngProxy3_test.go | 30 + ...ListOnCommentsInsideObjectLiterals_test.go | 26 + ...CurrentOrLaterParametersInDefaults_test.go | 119 + .../tests/gen/noQuickInfoForLabel_test.go | 22 + .../tests/gen/noQuickInfoInWhitespace_test.go | 30 + .../tests/gen/noTypeParameterInLHS_test.go | 21 + .../gen/nodeModulesImportCompletions1_test.go | 88 + .../tests/gen/nonExistingImport_test.go | 33 + .../tests/gen/numericPropertyNames_test.go | 17 + .../objectLiteralBindingInParameter_test.go | 44 + .../fourslash/tests/gen/occurrences01_test.go | 26 + .../fourslash/tests/gen/occurrences02_test.go | 20 + .../gen/overloadObjectLiteralCrash_test.go | 24 + .../tests/gen/overloadQuickInfo_test.go | 32 + .../packageJsonImportsFailedLookups_test.go | 29 + .../gen/parameterWithDestructuring_test.go | 28 + .../parameterWithNestedDestructuring_test.go | 22 + .../tests/gen/parameterlessSetter_test.go | 25 + ...sAllowModuleAugmentationExtensions_test.go | 34 + .../pathCompletionsAllowTsExtensions_test.go | 60 + ...eJsonExportsBundlerNoNodeCondition_test.go | 49 + ...PackageJsonExportsCustomConditions_test.go | 47 + ...etionsPackageJsonExportsWildcard10_test.go | 47 + ...etionsPackageJsonExportsWildcard11_test.go | 46 + ...etionsPackageJsonExportsWildcard12_test.go | 106 + ...letionsPackageJsonExportsWildcard1_test.go | 73 + ...letionsPackageJsonExportsWildcard2_test.go | 81 + ...letionsPackageJsonExportsWildcard3_test.go | 76 + ...letionsPackageJsonExportsWildcard4_test.go | 119 + ...letionsPackageJsonExportsWildcard5_test.go | 84 + ...letionsPackageJsonExportsWildcard6_test.go | 49 + ...letionsPackageJsonExportsWildcard7_test.go | 44 + ...letionsPackageJsonExportsWildcard8_test.go | 46 + ...letionsPackageJsonExportsWildcard9_test.go | 46 + ...eJsonImportsBundlerNoNodeCondition_test.go | 49 + ...PackageJsonImportsCustomConditions_test.go | 47 + ...onImportsIgnoreMatchingNodeModule1_test.go | 37 + ...onImportsIgnoreMatchingNodeModule2_test.go | 42 + ...geJsonImportsOnlyFromClosestScope1_test.go | 53 + ...ckageJsonImportsSrcNoDistWildcard1_test.go | 75 + ...ckageJsonImportsSrcNoDistWildcard2_test.go | 88 + ...ckageJsonImportsSrcNoDistWildcard3_test.go | 84 + ...ckageJsonImportsSrcNoDistWildcard4_test.go | 134 + ...ckageJsonImportsSrcNoDistWildcard5_test.go | 82 + ...ckageJsonImportsSrcNoDistWildcard6_test.go | 56 + ...ckageJsonImportsSrcNoDistWildcard7_test.go | 51 + ...ckageJsonImportsSrcNoDistWildcard8_test.go | 51 + ...ckageJsonImportsSrcNoDistWildcard9_test.go | 52 + ...etionsPackageJsonImportsWildcard10_test.go | 47 + ...etionsPackageJsonImportsWildcard11_test.go | 46 + ...etionsPackageJsonImportsWildcard12_test.go | 118 + ...letionsPackageJsonImportsWildcard1_test.go | 68 + ...letionsPackageJsonImportsWildcard2_test.go | 81 + ...letionsPackageJsonImportsWildcard3_test.go | 76 + ...letionsPackageJsonImportsWildcard4_test.go | 119 + ...letionsPackageJsonImportsWildcard5_test.go | 74 + ...letionsPackageJsonImportsWildcard6_test.go | 49 + ...letionsPackageJsonImportsWildcard7_test.go | 44 + ...letionsPackageJsonImportsWildcard8_test.go | 46 + ...letionsPackageJsonImportsWildcard9_test.go | 45 + .../pathCompletionsTypesVersionsLocal_test.go | 40 + ...hCompletionsTypesVersionsWildcard1_test.go | 63 + ...hCompletionsTypesVersionsWildcard2_test.go | 49 + ...hCompletionsTypesVersionsWildcard3_test.go | 78 + ...hCompletionsTypesVersionsWildcard4_test.go | 65 + ...hCompletionsTypesVersionsWildcard5_test.go | 87 + ...hCompletionsTypesVersionsWildcard6_test.go | 87 + .../tests/gen/processInvalidSyntax1_test.go | 29 + .../tests/gen/promiseTyping1_test.go | 31 + .../tests/gen/promiseTyping2_test.go | 35 + .../propertyDuplicateIdentifierError_test.go | 21 + .../gen/protoPropertyInObjectLiteral_test.go | 59 + .../protoVarInContextualObjectLiteral_test.go | 313 + ...sibleWithOuterScopeUnderscoreProto_test.go | 42 + .../tests/gen/prototypeProperty_test.go | 36 + .../fourslash/tests/gen/publicBreak_test.go | 19 + ...aration-with-variable-entity-names_test.go | 44 + .../tests/gen/quickInfoAlias_test.go | 38 + ...odeNotReusedWhenTypeNotEquivalent1_test.go | 43 + .../quickInfoAssignToExistingClass_test.go | 29 + ...foAtPropWithAmbientDeclarationInJs_test.go | 27 + ...kInfoBindingPatternInJsdocNoCrash1_test.go | 22 + .../tests/gen/quickInfoCallProperty_test.go | 23 + ...nfoCircularInstantiationExpression_test.go | 18 + .../tests/gen/quickInfoClassKeyword_test.go | 19 + .../gen/quickInfoCommentsClassMembers_test.go | 147 + .../tests/gen/quickInfoCommentsClass_test.go | 73 + .../quickInfoCommentsCommentParsing_test.go | 217 + ...ickInfoCommentsFunctionDeclaration_test.go | 33 + ...uickInfoCommentsFunctionExpression_test.go | 42 + .../gen/quickInfoContextualTyping_test.go | 317 + ...OptionalParameterFromIntersection1_test.go | 20 + ...isplayPartsArrowFunctionExpression_test.go | 20 + ...uickInfoDisplayPartsClassAccessors_test.go | 51 + ...InfoDisplayPartsClassAutoAccessors_test.go | 45 + ...ckInfoDisplayPartsClassConstructor_test.go | 42 + ...oDisplayPartsClassDefaultAnonymous_test.go | 18 + ...kInfoDisplayPartsClassDefaultNamed_test.go | 18 + ...ickInfoDisplayPartsClassIncomplete_test.go | 18 + .../quickInfoDisplayPartsClassMethod_test.go | 35 + ...quickInfoDisplayPartsClassProperty_test.go | 35 + .../gen/quickInfoDisplayPartsClass_test.go | 20 + .../gen/quickInfoDisplayPartsConst_test.go | 37 + .../gen/quickInfoDisplayPartsEnum1_test.go | 34 + .../gen/quickInfoDisplayPartsEnum2_test.go | 34 + .../gen/quickInfoDisplayPartsEnum3_test.go | 34 + .../gen/quickInfoDisplayPartsEnum4_test.go | 22 + ...nfoDisplayPartsExternalModuleAlias_test.go | 26 + ...ickInfoDisplayPartsExternalModules_test.go | 28 + ...InfoDisplayPartsFunctionExpression_test.go | 24 + ...InfoDisplayPartsFunctionIncomplete_test.go | 20 + .../gen/quickInfoDisplayPartsFunction_test.go | 35 + .../gen/quickInfoDisplayPartsIife_test.go | 18 + ...ckInfoDisplayPartsInterfaceMembers_test.go | 26 + .../quickInfoDisplayPartsInterface_test.go | 19 + ...nfoDisplayPartsInternalModuleAlias_test.go | 30 + .../gen/quickInfoDisplayPartsLet_test.go | 37 + ...InfoDisplayPartsLiteralLikeNames01_test.go | 29 + ...quickInfoDisplayPartsLocalFunction_test.go | 38 + .../gen/quickInfoDisplayPartsModules_test.go | 28 + .../quickInfoDisplayPartsParameters_test.go | 23 + .../quickInfoDisplayPartsTypeAlias_test.go | 20 + ...foDisplayPartsTypeParameterInClass_test.go | 36 + ...ParameterInFunctionLikeInTypeAlias_test.go | 18 + ...isplayPartsTypeParameterInFunction_test.go | 24 + ...splayPartsTypeParameterInInterface_test.go | 34 + ...splayPartsTypeParameterInTypeAlias_test.go | 18 + .../gen/quickInfoDisplayPartsUsing_test.go | 21 + ...foDisplayPartsVarWithStringTypes01_test.go | 19 + .../gen/quickInfoDisplayPartsVar_test.go | 31 + .../quickInfoElementAccessDeclaration_test.go | 23 + ...foEnumMembersAcceptNonAsciiStrings_test.go | 25 + ...ExportAssignmentOfGenericInterface_test.go | 25 + .../tests/gen/quickInfoExtendArray_test.go | 23 + .../gen/quickInfoForAliasedGeneric_test.go | 26 + ...oForArgumentsPropertyNameInJsMode1_test.go | 27 + ...oForArgumentsPropertyNameInJsMode2_test.go | 23 + .../gen/quickInfoForConstAssertions_test.go | 20 + .../gen/quickInfoForConstDeclaration_test.go | 17 + .../quickInfoForConstTypeReference_test.go | 17 + ...uallyTypedArrowFunctionInSuperCall_test.go | 27 + ...allyTypedFunctionInReturnStatement_test.go | 30 + .../quickInfoForContextuallyTypedIife_test.go | 36 + ...InfoForContextuallyTypedParameters_test.go | 44 + .../tests/gen/quickInfoForDecorators_test.go | 21 + ...rDerivedGenericTypeWithConstructor_test.go | 29 + ...rDestructuringShorthandInitializer_test.go | 19 + .../quickInfoForFunctionDeclaration_test.go | 27 + .../quickInfoForGenericConstraints1_test.go | 18 + ...quickInfoForGenericPrototypeMember_test.go | 22 + ...ForGenericTaggedTemplateExpression_test.go | 35 + .../gen/quickInfoForGetterAndSetter_test.go | 34 + .../tests/gen/quickInfoForIn_test.go | 18 + ...InfoForIndexerResultWithConstraint_test.go | 23 + .../gen/quickInfoForJSDocCodefence_test.go | 34 + .../gen/quickInfoForJSDocUnknownTag_test.go | 62 + .../quickInfoForJSDocWithHttpLinks_test.go | 36 + ...nfoForJSDocWithUnresolvedHttpLinks_test.go | 23 + .../gen/quickInfoForNamedTupleMember_test.go | 17 + ...kInfoForObjectBindingElementName01_test.go | 24 + ...kInfoForObjectBindingElementName02_test.go | 23 + ...kInfoForObjectBindingElementName03_test.go | 26 + ...kInfoForObjectBindingElementName04_test.go | 32 + ...kInfoForObjectBindingElementName05_test.go | 29 + ...kInfoForObjectBindingElementName06_test.go | 34 + ...ObjectBindingElementPropertyName01_test.go | 23 + ...ObjectBindingElementPropertyName02_test.go | 23 + ...ObjectBindingElementPropertyName04_test.go | 24 + .../gen/quickInfoForOverloadOnConst1_test.go | 41 + .../tests/gen/quickInfoForRequire_test.go | 24 + .../gen/quickInfoForShorthandProperty_test.go | 26 + .../quickInfoForSyntaxErrorNoError_test.go | 20 + ...ckInfoForTypeParameterInTypeAlias1_test.go | 25 + ...ckInfoForTypeParameterInTypeAlias2_test.go | 26 + .../gen/quickInfoForTypeofParameter_test.go | 21 + .../gen/quickInfoForUMDModuleAlias_test.go | 24 + .../gen/quickInfoFromContextualType_test.go | 22 + .../quickInfoFromContextualUnionType1_test.go | 29 + .../quickInfoFromEmptyBlockComment_test.go | 20 + .../gen/quickInfoFunctionCheckType_test.go | 17 + .../gen/quickInfoFunctionKeyword_test.go | 19 + .../tests/gen/quickInfoGenerics_test.go | 54 + .../tests/gen/quickInfoGetterSetter_test.go | 31 + .../tests/gen/quickInfoImportMeta_test.go | 30 + .../gen/quickInfoImportNonunicodePath_test.go | 20 + .../quickInfoInFunctionTypeReference_test.go | 20 + .../quickInfoInInvalidIndexSignature_test.go | 17 + .../gen/quickInfoInJsdocInTsFile1_test.go | 55 + .../gen/quickInfoInObjectLiteral_test.go | 34 + .../gen/quickInfoInOptionalChain_test.go | 39 + .../tests/gen/quickInfoInWithBlock_test.go | 22 + .../tests/gen/quickInfoInheritDoc2_test.go | 33 + .../tests/gen/quickInfoInheritDoc3_test.go | 34 + .../tests/gen/quickInfoInheritDoc4_test.go | 27 + .../tests/gen/quickInfoInheritDoc5_test.go | 29 + .../tests/gen/quickInfoInheritDoc6_test.go | 27 + .../tests/gen/quickInfoInheritDoc_test.go | 76 + .../gen/quickInfoJSDocAtBeforeSpace_test.go | 29 + .../tests/gen/quickInfoJSDocBackticks_test.go | 36 + .../gen/quickInfoJSDocFunctionNew_test.go | 21 + .../gen/quickInfoJSDocFunctionThis_test.go | 21 + .../tests/gen/quickInfoJSDocTags_test.go | 74 + .../tests/gen/quickInfoJSExport_test.go | 27 + .../tests/gen/quickInfoJsDocAlias_test.go | 26 + ...quickInfoJsDocGetterSetterNoCrash1_test.go | 28 + .../gen/quickInfoJsDocGetterSetter_test.go | 60 + .../gen/quickInfoJsDocInheritage_test.go | 120 + ...DocNonDiscriminatedUnionSharedProp_test.go | 57 + .../tests/gen/quickInfoJsDocTags10_test.go | 25 + .../tests/gen/quickInfoJsDocTags11_test.go | 26 + .../tests/gen/quickInfoJsDocTags12_test.go | 25 + .../tests/gen/quickInfoJsDocTags13_test.go | 41 + .../tests/gen/quickInfoJsDocTags14_test.go | 26 + .../tests/gen/quickInfoJsDocTags15_test.go | 47 + .../tests/gen/quickInfoJsDocTags16_test.go | 32 + .../tests/gen/quickInfoJsDocTags1_test.go | 30 + .../tests/gen/quickInfoJsDocTags2_test.go | 19 + .../tests/gen/quickInfoJsDocTags3_test.go | 34 + .../tests/gen/quickInfoJsDocTags4_test.go | 37 + .../tests/gen/quickInfoJsDocTags5_test.go | 39 + .../tests/gen/quickInfoJsDocTags6_test.go | 40 + .../tests/gen/quickInfoJsDocTags7_test.go | 28 + .../tests/gen/quickInfoJsDocTags8_test.go | 28 + .../tests/gen/quickInfoJsDocTags9_test.go | 28 + .../gen/quickInfoJsDocTagsCallback_test.go | 30 + ...ickInfoJsDocTagsFunctionOverload01_test.go | 27 + ...ickInfoJsDocTagsFunctionOverload03_test.go | 24 + ...ickInfoJsDocTagsFunctionOverload05_test.go | 23 + .../gen/quickInfoJsDocTagsTypedef_test.go | 34 + .../gen/quickInfoJsDocTextFormatting1_test.go | 57 + .../tests/gen/quickInfoJsDocThisTag_test.go | 22 + .../tests/gen/quickInfoJsDoc_test.go | 74 + ...ertyAssignedAfterMethodDeclaration_test.go | 26 + .../quickInfoJsdocTypedefMissingType_test.go | 22 + .../tests/gen/quickInfoLink10_test.go | 20 + .../tests/gen/quickInfoLink11_test.go | 25 + .../tests/gen/quickInfoLink5_test.go | 21 + .../tests/gen/quickInfoLink6_test.go | 21 + .../tests/gen/quickInfoLink7_test.go | 20 + .../tests/gen/quickInfoLink8_test.go | 21 + .../tests/gen/quickInfoLink9_test.go | 22 + .../gen/quickInfoMappedSpreadTypes_test.go | 39 + .../gen/quickInfoMappedTypeMethods_test.go | 20 + ...ckInfoMappedTypeRecursiveInference_test.go | 41 + .../tests/gen/quickInfoMappedType_test.go | 29 + .../gen/quickInfoModuleVariables_test.go | 30 + .../gen/quickInfoNamedTupleMembers_test.go | 17 + ...quickInfoNarrowedTypeOfAliasSymbol_test.go | 28 + ...InfoNestedExportEqualExportDefault_test.go | 20 + .../gen/quickInfoNestedGenericCalls_test.go | 24 + .../quickInfoOfGenericTypeAssertions1_test.go | 23 + ...kInfoOfLablledForStatementIterator_test.go | 18 + .../quickInfoOfStringPropertyNames1_test.go | 35 + ...quickInfoOnArgumentsInsideFunction_test.go | 19 + .../gen/quickInfoOnCatchVariable_test.go | 19 + .../gen/quickInfoOnCircularTypes_test.go | 30 + ...quickInfoOnClassMergedWithFunction_test.go | 28 + .../tests/gen/quickInfoOnClosingJsx_test.go | 20 + ...nfoOnElementAccessInWriteLocation1_test.go | 20 + ...nfoOnElementAccessInWriteLocation2_test.go | 20 + ...nfoOnElementAccessInWriteLocation3_test.go | 20 + ...nfoOnElementAccessInWriteLocation4_test.go | 23 + ...nfoOnElementAccessInWriteLocation5_test.go | 23 + .../tests/gen/quickInfoOnErrorTypes1_test.go | 20 + ...kePropertyWithSetterDeclarationJs1_test.go | 27 + ...kePropertyWithSetterDeclarationJs2_test.go | 30 + ...opertyReturnedFromGenericFunction1_test.go | 25 + ...opertyReturnedFromGenericFunction2_test.go | 25 + ...opertyReturnedFromGenericFunction3_test.go | 25 + .../tests/gen/quickInfoOnGenericClass_test.go | 19 + ...quickInfoOnGenericWithConstraints1_test.go | 18 + .../gen/quickInfoOnInternalAliases_test.go | 46 + ...claredUsingCatchCallIndexSignature_test.go | 22 + ...UsingTemplateLiteralTypeSignatures_test.go | 26 + ...ickInfoOnJsxNamespacedNameWithDoc1_test.go | 32 + .../gen/quickInfoOnJsxNamespacedName_test.go | 23 + .../gen/quickInfoOnMergedInterfaces_test.go | 31 + .../quickInfoOnMethodOfImportEquals_test.go | 25 + .../quickInfoOnNarrowedTypeInModule_test.go | 186 + .../tests/gen/quickInfoOnNarrowedType_test.go | 140 + .../tests/gen/quickInfoOnNewKeyword01_test.go | 27 + ...ckInfoOnObjectLiteralWithAccessors_test.go | 50 + ...kInfoOnObjectLiteralWithOnlyGetter_test.go | 42 + ...kInfoOnObjectLiteralWithOnlySetter_test.go | 47 + .../quickInfoOnParameterProperties_test.go | 41 + ...gIndexSignatureOnInterfaceWithBase_test.go | 22 + ...foOnPropertyAccessInWriteLocation1_test.go | 20 + ...foOnPropertyAccessInWriteLocation2_test.go | 20 + ...foOnPropertyAccessInWriteLocation3_test.go | 20 + ...foOnPropertyAccessInWriteLocation4_test.go | 23 + ...foOnPropertyAccessInWriteLocation5_test.go | 23 + .../tests/gen/quickInfoOnThis2_test.go | 25 + .../tests/gen/quickInfoOnThis3_test.go | 37 + .../tests/gen/quickInfoOnThis4_test.go | 31 + .../tests/gen/quickInfoOnThis5_test.go | 37 + .../tests/gen/quickInfoOnThis_test.go | 44 + ...UnResolvedBaseConstructorSignature_test.go | 26 + .../tests/gen/quickInfoOnUndefined_test.go | 24 + ...ertiesWithIdenticalJSDocComments01_test.go | 41 + ...houtExportWithSameNameExportSymbol_test.go | 33 + .../quickInfoOnVarInArrowExpression_test.go | 27 + ...ickInfoParameter_skipThisParameter_test.go | 18 + ...eIdentifierInTypeReferenceNoCrash1_test.go | 24 + .../tests/gen/quickInfoPropertyTag_test.go | 26 + .../quickInfoRecursiveObjectLiteral_test.go | 17 + ...thodsOnAssignedFunctionExpressions_test.go | 28 + .../tests/gen/quickInfoSatisfiesTag_test.go | 22 + ...uickInfoShowsGenericSpecialization_test.go | 18 + ...gnatureOptionalParameterFromUnion1_test.go | 21 + ...foSignatureRestParameterFromUnion1_test.go | 21 + ...foSignatureRestParameterFromUnion2_test.go | 21 + ...foSignatureRestParameterFromUnion3_test.go | 21 + ...foSignatureRestParameterFromUnion4_test.go | 21 + ...uickInfoSignatureWithTrailingComma_test.go | 18 + ...quickInfoSpecialPropertyAssignment_test.go | 26 + ...InfoStaticPrototypePropertyOnClass_test.go | 37 + .../tests/gen/quickInfoTemplateTag_test.go | 27 + ...nfoTypeAliasDefinedInDifferentFile_test.go | 22 + ...mentInferenceWithMethodWithoutBody_test.go | 28 + .../tests/gen/quickInfoTypeError_test.go | 20 + .../gen/quickInfoTypeOfThisInStatics_test.go | 26 + ...quickInfoTypeOnlyNamespaceAndClass_test.go | 24 + ...ickInfoTypedGenericPrototypeMember_test.go | 22 + .../tests/gen/quickInfoTypedefTag_test.go | 40 + .../gen/quickInfoUnionOfNamespaces_test.go | 25 + .../gen/quickInfoUnion_discriminated_test.go | 44 + .../gen/quickInfoUniqueSymbolJsDoc_test.go | 22 + .../tests/gen/quickInfoWidenedTypes_test.go | 23 + ...estedDestructuredParameterInLambda_test.go | 27 + ...errorSignatureFillsInTypeParameter_test.go | 18 + .../gen/quickInfo_notInsideComment_test.go | 18 + ...nforForSucessiveInferencesIsNotAny_test.go | 22 + .../fourslash/tests/gen/quickinfo01_test.go | 32 + ...xpressionTypeNotChangedViaDeletion_test.go | 27 + ...aceMergeWithClassConstrainedToSelf_test.go | 32 + .../gen/quickinfoForUnionProperty_test.go | 32 + .../tests/gen/quickinfoWrongComment_test.go | 30 + .../tests/gen/reallyLargeFile_test.go | 583723 +++++++++++++++ .../tests/gen/recursiveClassReference_test.go | 26 + .../tests/gen/recursiveGenerics2_test.go | 19 + .../gen/recursiveInternalModuleImport_test.go | 22 + .../recursiveWrappedTypeParameters1_test.go | 35 + ...enceInParameterPropertyDeclaration_test.go | 32 + .../tests/gen/referenceToClass_test.go | 32 + .../tests/gen/referenceToEmptyObject_test.go | 17 + .../fourslash/tests/gen/references01_test.go | 23 + .../tests/gen/referencesBloomFilters2_test.go | 24 + .../tests/gen/referencesBloomFilters3_test.go | 20 + .../tests/gen/referencesBloomFilters_test.go | 24 + .../tests/gen/referencesForAmbients_test.go | 29 + .../tests/gen/referencesForClassLocal_test.go | 33 + ...ClassMembersExtendingAbstractClass_test.go | 28 + ...rClassMembersExtendingGenericClass_test.go | 28 + .../gen/referencesForClassMembers_test.go | 28 + .../gen/referencesForClassParameter_test.go | 32 + ...tuallyTypedObjectLiteralProperties_test.go | 40 + ...rContextuallyTypedUnionProperties2_test.go | 49 + ...orContextuallyTypedUnionProperties_test.go | 49 + .../referencesForDeclarationKeywords_test.go | 35 + .../tests/gen/referencesForEnums_test.go | 26 + .../gen/referencesForExportedValues_test.go | 25 + .../referencesForExpressionKeywords_test.go | 30 + .../referencesForExternalModuleNames_test.go | 22 + .../referencesForFunctionOverloads_test.go | 20 + .../referencesForFunctionParameter_test.go | 23 + .../tests/gen/referencesForGlobals2_test.go | 22 + .../tests/gen/referencesForGlobals3_test.go | 22 + .../tests/gen/referencesForGlobals4_test.go | 22 + .../tests/gen/referencesForGlobals5_test.go | 24 + ...ferencesForGlobalsInExternalModule_test.go | 31 + .../tests/gen/referencesForGlobals_test.go | 37 + .../referencesForIllegalAssignment_test.go | 19 + .../tests/gen/referencesForImports_test.go | 23 + .../gen/referencesForIndexProperty2_test.go | 18 + .../gen/referencesForIndexProperty3_test.go | 25 + .../gen/referencesForIndexProperty_test.go | 24 + ...referencesForInheritedProperties10_test.go | 37 + .../referencesForInheritedProperties2_test.go | 39 + .../referencesForInheritedProperties3_test.go | 24 + .../referencesForInheritedProperties4_test.go | 24 + .../referencesForInheritedProperties5_test.go | 28 + .../referencesForInheritedProperties6_test.go | 25 + .../referencesForInheritedProperties7_test.go | 32 + .../referencesForInheritedProperties8_test.go | 26 + .../referencesForInheritedProperties9_test.go | 26 + .../referencesForInheritedProperties_test.go | 36 + .../tests/gen/referencesForLabel2_test.go | 21 + .../tests/gen/referencesForLabel3_test.go | 19 + .../tests/gen/referencesForLabel4_test.go | 21 + .../tests/gen/referencesForLabel5_test.go | 25 + .../tests/gen/referencesForLabel6_test.go | 20 + .../tests/gen/referencesForLabel_test.go | 23 + .../referencesForMergedDeclarations2_test.go | 26 + .../referencesForMergedDeclarations3_test.go | 33 + .../referencesForMergedDeclarations4_test.go | 35 + .../referencesForMergedDeclarations5_test.go | 21 + .../referencesForMergedDeclarations6_test.go | 25 + .../referencesForMergedDeclarations7_test.go | 25 + .../referencesForMergedDeclarations8_test.go | 25 + .../referencesForMergedDeclarations_test.go | 29 + .../tests/gen/referencesForModifiers_test.go | 27 + .../tests/gen/referencesForNoContext_test.go | 36 + ...ncesForNumericLiteralPropertyNames_test.go | 24 + ...ferencesForObjectLiteralProperties_test.go | 21 + .../tests/gen/referencesForOverrides_test.go | 90 + ...ferencesForPropertiesOfGenericType_test.go | 25 + .../referencesForStatementKeywords_test.go | 69 + .../tests/gen/referencesForStatic_test.go | 42 + ...sForStaticsAndMembersWithSameNames_test.go | 40 + ...ncesForStringLiteralPropertyNames2_test.go | 22 + ...ncesForStringLiteralPropertyNames3_test.go | 23 + ...ncesForStringLiteralPropertyNames4_test.go | 19 + ...ncesForStringLiteralPropertyNames5_test.go | 19 + ...ncesForStringLiteralPropertyNames6_test.go | 19 + ...ncesForStringLiteralPropertyNames7_test.go | 23 + ...encesForStringLiteralPropertyNames_test.go | 25 + .../gen/referencesForTypeKeywords_test.go | 23 + .../gen/referencesForUnionProperties_test.go | 37 + .../tests/gen/referencesInComment_test.go | 20 + .../gen/referencesInConfiguredProject_test.go | 24 + ...cesInEmptyFileWithMultipleProjects_test.go | 25 + .../tests/gen/referencesInEmptyFile_test.go | 17 + ...ngLiteralValueWithMultipleProjects_test.go | 25 + ...cesIsAvailableThroughGlobalNoCrash_test.go | 29 + ...ncesToNonPropertyNameStringLiteral_test.go | 17 + .../referencesToStringLiteralValue_test.go | 17 + .../tests/gen/regexDetection_test.go | 24 + .../tests/gen/regexErrorRecovery_test.go | 22 + .../tsgo/fourslash/tests/gen/regexp_test.go | 17 + .../tests/gen/remoteGetReferences_test.go | 191 + .../tsgo/fourslash/tests/gen/rename01_test.go | 21 + .../gen/renameAcrossMultipleProjects_test.go | 24 + .../fourslash/tests/gen/renameAlias2_test.go | 19 + .../fourslash/tests/gen/renameAlias3_test.go | 19 + .../gen/renameAliasExternalModule2_test.go | 22 + .../gen/renameAliasExternalModule3_test.go | 22 + .../gen/renameAliasExternalModule_test.go | 22 + .../fourslash/tests/gen/renameAlias_test.go | 19 + ...eBindingElementInitializerExternal_test.go | 29 + ...eBindingElementInitializerProperty_test.go | 22 + .../gen/renameCommentsAndStrings1_test.go | 21 + .../gen/renameCommentsAndStrings2_test.go | 21 + .../gen/renameCommentsAndStrings3_test.go | 21 + .../gen/renameCommentsAndStrings4_test.go | 26 + ...renameContextuallyTypedProperties2_test.go | 70 + .../renameContextuallyTypedProperties_test.go | 70 + .../tests/gen/renameCrossJsTs01_test.go | 22 + .../gen/renameDeclarationKeywords_test.go | 31 + .../renameDefaultImportDifferentName_test.go | 28 + .../gen/renameDefaultLibDontWork_test.go | 19 + ...ringAssignmentNestedInArrayLiteral_test.go | 23 + ...tructuringAssignmentNestedInForOf2_test.go | 30 + .../gen/renameDestructuringAssignment_test.go | 22 + .../renameDestructuringClassProperty_test.go | 31 + ...ameDestructuringDeclarationInForOf_test.go | 27 + ...enameDestructuringDeclarationInFor_test.go | 28 + ...nameDestructuringFunctionParameter_test.go | 19 + ...eDestructuringNestedBindingElement_test.go | 30 + .../tests/gen/renameExportCrash_test.go | 21 + .../tests/gen/renameExportSpecifier2_test.go | 24 + .../tests/gen/renameExportSpecifier_test.go | 24 + .../gen/renameForAliasingExport01_test.go | 21 + .../gen/renameForAliasingExport02_test.go | 21 + .../gen/renameForDefaultExport04_test.go | 27 + .../gen/renameForDefaultExport05_test.go | 27 + .../gen/renameForDefaultExport06_test.go | 27 + .../gen/renameForDefaultExport07_test.go | 28 + .../gen/renameForDefaultExport08_test.go | 28 + .../gen/renameForDefaultExport09_test.go | 34 + .../tests/gen/renameForStringLiteral_test.go | 26 + .../gen/renameFromNodeModulesDep1_test.go | 32 + .../gen/renameFromNodeModulesDep2_test.go | 36 + .../gen/renameFromNodeModulesDep3_test.go | 32 + .../gen/renameFromNodeModulesDep4_test.go | 40 + .../gen/renameFunctionParameter1_test.go | 24 + .../gen/renameFunctionParameter2_test.go | 22 + .../renameImportAndExportInDiffFiles_test.go | 22 + .../tests/gen/renameImportAndExport_test.go | 18 + .../gen/renameImportAndShorthand_test.go | 18 + .../renameImportNamespaceAndShorthand_test.go | 18 + .../gen/renameImportOfExportEquals_test.go | 35 + .../tests/gen/renameImportRequire_test.go | 24 + .../renameImportSpecifierPropertyName_test.go | 20 + .../gen/renameInConfiguredProject_test.go | 23 + .../renameInfoForFunctionExpression01_test.go | 20 + .../gen/renameInheritedProperties1_test.go | 22 + .../gen/renameInheritedProperties2_test.go | 22 + .../gen/renameInheritedProperties3_test.go | 22 + .../gen/renameInheritedProperties4_test.go | 22 + .../gen/renameInheritedProperties5_test.go | 24 + .../gen/renameInheritedProperties6_test.go | 24 + .../gen/renameInheritedProperties7_test.go | 26 + .../gen/renameInheritedProperties8_test.go | 26 + .../tests/gen/renameJSDocNamepath_test.go | 22 + .../tests/gen/renameJsDocImportTag_test.go | 29 + .../tests/gen/renameJsDocTypeLiteral_test.go | 26 + .../tests/gen/renameJsExports01_test.go | 23 + .../tests/gen/renameJsExports02_test.go | 21 + .../tests/gen/renameJsExports03_test.go | 25 + ...enameJsOverloadedFunctionParameter_test.go | 34 + .../gen/renameJsPropertyAssignment2_test.go | 22 + .../gen/renameJsPropertyAssignment3_test.go | 22 + .../gen/renameJsPropertyAssignment4_test.go | 23 + .../gen/renameJsPropertyAssignment_test.go | 22 + .../gen/renameJsPrototypeProperty01_test.go | 23 + .../gen/renameJsPrototypeProperty02_test.go | 23 + .../gen/renameJsSpecialAssignmentRhs1_test.go | 26 + .../gen/renameJsSpecialAssignmentRhs2_test.go | 26 + .../tests/gen/renameJsThisProperty01_test.go | 23 + .../tests/gen/renameJsThisProperty03_test.go | 25 + .../tests/gen/renameJsThisProperty05_test.go | 26 + .../tests/gen/renameJsThisProperty06_test.go | 26 + .../fourslash/tests/gen/renameLabel1_test.go | 19 + .../fourslash/tests/gen/renameLabel2_test.go | 19 + .../fourslash/tests/gen/renameLabel3_test.go | 22 + .../fourslash/tests/gen/renameLabel4_test.go | 22 + .../fourslash/tests/gen/renameLabel5_test.go | 22 + .../fourslash/tests/gen/renameLabel6_test.go | 22 + ...enameLocationsForClassExpression01_test.go | 35 + ...meLocationsForFunctionExpression01_test.go | 19 + ...meLocationsForFunctionExpression02_test.go | 25 + .../tests/gen/renameModifiers_test.go | 27 + .../renameModuleExportsProperties1_test.go | 20 + .../renameModuleExportsProperties2_test.go | 18 + .../renameModuleExportsProperties3_test.go | 22 + .../tests/gen/renameNameOnEnumMember_test.go | 23 + .../tests/gen/renameNamedImport_test.go | 32 + .../tests/gen/renameNamespaceImport_test.go | 30 + .../tests/gen/renameNamespace_test.go | 23 + .../tests/gen/renameNoDefaultLib_test.go | 23 + .../renameNumericalIndexSingleQuoted_test.go | 19 + .../tests/gen/renameNumericalIndex_test.go | 18 + ...ObjectBindingElementPropertyName01_test.go | 23 + .../gen/renameObjectSpreadAssignment_test.go | 21 + .../tests/gen/renameObjectSpread_test.go | 22 + ...enameParameterPropertyDeclaration1_test.go | 22 + ...enameParameterPropertyDeclaration2_test.go | 22 + ...enameParameterPropertyDeclaration3_test.go | 22 + ...enameParameterPropertyDeclaration4_test.go | 21 + ...enameParameterPropertyDeclaration5_test.go | 21 + .../tests/gen/renamePrivateAccessor_test.go | 24 + .../tests/gen/renamePrivateFields1_test.go | 23 + .../tests/gen/renamePrivateFields_test.go | 24 + .../tests/gen/renamePrivateMethod_test.go | 23 + ...ertyAccessExpressionHeritageClause_test.go | 22 + .../tests/gen/renameReExportDefault_test.go | 26 + .../gen/renameReferenceFromLinkTag1_test.go | 20 + .../gen/renameReferenceFromLinkTag2_test.go | 24 + .../gen/renameReferenceFromLinkTag3_test.go | 25 + .../gen/renameReferenceFromLinkTag4_test.go | 21 + .../gen/renameReferenceFromLinkTag5_test.go | 20 + .../gen/renameRestBindingElement_test.go | 26 + .../fourslash/tests/gen/renameRest_test.go | 24 + .../tests/gen/renameStringLiteralOk1_test.go | 23 + .../tests/gen/renameStringLiteralOk_test.go | 23 + .../gen/renameStringLiteralTypes1_test.go | 25 + .../gen/renameStringLiteralTypes2_test.go | 34 + .../gen/renameStringLiteralTypes3_test.go | 29 + .../gen/renameStringLiteralTypes4_test.go | 23 + .../gen/renameStringLiteralTypes5_test.go | 23 + .../gen/renameStringPropertyNames2_test.go | 24 + .../gen/renameStringPropertyNames_test.go | 27 + ...TemplateLiteralsComputedProperties_test.go | 52 + ...meTemplateLiteralsDefinePropertyJs_test.go | 30 + .../fourslash/tests/gen/renameThis_test.go | 23 + .../tests/gen/renameUMDModuleAlias1_test.go | 23 + .../tests/gen/renameUMDModuleAlias2_test.go | 24 + .../fourslash/tests/gen/restArgType_test.go | 62 + .../gen/restParamsContextuallyTyped_test.go | 19 + .../tests/gen/returnRecursiveType_test.go | 21 + .../gen/returnTypeOfGenericFunction1_test.go | 21 + .../gen/reverseMappedTypeQuickInfo_test.go | 44 + .../gen/satisfiesOperatorCompletion_test.go | 31 + .../tests/gen/scopeOfUnionProperties_test.go | 19 + .../gen/selfReferencedExternalModule2_test.go | 25 + .../gen/selfReferencedExternalModule_test.go | 40 + .../gen/signatureHelpAfterParameter_test.go | 20 + .../signatureHelpCommentsClassMembers_test.go | 147 + .../gen/signatureHelpCommentsClass_test.go | 73 + ...ignatureHelpCommentsCommentParsing_test.go | 217 + ...ureHelpCommentsFunctionDeclaration_test.go | 33 + ...tureHelpCommentsFunctionExpression_test.go | 42 + ...HelpConstructorCallParamProperties_test.go | 25 + ...HelpExpandedRestTuplesLocalLabels1_test.go | 79 + ...gnatureHelpInferenceJsDocImportTag_test.go | 33 + .../gen/signatureHelpIteratorNext_test.go | 36 + .../gen/signatureHelpJSDocCallbackTag_test.go | 40 + .../tests/gen/signatureHelpJSDocTags_test.go | 74 + ...gnatureHelpJSMissingPropertyAccess_test.go | 20 + .../tests/gen/signatureHelpRestArgs1_test.go | 25 + .../tests/gen/signatureHelpRestArgs2_test.go | 28 + .../tests/gen/signatureHelpRestArgs3_test.go | 19 + .../gen/signatureHelpSkippedArgs1_test.go | 18 + .../gen/signatureHelpTypeArguments2_test.go | 28 + .../gen/signatureHelpWithUnknown_test.go | 17 + .../tests/gen/signatureHelp_unionType_test.go | 32 + ...ecialIntersectionsOrderIndependent_test.go | 32 + ...onalTypesUsingTemplateLiteralTypes_test.go | 74 + ...CompletionsImportOrExportSpecifier_test.go | 248 + .../gen/stringCompletionsVsEscaping_test.go | 126 + ...onalTypesUsingTemplateLiteralTypes_test.go | 38 + ...onsForOpenEndedTemplateLiteralType_test.go | 32 + ...letionsForStringEnumContextualType_test.go | 30 + ...ralCompletionsForTypeIndexedAccess_test.go | 46 + ...singInferenceResultFromPreviousArg_test.go | 56 + ...mpletionsInJsxAttributeInitializer_test.go | 63 + ...ompletionsInPositionTypedUsingRest_test.go | 54 + ...CompletionsInTypeArgForNonGeneric1_test.go | 29 + .../tests/gen/stringPropertyNames1_test.go | 21 + .../tests/gen/stringPropertyNames2_test.go | 21 + .../tests/gen/superCallError0_test.go | 25 + .../tests/gen/switchCompletions_test.go | 101 + .../gen/symbolCompletionLowerPriority_test.go | 46 + ...lNameAtUnparseableFunctionOverload_test.go | 25 + .../tests/gen/syntaxErrorAfterImport1_test.go | 27 + ...heticImportFromBabelGeneratedFile1_test.go | 29 + ...heticImportFromBabelGeneratedFile2_test.go | 31 + .../tests/gen/thisBindingInLambda_test.go | 23 + ...thisPredicateFunctionCompletions02_test.go | 86 + ...thisPredicateFunctionCompletions03_test.go | 87 + .../thisPredicateFunctionQuickInfo01_test.go | 62 + .../thisPredicateFunctionQuickInfo02_test.go | 53 + .../thisPredicateFunctionQuickInfo_test.go | 79 + .../gen/trailingCommaSignatureHelp_test.go | 28 + ...lashRefPathCompletionAbsolutePaths_test.go | 64 + ...ripleSlashRefPathCompletionContext_test.go | 34 + ...thCompletionExtensionsAllowJSFalse_test.go | 48 + ...athCompletionExtensionsAllowJSTrue_test.go | 51 + ...leSlashRefPathCompletionHiddenFile_test.go | 58 + ...ipleSlashRefPathCompletionRootdirs_test.go | 53 + ...eferencesOnRuntimeImportWithPaths1_test.go | 37 + .../tests/gen/tsxCompletion10_test.go | 36 + .../tests/gen/tsxCompletion11_test.go | 35 + .../tests/gen/tsxCompletion13_test.go | 118 + .../tests/gen/tsxCompletion14_test.go | 61 + .../tests/gen/tsxCompletion15_test.go | 186 + .../tests/gen/tsxCompletion1_test.go | 37 + .../tests/gen/tsxCompletion2_test.go | 38 + .../tests/gen/tsxCompletion3_test.go | 36 + .../tests/gen/tsxCompletion4_test.go | 37 + .../tests/gen/tsxCompletion5_test.go | 37 + .../tests/gen/tsxCompletion6_test.go | 36 + .../tests/gen/tsxCompletion7_test.go | 48 + .../tests/gen/tsxCompletion8_test.go | 37 + ...ctionExpressionOfChildrenCallback1_test.go | 54 + ...nctionExpressionOfChildrenCallback_test.go | 41 + .../gen/tsxCompletionNonTagLessThan_test.go | 55 + .../gen/tsxCompletionOnClosingTag1_test.go | 36 + .../gen/tsxCompletionOnClosingTag2_test.go | 50 + ...xCompletionOnClosingTagWithoutJSX1_test.go | 30 + ...xCompletionOnClosingTagWithoutJSX2_test.go | 44 + .../tsxCompletionsGenericComponent_test.go | 53 + .../tests/gen/tsxFindAllReferences10_test.go | 44 + .../tests/gen/tsxFindAllReferences11_test.go | 39 + .../tests/gen/tsxFindAllReferences1_test.go | 28 + .../tests/gen/tsxFindAllReferences2_test.go | 28 + .../tests/gen/tsxFindAllReferences3_test.go | 31 + .../tests/gen/tsxFindAllReferences4_test.go | 31 + .../tests/gen/tsxFindAllReferences5_test.go | 36 + .../tests/gen/tsxFindAllReferences6_test.go | 32 + .../tests/gen/tsxFindAllReferences7_test.go | 35 + .../tests/gen/tsxFindAllReferences8_test.go | 44 + .../tests/gen/tsxFindAllReferences9_test.go | 45 + ...FindAllReferencesUnionElementType1_test.go | 33 + ...FindAllReferencesUnionElementType2_test.go | 32 + .../gen/tsxGoToDefinitionClasses_test.go | 30 + .../gen/tsxGoToDefinitionIntrinsics_test.go | 30 + ...sxGoToDefinitionStatelessFunction1_test.go | 35 + ...sxGoToDefinitionStatelessFunction2_test.go | 44 + ...tsxGoToDefinitionUnionElementType1_test.go | 33 + ...tsxGoToDefinitionUnionElementType2_test.go | 32 + .../tests/gen/tsxIncrementalServer_test.go | 25 + .../tests/gen/tsxIncremental_test.go | 25 + .../fourslash/tests/gen/tsxParsing_test.go | 19 + .../fourslash/tests/gen/tsxQuickInfo1_test.go | 23 + .../fourslash/tests/gen/tsxQuickInfo2_test.go | 29 + .../fourslash/tests/gen/tsxQuickInfo3_test.go | 36 + .../fourslash/tests/gen/tsxQuickInfo4_test.go | 57 + .../fourslash/tests/gen/tsxQuickInfo5_test.go | 26 + .../fourslash/tests/gen/tsxQuickInfo6_test.go | 27 + .../fourslash/tests/gen/tsxQuickInfo7_test.go | 37 + .../fourslash/tests/gen/tsxRename1_test.go | 28 + .../fourslash/tests/gen/tsxRename2_test.go | 28 + .../fourslash/tests/gen/tsxRename3_test.go | 31 + .../fourslash/tests/gen/tsxRename5_test.go | 31 + .../fourslash/tests/gen/tsxRename6_test.go | 36 + .../fourslash/tests/gen/tsxRename7_test.go | 35 + .../fourslash/tests/gen/tsxRename8_test.go | 36 + .../fourslash/tests/gen/tsxRename9_test.go | 44 + ...veNumberLiteralExpressionStatement_test.go | 20 + .../tests/gen/typeArgCompletion_test.go | 35 + ...peCheckAfterAddingGenericParameter_test.go | 31 + .../gen/typeCheckObjectInArrayLiteral_test.go | 19 + .../tests/gen/typeKeywordInFunction_test.go | 36 + .../tests/gen/typeOfAFundule_test.go | 22 + .../tests/gen/typeOfKeywordCompletion_test.go | 34 + .../gen/typeOperatorNodeBuilding_test.go | 30 + .../tests/gen/typeReferenceOnServer_test.go | 31 + .../gen/unclosedCommentsInConstructor_test.go | 19 + ...unclosedStringLiteralErrorRecovery_test.go | 33 + .../tests/gen/underscoreTypings01_test.go | 69 + .../updateSourceFile_jsdocSignature_test.go | 22 + .../tests/gen/updateToClassStatics_test.go | 33 + .../gen/verifySingleFileEmitOutput1_test.go | 24 + .../tests/hoverAliasInImportedFile_test.go | 35 + .../completionListInClosedFunction05_test.go | 40 + ...sAtIncompleteObjectLiteralProperty_test.go | 48 + .../manual/completionsSelfDeclaring1_test.go | 54 + .../completionsWithDeprecatedTag4_test.go | 52 + .../tests/manual/renameDefaultKeyword_test.go | 36 + .../manual/renameForDefaultExport01_test.go | 35 + .../tests/manual/tsxCompletion12_test.go | 115 + .../fourslash/tests/quickInfoCatch_test.go | 18 + .../tests/signatureHelpCrash_test.go | 32 + .../tests/signatureHelpTokenCrash_test.go | 44 + .../tests/stringCompletionDetails_test.go | 41 + .../tsgo/fourslash/tests/util/util.go | 13705 + kitcom/internal/tsgo/glob/glob.go | 349 + kitcom/internal/tsgo/jsnum/jsnum.go | 159 + kitcom/internal/tsgo/jsnum/jsnum_test.go | 336 + kitcom/internal/tsgo/jsnum/pseudobigint.go | 66 + .../internal/tsgo/jsnum/pseudobigint_test.go | 77 + kitcom/internal/tsgo/jsnum/ryu_test.go | 164 + kitcom/internal/tsgo/jsnum/string.go | 341 + kitcom/internal/tsgo/jsnum/string_test.go | 366 + kitcom/internal/tsgo/jsonutil/jsonutil.go | 24 + kitcom/internal/tsgo/ls/api.go | 44 + .../tsgo/ls/autoImports_stringer_generated.go | 27 + kitcom/internal/tsgo/ls/autoimportfixes.go | 325 + kitcom/internal/tsgo/ls/autoimports.go | 1490 + .../internal/tsgo/ls/autoimportsexportinfo.go | 181 + kitcom/internal/tsgo/ls/autoimportstypes.go | 215 + kitcom/internal/tsgo/ls/changetracker.go | 336 + kitcom/internal/tsgo/ls/changetrackerimpl.go | 413 + kitcom/internal/tsgo/ls/completions.go | 6171 + kitcom/internal/tsgo/ls/constants.go | 6 + kitcom/internal/tsgo/ls/converters.go | 199 + kitcom/internal/tsgo/ls/converters_test.go | 83 + kitcom/internal/tsgo/ls/definition.go | 234 + kitcom/internal/tsgo/ls/diagnostics.go | 109 + kitcom/internal/tsgo/ls/documenthighlights.go | 690 + kitcom/internal/tsgo/ls/findallreferences.go | 2045 + kitcom/internal/tsgo/ls/format.go | 181 + kitcom/internal/tsgo/ls/host.go | 10 + kitcom/internal/tsgo/ls/hover.go | 488 + kitcom/internal/tsgo/ls/importTracker.go | 728 + kitcom/internal/tsgo/ls/languageservice.go | 67 + kitcom/internal/tsgo/ls/linemap.go | 71 + kitcom/internal/tsgo/ls/organizeimports.go | 128 + kitcom/internal/tsgo/ls/signaturehelp.go | 1157 + kitcom/internal/tsgo/ls/source_map.go | 81 + kitcom/internal/tsgo/ls/string_completions.go | 731 + kitcom/internal/tsgo/ls/symbol_display.go | 389 + kitcom/internal/tsgo/ls/symbols.go | 309 + kitcom/internal/tsgo/ls/userpreferences.go | 211 + kitcom/internal/tsgo/ls/utilities.go | 1722 + .../tsgo/lsp/lsproto/_generate/.gitignore | 2 + .../tsgo/lsp/lsproto/_generate/fetchModel.mts | 23 + .../tsgo/lsp/lsproto/_generate/generate.mts | 913 + .../lsp/lsproto/_generate/metaModelSchema.mts | 609 + .../tsgo/lsp/lsproto/_generate/tsconfig.json | 20 + kitcom/internal/tsgo/lsp/lsproto/baseproto.go | 140 + .../tsgo/lsp/lsproto/baseproto_test.go | 151 + kitcom/internal/tsgo/lsp/lsproto/jsonrpc.go | 236 + kitcom/internal/tsgo/lsp/lsproto/lsp.go | 151 + .../tsgo/lsp/lsproto/lsp_generated.go | 25727 + kitcom/internal/tsgo/lsp/lsproto/lsp_test.go | 84 + kitcom/internal/tsgo/lsp/server.go | 923 + kitcom/internal/tsgo/lsutil/asi.go | 104 + kitcom/internal/tsgo/lsutil/children.go | 130 + kitcom/internal/tsgo/module/cache.go | 29 + kitcom/internal/tsgo/module/resolver.go | 2010 + kitcom/internal/tsgo/module/resolver_test.go | 398 + kitcom/internal/tsgo/module/types.go | 147 + kitcom/internal/tsgo/module/util.go | 155 + .../internal/tsgo/modulespecifiers/compare.go | 13 + .../tsgo/modulespecifiers/preferences.go | 233 + .../tsgo/modulespecifiers/specifiers.go | 1286 + .../internal/tsgo/modulespecifiers/types.go | 122 + kitcom/internal/tsgo/modulespecifiers/util.go | 323 + kitcom/internal/tsgo/nodebuilder/types.go | 80 + .../tsgo/outputpaths/commonsourcedirectory.go | 72 + .../internal/tsgo/outputpaths/outputpaths.go | 234 + kitcom/internal/tsgo/packagejson/cache.go | 148 + kitcom/internal/tsgo/packagejson/expected.go | 75 + .../tsgo/packagejson/expected_test.go | 44 + .../tsgo/packagejson/exportsorimports.go | 85 + .../tsgo/packagejson/exportsorimports_test.go | 62 + kitcom/internal/tsgo/packagejson/jsonvalue.go | 165 + .../tsgo/packagejson/jsonvalue_test.go | 83 + .../internal/tsgo/packagejson/packagejson.go | 43 + .../tsgo/packagejson/packagejson_test.go | 103 + kitcom/internal/tsgo/packagejson/validated.go | 8 + kitcom/internal/tsgo/parser/jsdoc.go | 1205 + kitcom/internal/tsgo/parser/parser.go | 6587 + kitcom/internal/tsgo/parser/parser_test.go | 145 + kitcom/internal/tsgo/parser/references.go | 74 + kitcom/internal/tsgo/parser/reparser.go | 619 + .../testdata/fuzz/FuzzParser/02b74efe61495c2a | 5 + .../testdata/fuzz/FuzzParser/9ce2d994c65c7bfe | 5 + kitcom/internal/tsgo/parser/types.go | 14 + kitcom/internal/tsgo/parser/utilities.go | 54 + kitcom/internal/tsgo/pprof/pprof.go | 63 + .../tsgo/printer/changetrackerwriter.go | 231 + kitcom/internal/tsgo/printer/emitcontext.go | 987 + kitcom/internal/tsgo/printer/emitflags.go | 37 + kitcom/internal/tsgo/printer/emithost.go | 23 + kitcom/internal/tsgo/printer/emitresolver.go | 68 + .../internal/tsgo/printer/emittextwriter.go | 33 + kitcom/internal/tsgo/printer/factory.go | 693 + .../tsgo/printer/generatedidentifierflags.go | 57 + kitcom/internal/tsgo/printer/helpers.go | 252 + kitcom/internal/tsgo/printer/namegenerator.go | 401 + .../tsgo/printer/namegenerator_test.go | 640 + kitcom/internal/tsgo/printer/printer.go | 5953 + kitcom/internal/tsgo/printer/printer_test.go | 2519 + .../tsgo/printer/singlelinestringwriter.go | 158 + .../printer/sourcefilemetadataprovider.go | 10 + kitcom/internal/tsgo/printer/textwriter.go | 211 + kitcom/internal/tsgo/printer/utilities.go | 909 + .../internal/tsgo/printer/utilities_test.go | 153 + kitcom/internal/tsgo/project/api.go | 29 + kitcom/internal/tsgo/project/ata/ata.go | 500 + kitcom/internal/tsgo/project/ata/ata_test.go | 621 + .../tsgo/project/ata/discovertypings.go | 333 + .../tsgo/project/ata/discovertypings_test.go | 361 + .../project/ata/installnpmpackages_test.go | 523 + kitcom/internal/tsgo/project/ata/typesmap.go | 505 + .../tsgo/project/ata/validatepackagename.go | 98 + .../project/ata/validatepackagename_test.go | 107 + .../internal/tsgo/project/background/queue.go | 45 + .../tsgo/project/background/queue_test.go | 91 + kitcom/internal/tsgo/project/checkerpool.go | 236 + kitcom/internal/tsgo/project/client.go | 13 + kitcom/internal/tsgo/project/compilerhost.go | 203 + .../tsgo/project/configfilechanges_test.go | 186 + .../tsgo/project/configfileregistry.go | 125 + .../tsgo/project/configfileregistrybuilder.go | 545 + kitcom/internal/tsgo/project/dirty/box.go | 62 + kitcom/internal/tsgo/project/dirty/entry.go | 29 + .../internal/tsgo/project/dirty/interfaces.go | 15 + kitcom/internal/tsgo/project/dirty/map.go | 147 + kitcom/internal/tsgo/project/dirty/syncmap.go | 335 + .../tsgo/project/dirty/syncmap_test.go | 245 + kitcom/internal/tsgo/project/dirty/util.go | 18 + .../tsgo/project/extendedconfigcache.go | 75 + kitcom/internal/tsgo/project/filechange.go | 45 + .../tsgo/project/logging/logcollector.go | 34 + .../internal/tsgo/project/logging/logger.go | 103 + .../internal/tsgo/project/logging/logtree.go | 147 + .../tsgo/project/logging/logtree_test.go | 20 + kitcom/internal/tsgo/project/overlayfs.go | 373 + .../internal/tsgo/project/overlayfs_test.go | 199 + kitcom/internal/tsgo/project/parsecache.go | 99 + .../internal/tsgo/project/programcounter.go | 33 + kitcom/internal/tsgo/project/project.go | 424 + .../project/project_stringer_generated.go | 24 + kitcom/internal/tsgo/project/project_test.go | 177 + .../tsgo/project/projectcollection.go | 269 + .../tsgo/project/projectcollectionbuilder.go | 878 + .../project/projectcollectionbuilder_test.go | 577 + .../tsgo/project/projectlifetime_test.go | 220 + .../project/projectreferencesprogram_test.go | 404 + .../internal/tsgo/project/refcounting_test.go | 135 + kitcom/internal/tsgo/project/session.go | 690 + kitcom/internal/tsgo/project/session_test.go | 857 + kitcom/internal/tsgo/project/snapshot.go | 324 + kitcom/internal/tsgo/project/snapshot_test.go | 123 + kitcom/internal/tsgo/project/snapshotfs.go | 142 + kitcom/internal/tsgo/project/untitled_test.go | 161 + kitcom/internal/tsgo/project/util.go | 7 + kitcom/internal/tsgo/project/watch.go | 361 + kitcom/internal/tsgo/project/watch_test.go | 20 + kitcom/internal/tsgo/repo/paths.go | 63 + kitcom/internal/tsgo/scanner/scanner.go | 2616 + kitcom/internal/tsgo/scanner/utilities.go | 67 + kitcom/internal/tsgo/semver/version.go | 274 + kitcom/internal/tsgo/semver/version_range.go | 438 + .../tsgo/semver/version_range_test.go | 959 + kitcom/internal/tsgo/semver/version_test.go | 147 + kitcom/internal/tsgo/sourcemap/decoder.go | 252 + kitcom/internal/tsgo/sourcemap/generator.go | 360 + .../internal/tsgo/sourcemap/generator_test.go | 383 + kitcom/internal/tsgo/sourcemap/lineinfo.go | 30 + kitcom/internal/tsgo/sourcemap/source.go | 9 + .../internal/tsgo/sourcemap/source_mapper.go | 313 + kitcom/internal/tsgo/sourcemap/util.go | 27 + kitcom/internal/tsgo/stringutil/compare.go | 100 + kitcom/internal/tsgo/stringutil/format.go | 19 + kitcom/internal/tsgo/stringutil/util.go | 240 + .../tsgo/testrunner/compiler_runner.go | 606 + .../tsgo/testrunner/compiler_runner_test.go | 50 + kitcom/internal/tsgo/testrunner/runner.go | 14 + .../tsgo/testrunner/test_case_parser.go | 227 + .../tsgo/testrunner/test_case_parser_test.go | 41 + .../tsgo/testutil/baseline/baseline.go | 211 + .../testutil/emittestutil/emittestutil.go | 29 + .../tsgo/testutil/filefixture/filefixture.go | 74 + .../tsgo/testutil/fixtures/benchfixtures.go | 16 + .../tsgo/testutil/harnessutil/harnessutil.go | 1152 + .../tsgo/testutil/harnessutil/recorderfs.go | 49 + .../harnessutil/sourcemap_recorder.go | 354 + kitcom/internal/tsgo/testutil/jstest/node.go | 95 + .../testutil/parsetestutil/parsetestutil.go | 89 + .../projecttestutil/clientmock_generated.go | 187 + .../npmexecutormock_generated.go | 86 + .../projecttestutil/projecttestutil.go | 234 + kitcom/internal/tsgo/testutil/race/norace.go | 7 + kitcom/internal/tsgo/testutil/race/race.go | 7 + .../testutil/stringtestutil/stringtestutil.go | 43 + kitcom/internal/tsgo/testutil/testutil.go | 49 + .../testutil/tsbaseline/error_baseline.go | 255 + .../testutil/tsbaseline/js_emit_baseline.go | 272 + .../tsbaseline/module_resolution_baseline.go | 18 + .../testutil/tsbaseline/sourcemap_baseline.go | 124 + .../tsbaseline/sourcemap_record_baseline.go | 34 + .../tsbaseline/type_symbol_baseline.go | 488 + .../internal/tsgo/testutil/tsbaseline/util.go | 71 + kitcom/internal/tsgo/transformers/chain.go | 54 + .../transformers/declarations/diagnostics.go | 451 + .../tsgo/transformers/declarations/tracker.go | 219 + .../transformers/declarations/transform.go | 1980 + .../tsgo/transformers/declarations/util.go | 236 + .../tsgo/transformers/estransforms/async.go | 19 + .../transformers/estransforms/classfields.go | 19 + .../transformers/estransforms/classstatic.go | 19 + .../transformers/estransforms/classthis.go | 28 + .../transformers/estransforms/definitions.go | 46 + .../transformers/estransforms/esdecorator.go | 19 + .../estransforms/exponentiation.go | 90 + .../transformers/estransforms/forawait.go | 19 + .../estransforms/logicalassignment.go | 113 + .../estransforms/namedevaluation.go | 560 + .../estransforms/nullishcoalescing.go | 49 + .../estransforms/objectrestspread.go | 1108 + .../estransforms/optionalcatch.go | 37 + .../estransforms/optionalchain.go | 240 + .../tsgo/transformers/estransforms/using.go | 867 + .../transformers/estransforms/utilities.go | 49 + .../tsgo/transformers/inliners/constenum.go | 88 + .../tsgo/transformers/jsxtransforms/jsx.go | 1132 + .../transformers/jsxtransforms/utilities.go | 20 + .../tsgo/transformers/modifiervisitor.go | 28 + .../moduletransforms/commonjsmodule.go | 2010 + .../moduletransforms/commonjsmodule_test.go | 1057 + .../transformers/moduletransforms/esmodule.go | 370 + .../moduletransforms/esmodule_test.go | 249 + .../moduletransforms/externalmoduleinfo.go | 390 + .../moduletransforms/impliedmodule.go | 58 + .../moduletransforms/utilities.go | 119 + .../internal/tsgo/transformers/transformer.go | 41 + .../tstransforms/importelision.go | 205 + .../tstransforms/importelision_test.go | 258 + .../tstransforms/runtimesyntax.go | 1159 + .../tstransforms/runtimesyntax_test.go | 445 + .../transformers/tstransforms/typeeraser.go | 352 + .../tstransforms/typeeraser_test.go | 106 + .../transformers/tstransforms/utilities.go | 41 + .../internal/tsgo/transformers/utilities.go | 274 + .../tsgo/tsoptions/commandlineoption.go | 188 + .../tsgo/tsoptions/commandlineparser.go | 395 + .../tsgo/tsoptions/commandlineparser_test.go | 448 + kitcom/internal/tsgo/tsoptions/decls_test.go | 86 + kitcom/internal/tsgo/tsoptions/declsbuild.go | 61 + .../internal/tsgo/tsoptions/declscompiler.go | 1240 + .../tsgo/tsoptions/declstypeacquisition.go | 29 + kitcom/internal/tsgo/tsoptions/declswatch.go | 88 + kitcom/internal/tsgo/tsoptions/diagnostics.go | 67 + kitcom/internal/tsgo/tsoptions/enummaps.go | 256 + kitcom/internal/tsgo/tsoptions/errors.go | 105 + kitcom/internal/tsgo/tsoptions/export_test.go | 49 + kitcom/internal/tsgo/tsoptions/namemap.go | 58 + .../tsgo/tsoptions/parsedbuildcommandline.go | 33 + .../tsgo/tsoptions/parsedcommandline.go | 381 + .../tsgo/tsoptions/parsedcommandline_test.go | 168 + .../internal/tsgo/tsoptions/parsinghelpers.go | 620 + .../tsgo/tsoptions/parsinghelpers_test.go | 36 + .../tsgo/tsoptions/tsconfigparsing.go | 1776 + .../tsgo/tsoptions/tsconfigparsing_test.go | 1322 + .../tsoptionstest/parsedcommandline.go | 14 + .../tsoptionstest/vfsparseconfighost.go | 41 + .../tsgo/tsoptions/wildcarddirectories.go | 144 + kitcom/internal/tsgo/tspath/extension.go | 178 + kitcom/internal/tsgo/tspath/ignoredpaths.go | 14 + kitcom/internal/tsgo/tspath/path.go | 1129 + kitcom/internal/tsgo/tspath/path_test.go | 810 + kitcom/internal/tsgo/tspath/untitled_test.go | 61 + .../internal/tsgo/vfs/cachedvfs/cachedvfs.go | 150 + .../tsgo/vfs/cachedvfs/cachedvfs_test.go | 351 + kitcom/internal/tsgo/vfs/internal/internal.go | 189 + kitcom/internal/tsgo/vfs/iovfs/iofs.go | 207 + kitcom/internal/tsgo/vfs/iovfs/iofs_test.go | 134 + kitcom/internal/tsgo/vfs/osvfs/os.go | 177 + kitcom/internal/tsgo/vfs/osvfs/os_test.go | 67 + .../internal/tsgo/vfs/osvfs/realpath_other.go | 11 + .../internal/tsgo/vfs/osvfs/realpath_test.go | 130 + .../tsgo/vfs/osvfs/realpath_windows.go | 100 + kitcom/internal/tsgo/vfs/utilities.go | 464 + kitcom/internal/tsgo/vfs/vfs.go | 79 + kitcom/internal/tsgo/vfs/vfs_test.go | 65 + .../tsgo/vfs/vfsmock/mock_generated.go | 536 + kitcom/internal/tsgo/vfs/vfsmock/wrapper.go | 20 + .../internal/tsgo/vfs/vfsmock/wrapper_test.go | 26 + kitcom/internal/tsgo/vfs/vfstest/vfstest.go | 614 + .../internal/tsgo/vfs/vfstest/vfstest_test.go | 753 + kitcom/tsparser.go | 2 - 2679 files changed, 995826 insertions(+), 9 deletions(-) create mode 100644 Makefile create mode 100644 kitcom/internal/tsgo/api/api.go create mode 100644 kitcom/internal/tsgo/api/encoder/encoder.go create mode 100644 kitcom/internal/tsgo/api/encoder/encoder_test.go create mode 100644 kitcom/internal/tsgo/api/encoder/stringtable.go create mode 100644 kitcom/internal/tsgo/api/proto.go create mode 100644 kitcom/internal/tsgo/api/server.go create mode 100644 kitcom/internal/tsgo/api/stringer_generated.go create mode 100644 kitcom/internal/tsgo/ast/ast.go create mode 100644 kitcom/internal/tsgo/ast/checkflags.go create mode 100644 kitcom/internal/tsgo/ast/deepclone.go create mode 100644 kitcom/internal/tsgo/ast/deepclone_test.go create mode 100644 kitcom/internal/tsgo/ast/diagnostic.go create mode 100644 kitcom/internal/tsgo/ast/flow.go create mode 100644 kitcom/internal/tsgo/ast/ids.go create mode 100644 kitcom/internal/tsgo/ast/kind.go create mode 100644 kitcom/internal/tsgo/ast/kind_stringer_generated.go create mode 100644 kitcom/internal/tsgo/ast/modifierflags.go create mode 100644 kitcom/internal/tsgo/ast/nodeflags.go create mode 100644 kitcom/internal/tsgo/ast/parseoptions.go create mode 100644 kitcom/internal/tsgo/ast/precedence.go create mode 100644 kitcom/internal/tsgo/ast/subtreefacts.go create mode 100644 kitcom/internal/tsgo/ast/symbol.go create mode 100644 kitcom/internal/tsgo/ast/symbolflags.go create mode 100644 kitcom/internal/tsgo/ast/tokenflags.go create mode 100644 kitcom/internal/tsgo/ast/utilities.go create mode 100644 kitcom/internal/tsgo/ast/visitor.go create mode 100644 kitcom/internal/tsgo/astnav/tokens.go create mode 100644 kitcom/internal/tsgo/astnav/tokens_test.go create mode 100644 kitcom/internal/tsgo/binder/binder.go create mode 100644 kitcom/internal/tsgo/binder/binder_test.go create mode 100644 kitcom/internal/tsgo/binder/nameresolver.go create mode 100644 kitcom/internal/tsgo/binder/referenceresolver.go create mode 100644 kitcom/internal/tsgo/bundled/bundled.go create mode 100644 kitcom/internal/tsgo/bundled/bundled_test.go create mode 100644 kitcom/internal/tsgo/bundled/embed.go create mode 100644 kitcom/internal/tsgo/bundled/embed_generated.go create mode 100644 kitcom/internal/tsgo/bundled/generate.go create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.decorators.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.decorators.legacy.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.dom.asynciterable.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.dom.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.dom.iterable.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2015.collection.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2015.core.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2015.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2015.generator.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2015.iterable.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2015.promise.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2015.proxy.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2015.reflect.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2015.symbol.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2015.symbol.wellknown.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2016.array.include.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2016.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2016.full.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2016.intl.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2017.arraybuffer.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2017.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2017.date.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2017.full.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2017.intl.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2017.object.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2017.sharedmemory.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2017.string.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2017.typedarrays.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2018.asyncgenerator.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2018.asynciterable.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2018.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2018.full.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2018.intl.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2018.promise.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2018.regexp.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2019.array.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2019.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2019.full.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2019.intl.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2019.object.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2019.string.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2019.symbol.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2020.bigint.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2020.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2020.date.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2020.full.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2020.intl.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2020.number.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2020.promise.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2020.sharedmemory.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2020.string.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2020.symbol.wellknown.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2021.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2021.full.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2021.intl.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2021.promise.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2021.string.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2021.weakref.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2022.array.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2022.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2022.error.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2022.full.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2022.intl.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2022.object.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2022.regexp.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2022.string.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2023.array.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2023.collection.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2023.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2023.full.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2023.intl.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2024.arraybuffer.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2024.collection.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2024.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2024.full.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2024.object.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2024.promise.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2024.regexp.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2024.sharedmemory.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es2024.string.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es5.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.es6.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.esnext.array.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.esnext.collection.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.esnext.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.esnext.decorators.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.esnext.disposable.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.esnext.error.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.esnext.float16.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.esnext.full.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.esnext.intl.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.esnext.iterator.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.esnext.promise.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.esnext.sharedmemory.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.scripthost.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.webworker.asynciterable.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.webworker.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.webworker.importscripts.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs/lib.webworker.iterable.d.ts create mode 100644 kitcom/internal/tsgo/bundled/libs_generated.go create mode 100644 kitcom/internal/tsgo/bundled/noembed.go create mode 100644 kitcom/internal/tsgo/checker/checker.go create mode 100644 kitcom/internal/tsgo/checker/checker_test.go create mode 100644 kitcom/internal/tsgo/checker/emitresolver.go create mode 100644 kitcom/internal/tsgo/checker/exports.go create mode 100644 kitcom/internal/tsgo/checker/flow.go create mode 100644 kitcom/internal/tsgo/checker/grammarchecks.go create mode 100644 kitcom/internal/tsgo/checker/inference.go create mode 100644 kitcom/internal/tsgo/checker/jsdoc.go create mode 100644 kitcom/internal/tsgo/checker/jsx.go create mode 100644 kitcom/internal/tsgo/checker/mapper.go create mode 100644 kitcom/internal/tsgo/checker/nodebuilder.go create mode 100644 kitcom/internal/tsgo/checker/nodebuilderimpl.go create mode 100644 kitcom/internal/tsgo/checker/nodebuilderscopes.go create mode 100644 kitcom/internal/tsgo/checker/printer.go create mode 100644 kitcom/internal/tsgo/checker/relater.go create mode 100644 kitcom/internal/tsgo/checker/services.go create mode 100644 kitcom/internal/tsgo/checker/stringer_generated.go create mode 100644 kitcom/internal/tsgo/checker/symbolaccessibility.go create mode 100644 kitcom/internal/tsgo/checker/symboltracker.go create mode 100644 kitcom/internal/tsgo/checker/types.go create mode 100644 kitcom/internal/tsgo/checker/utilities.go create mode 100644 kitcom/internal/tsgo/collections/multimap.go create mode 100644 kitcom/internal/tsgo/collections/ordered_map.go create mode 100644 kitcom/internal/tsgo/collections/ordered_map_test.go create mode 100644 kitcom/internal/tsgo/collections/ordered_set.go create mode 100644 kitcom/internal/tsgo/collections/ordered_set_test.go create mode 100644 kitcom/internal/tsgo/collections/set.go create mode 100644 kitcom/internal/tsgo/collections/syncmap.go create mode 100644 kitcom/internal/tsgo/collections/syncset.go create mode 100644 kitcom/internal/tsgo/compiler/checkerpool.go create mode 100644 kitcom/internal/tsgo/compiler/emitHost.go create mode 100644 kitcom/internal/tsgo/compiler/emitter.go create mode 100644 kitcom/internal/tsgo/compiler/fileInclude.go create mode 100644 kitcom/internal/tsgo/compiler/fileloader.go create mode 100644 kitcom/internal/tsgo/compiler/filesparser.go create mode 100644 kitcom/internal/tsgo/compiler/host.go create mode 100644 kitcom/internal/tsgo/compiler/includeprocessor.go create mode 100644 kitcom/internal/tsgo/compiler/knownsymlinks.go create mode 100644 kitcom/internal/tsgo/compiler/pkg.go create mode 100644 kitcom/internal/tsgo/compiler/processingDiagnostic.go create mode 100644 kitcom/internal/tsgo/compiler/program.go create mode 100644 kitcom/internal/tsgo/compiler/program_test.go create mode 100644 kitcom/internal/tsgo/compiler/projectreferencedtsfakinghost.go create mode 100644 kitcom/internal/tsgo/compiler/projectreferencefilemapper.go create mode 100644 kitcom/internal/tsgo/compiler/projectreferenceparser.go create mode 100644 kitcom/internal/tsgo/core/bfs.go create mode 100644 kitcom/internal/tsgo/core/bfs_test.go create mode 100644 kitcom/internal/tsgo/core/binarysearch.go create mode 100644 kitcom/internal/tsgo/core/buildoptions.go create mode 100644 kitcom/internal/tsgo/core/compileroptions.go create mode 100644 kitcom/internal/tsgo/core/context.go create mode 100644 kitcom/internal/tsgo/core/core.go create mode 100644 kitcom/internal/tsgo/core/languagevariant.go create mode 100644 kitcom/internal/tsgo/core/languagevariant_stringer_generated.go create mode 100644 kitcom/internal/tsgo/core/linkstore.go create mode 100644 kitcom/internal/tsgo/core/modulekind_stringer_generated.go create mode 100644 kitcom/internal/tsgo/core/nodemodules.go create mode 100644 kitcom/internal/tsgo/core/parsedoptions.go create mode 100644 kitcom/internal/tsgo/core/pattern.go create mode 100644 kitcom/internal/tsgo/core/pool.go create mode 100644 kitcom/internal/tsgo/core/projectreference.go create mode 100644 kitcom/internal/tsgo/core/scriptkind.go create mode 100644 kitcom/internal/tsgo/core/scriptkind_stringer_generated.go create mode 100644 kitcom/internal/tsgo/core/scripttarget_stringer_generated.go create mode 100644 kitcom/internal/tsgo/core/stack.go create mode 100644 kitcom/internal/tsgo/core/text.go create mode 100644 kitcom/internal/tsgo/core/textchange.go create mode 100644 kitcom/internal/tsgo/core/tristate.go create mode 100644 kitcom/internal/tsgo/core/tristate_stringer_generated.go create mode 100644 kitcom/internal/tsgo/core/typeacquisition.go create mode 100644 kitcom/internal/tsgo/core/version.go create mode 100644 kitcom/internal/tsgo/core/watchoptions.go create mode 100644 kitcom/internal/tsgo/core/workgroup.go create mode 100644 kitcom/internal/tsgo/debug/debug.go create mode 100644 kitcom/internal/tsgo/debug/release.go create mode 100644 kitcom/internal/tsgo/debug/shared.go create mode 100644 kitcom/internal/tsgo/diagnostics/diagnostics.go create mode 100644 kitcom/internal/tsgo/diagnostics/diagnostics_generated.go create mode 100644 kitcom/internal/tsgo/diagnostics/extraDiagnosticMessages.json create mode 100644 kitcom/internal/tsgo/diagnostics/generate.go create mode 100644 kitcom/internal/tsgo/diagnostics/stringer_generated.go create mode 100644 kitcom/internal/tsgo/diagnosticwriter/diagnosticwriter.go create mode 100644 kitcom/internal/tsgo/evaluator/evaluator.go create mode 100644 kitcom/internal/tsgo/execute/build/buildtask.go create mode 100644 kitcom/internal/tsgo/execute/build/compilerHost.go create mode 100644 kitcom/internal/tsgo/execute/build/graph_test.go create mode 100644 kitcom/internal/tsgo/execute/build/host.go create mode 100644 kitcom/internal/tsgo/execute/build/orchestrator.go create mode 100644 kitcom/internal/tsgo/execute/build/parseCache.go create mode 100644 kitcom/internal/tsgo/execute/build/uptodatestatus.go create mode 100644 kitcom/internal/tsgo/execute/incremental/affectedfileshandler.go create mode 100644 kitcom/internal/tsgo/execute/incremental/buildInfo.go create mode 100644 kitcom/internal/tsgo/execute/incremental/buildinfotosnapshot.go create mode 100644 kitcom/internal/tsgo/execute/incremental/emitfileshandler.go create mode 100644 kitcom/internal/tsgo/execute/incremental/host.go create mode 100644 kitcom/internal/tsgo/execute/incremental/incremental.go create mode 100644 kitcom/internal/tsgo/execute/incremental/program.go create mode 100644 kitcom/internal/tsgo/execute/incremental/programtosnapshot.go create mode 100644 kitcom/internal/tsgo/execute/incremental/referencemap.go create mode 100644 kitcom/internal/tsgo/execute/incremental/snapshot.go create mode 100644 kitcom/internal/tsgo/execute/incremental/snapshottobuildinfo.go create mode 100644 kitcom/internal/tsgo/execute/tsc.go create mode 100644 kitcom/internal/tsgo/execute/tsc/compile.go create mode 100644 kitcom/internal/tsgo/execute/tsc/diagnostics.go create mode 100644 kitcom/internal/tsgo/execute/tsc/emit.go create mode 100644 kitcom/internal/tsgo/execute/tsc/extendedconfigcache.go create mode 100644 kitcom/internal/tsgo/execute/tsc/help.go create mode 100644 kitcom/internal/tsgo/execute/tsc/statistics.go create mode 100644 kitcom/internal/tsgo/execute/tsctests/fs.go create mode 100644 kitcom/internal/tsgo/execute/tsctests/readablebuildinfo.go create mode 100644 kitcom/internal/tsgo/execute/tsctests/runner.go create mode 100644 kitcom/internal/tsgo/execute/tsctests/sys.go create mode 100644 kitcom/internal/tsgo/execute/tsctests/tsc_test.go create mode 100644 kitcom/internal/tsgo/execute/tsctests/tscbuild_test.go create mode 100644 kitcom/internal/tsgo/execute/tsctests/tscwatch_test.go create mode 100644 kitcom/internal/tsgo/execute/watcher.go create mode 100644 kitcom/internal/tsgo/format/README.md create mode 100644 kitcom/internal/tsgo/format/api.go create mode 100644 kitcom/internal/tsgo/format/api_test.go create mode 100644 kitcom/internal/tsgo/format/comment_test.go create mode 100644 kitcom/internal/tsgo/format/context.go create mode 100644 kitcom/internal/tsgo/format/indent.go create mode 100644 kitcom/internal/tsgo/format/rule.go create mode 100644 kitcom/internal/tsgo/format/rulecontext.go create mode 100644 kitcom/internal/tsgo/format/rules.go create mode 100644 kitcom/internal/tsgo/format/rulesmap.go create mode 100644 kitcom/internal/tsgo/format/scanner.go create mode 100644 kitcom/internal/tsgo/format/span.go create mode 100644 kitcom/internal/tsgo/format/util.go create mode 100644 kitcom/internal/tsgo/fourslash/_scripts/convertFourslash.mts create mode 100644 kitcom/internal/tsgo/fourslash/_scripts/failingTests.txt create mode 100644 kitcom/internal/tsgo/fourslash/_scripts/makeManual.mts create mode 100644 kitcom/internal/tsgo/fourslash/_scripts/manualTests.txt create mode 100644 kitcom/internal/tsgo/fourslash/_scripts/tsconfig.json create mode 100644 kitcom/internal/tsgo/fourslash/_scripts/updateFailing.mts create mode 100644 kitcom/internal/tsgo/fourslash/baselineutil.go create mode 100644 kitcom/internal/tsgo/fourslash/fourslash.go create mode 100644 kitcom/internal/tsgo/fourslash/test_parser.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/autoImportCompletion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/basicBackspace_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/basicClassElementKeywords_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/basicEdit_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/basicGlobalCompletions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/basicInterfaceMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/basicJSDocCompletions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/basicMultifileCompletions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/basicQuickInfo_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/basicReplaceLine_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/chineseCharacterDisplay_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/completionAfterCallExpression_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/completionDetailSignature_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/completionFilterText1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/completionFilterText2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/completionFilterText3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/completionFilterText4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/completionListDefaultTypeArgumentPositionTypeOnly_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/completionListInUnclosedTypeArguments_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/completionResolveKeyword_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/completionsInJsxTag_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/completionsSelfDeclaring2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/documentHighlightImportPath_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/addDeclareToModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/addDuplicateSetter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/addFunctionAboveMultiLineLambdaExpression_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/addInterfaceMemberAboveClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/addInterfaceToNotSatisfyConstraint_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/addMemberToModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/addSignaturePartial_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/aliasMergingWithNamespace_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/aliasToVarUsedAsType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/ambientShorthandFindAllRefs_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/ambientShorthandGotoDefinition_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/argumentsAreAvailableAfterEditsAtEndOfFunction_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/argumentsIndexExpression_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/arrayCallAndConstructTypings_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/asOperatorCompletion2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/asOperatorCompletion3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/asOperatorCompletion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/assertContextualType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/augmentedTypesClass1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/augmentedTypesClass3Fourslash_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/augmentedTypesModule1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/augmentedTypesModule4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/augmentedTypesModule5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/autoImportProvider_referencesCrash_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/autoImportsWithRootDirsAndRootedPath01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/basicClassMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/bestCommonTypeObjectLiterals1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/bestCommonTypeObjectLiterals_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/classInterfaceInsert_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/closedCommentsInConstructor_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/codeCompletionEscaping_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/commentsEnumsFourslash_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/commentsLinePreservation_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/commentsUnion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionAfterAtChar_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionAfterBackslashFollowingString_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionAfterBrace_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionAfterDotDotDot_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionAfterNewline2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionAfterNewline_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionAfterQuestionDot_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionAmbientPropertyDeclaration_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionAsKeyword_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionAtCaseClause_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionAtDottedNamespace_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionAutoInsertQuestionDot_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionCloneQuestionToken_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionDetailsOfContextSensitiveParameterNoCrash_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionEntryAfterASIExpressionInClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionEntryClassMembersWithInferredFunctionReturnType1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionEntryForArgumentConstrainedToString_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionEntryForArrayElementConstrainedToString2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionEntryForArrayElementConstrainedToString_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionEntryForClassMembers_StaticWhenBaseTypeIsNotResolved_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionEntryForConst_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionEntryForDeferredMappedTypeMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionEntryForPropertyConstrainedToString_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionEntryForPropertyFromUnionOfModuleType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionEntryForShorthandPropertyAssignment_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionEntryForUnionProperty2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionEntryForUnionProperty_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionEntryOnNarrowedType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionExportFrom_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForComputedStringProperties_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForMetaProperty_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForQuotedPropertyInPropertyAssignment1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForQuotedPropertyInPropertyAssignment2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForQuotedPropertyInPropertyAssignment3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForQuotedPropertyInPropertyAssignment4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral11_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral12_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral13_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral14_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral15_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral16_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralExport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralFromSignature2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralFromSignature_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralImport1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralImport2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralInIndexedAccess01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralNonrelativeImport10_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralNonrelativeImport12_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralNonrelativeImport14_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralNonrelativeImport16_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralNonrelativeImport17_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralNonrelativeImport18_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralNonrelativeImport2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralNonrelativeImport3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralNonrelativeImport4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralNonrelativeImport7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralNonrelativeImport8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralNonrelativeImport9_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralNonrelativeImportTypings1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralNonrelativeImportTypings2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralNonrelativeImportTypings3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralRelativeImport4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralRelativeImport5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralRelativeImport6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralRelativeImportAllowJSTrue_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteralWithDynamicImport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral_details_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral_mappedTypeMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral_quotePreference1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral_quotePreference2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral_quotePreference3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral_quotePreference4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral_quotePreference5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral_quotePreference6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral_quotePreference7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral_quotePreference8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral_quotePreference_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionForStringLiteral_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionImportMetaWithGlobalDeclaration_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionImportMeta_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionImportModuleSpecifierEndingDts_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionImportModuleSpecifierEndingJs_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionImportModuleSpecifierEndingJsx_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionImportModuleSpecifierEndingTs_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionImportModuleSpecifierEndingTsxPreserve_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionImportModuleSpecifierEndingTsxReact_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionImportModuleSpecifierEndingUnsupportedExtension_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionInAugmentedClassModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionInChecks1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionInFunctionLikeBody_includesPrimitiveTypes_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionInIncompleteCallExpression_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionInJSDocFunctionNew_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionInJSDocFunctionThis_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionInJsDocQualifiedNames_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionInJsDoc_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionInNamedImportLocation_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionInTypeOf1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionInTypeOf2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionInUncheckedJSFile_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionInfoWithExplicitTypeArguments_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionInsideFunctionContainsArguments_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionInsideObjectLiteralExpressionWithInstantiatedClassType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionJSDocNamePath_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAfterAnyType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAfterClassExtends_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAfterFunction2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAfterFunction3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAfterFunction_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAfterInvalidCharacter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAfterNumericLiteral1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAfterNumericLiteral_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAfterObjectLiteral1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAfterPropertyName_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAfterRegularExpressionLiteral01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAfterRegularExpressionLiteral02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAfterRegularExpressionLiteral03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAfterRegularExpressionLiteral04_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAfterRegularExpressionLiteral05_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAfterRegularExpressionLiteral1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAfterSlash_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAfterSpreadOperator01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAfterStringLiteral1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAfterStringLiteralTypeWithNoSubstitutionTemplateLiteral_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAndMemberListOnCommentedDot_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAndMemberListOnCommentedLine_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAndMemberListOnCommentedWhiteSpace_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtBeginningOfFile01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtBeginningOfIdentifierInArrowFunction01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtDeclarationOfParameterType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtEOF1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtEOF2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtEOF_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtEndOfWordInArrowFunction01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtEndOfWordInArrowFunction02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtEndOfWordInArrowFunction03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtIdentifierDefinitionLocations_Generics_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtIdentifierDefinitionLocations_catch_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtIdentifierDefinitionLocations_classes_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtIdentifierDefinitionLocations_destructuring_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtIdentifierDefinitionLocations_enumMembers2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtIdentifierDefinitionLocations_enumMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtIdentifierDefinitionLocations_enums_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtIdentifierDefinitionLocations_functions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtIdentifierDefinitionLocations_infers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtIdentifierDefinitionLocations_interfaces_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtIdentifierDefinitionLocations_properties_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtIdentifierDefinitionLocations_varDeclarations_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtInvalidLocations_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtNodeBoundary_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListAtThisType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListBeforeKeyword_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListBeforeNewScope01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListBeforeNewScope02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListBuilderLocations_Modules_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListBuilderLocations_VariableDeclarations_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListBuilderLocations_parameters_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListBuilderLocations_properties_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListCladule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListClassMembersWithSuperClassFromUnknownNamespace_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListClassMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListClassPrivateFields_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListClassThisJS_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListDefaultTypeArgumentPositionTypeOnly_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListEnumMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListEnumValues_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListForDerivedType1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListForExportEquals2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListForExportEquals_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListForGenericInstance1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListForNonExportedMemberInAmbientModuleWithExportAssignment1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListForObjectSpread_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListForRest_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListForShorthandPropertyAssignment2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListForShorthandPropertyAssignment_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListForTransitivelyExportedMembers01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListForTransitivelyExportedMembers02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListForTransitivelyExportedMembers03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListForTransitivelyExportedMembers04_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListForUnicodeEscapeName_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListFunctionExpression_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListFunctionMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListImplementingInterfaceFunctions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInArrowFunctionInUnclosedCallSite01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInClassExpressionWithTypeParameter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInClassStaticBlocks_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInClosedFunction01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInClosedFunction02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInClosedFunction03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInClosedFunction04_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInClosedFunction06_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInClosedFunction07_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInClosedObjectTypeLiteralInSignature01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInClosedObjectTypeLiteralInSignature02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInClosedObjectTypeLiteralInSignature03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInClosedObjectTypeLiteralInSignature04_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInComments2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInComments3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInComments_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInContextuallyTypedArgument_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInEmptyFile_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInExportClause01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInExportClause02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInExportClause03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInExtendsClauseAtEOF_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInExtendsClause_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInFatArrow_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInFunctionDeclaration_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInImportClause01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInImportClause02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInImportClause03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInImportClause05_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInImportClause06_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInMiddleOfIdentifierInArrowFunction01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInNamedClassExpressionWithShadowing_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInNamedClassExpression_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInNamedFunctionExpression1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInNamedFunctionExpressionWithShadowing_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInNamedFunctionExpression_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInNamespaceImportName01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectBindingPattern01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectBindingPattern02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectBindingPattern03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectBindingPattern04_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectBindingPattern05_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectBindingPattern06_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectBindingPattern07_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectBindingPattern08_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectBindingPattern09_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectBindingPattern10_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectBindingPattern11_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectBindingPattern12_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectBindingPattern13_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectBindingPattern14_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectBindingPattern15_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectBindingPattern16_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectLiteral2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectLiteral3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectLiteral4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectLiteral5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectLiteral6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectLiteral7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectLiteral8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectLiteralAssignmentPattern1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectLiteralAssignmentPattern2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectLiteralPropertyAssignment_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectLiteralThatIsParameterOfFunctionCall_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInObjectLiteral_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInReturnWithContextualThis_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInScope_doesNotIncludeAugmentations_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInScope_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInStringLiterals1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInStringLiterals2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInTemplateLiteralParts1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInTemplateLiteralPartsNegatives1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInTypeLiteralInTypeParameter1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInTypeLiteralInTypeParameter2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInTypeLiteralInTypeParameter3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInTypeLiteralInTypeParameter4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInTypeLiteralInTypeParameter5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInTypeLiteralInTypeParameter6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInTypeLiteralInTypeParameter7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInTypeLiteralInTypeParameter8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInTypeParameterOfClassExpression1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInTypeParameterOfTypeAlias1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInTypeParameterOfTypeAlias2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInTypeParameterOfTypeAlias3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInTypedObjectLiterals2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInTypedObjectLiterals3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInTypedObjectLiterals4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInTypedObjectLiteralsWithPartialPropertyNames2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInTypedObjectLiteralsWithPartialPropertyNames_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedCommaExpression01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedCommaExpression02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedDeleteExpression01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedDeleteExpression02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedElementAccessExpression01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedElementAccessExpression02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedForLoop01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedForLoop02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedFunction01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedFunction02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedFunction03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedFunction04_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedFunction05_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedFunction06_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedFunction07_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedFunction08_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedFunction09_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedFunction10_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedFunction11_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedFunction12_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedFunction13_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedFunction14_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedFunction15_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedFunction16_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedFunction17_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedFunction18_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedFunction19_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedIndexSignature01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedIndexSignature02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedIndexSignature03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedObjectTypeLiteralInSignature01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedObjectTypeLiteralInSignature02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedObjectTypeLiteralInSignature03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedObjectTypeLiteralInSignature04_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedSpreadExpression01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedSpreadExpression02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedTaggedTemplate01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedTaggedTemplate02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedTemplate01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedTemplate02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedTypeOfExpression01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedTypeOfExpression02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInUnclosedVoidExpression01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInferKeyword_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInsideTargetTypedFunction_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInstanceProtectedMembers2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInstanceProtectedMembers3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInstanceProtectedMembers4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInstanceProtectedMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInvalidMemberNames2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInvalidMemberNames_escapeQuote_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInvalidMemberNames_startWithSpace_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInvalidMemberNames_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListInvalidMemberNames_withExistingIdentifier_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListKeywords_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListModuleMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListNewIdentifierBindingElement_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListNewIdentifierFunctionDeclaration_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListNewIdentifierVariableDeclaration_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListObjectMembersInTypeLocationWithTypeof_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListObjectMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListOfGenericSymbol_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListOfSplitInterface_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListOfUnion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListOnAliasedModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListOnAliases2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListOnAliases3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListOnAliases_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListOnFunctionCallWithOptionalArgument_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListOnMethodParameterName_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListOnParamInClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListOnParam_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListOnPrivateVariableInModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListOnSuper_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListOnVarBetweenModules_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListOutsideOfClosedArrowFunction01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListOutsideOfClosedArrowFunction02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListOutsideOfClosedFunctionDeclaration01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListOutsideOfForLoop01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListOutsideOfForLoop02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListPrivateMembers2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListPrivateMembers3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListPrivateMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListPrivateNamesAccessors_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListPrivateNamesMethods_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListPrivateNames_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListProtectedMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListStaticMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListStaticProtectedMembers2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListStaticProtectedMembers3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListStaticProtectedMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListStringParenthesizedExpression_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListStringParenthesizedType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListSuperMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListWithAmbientDeclaration_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListWithLabel_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListWithUnresolvedModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListWithoutVariableinitializer_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionList_getExportsOfModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionListsStringLiteralTypeAsIndexedAccessTypeObject_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionNoAutoInsertQuestionDotForThis_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionNoAutoInsertQuestionDotForTypeParameter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionNoAutoInsertQuestionDotWithUserPreferencesOff_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionOfAwaitPromise1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionOfAwaitPromise2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionOfAwaitPromise3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionOfAwaitPromise4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionOfAwaitPromise5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionOfAwaitPromise6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionOfAwaitPromise7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionOfInterfaceAndVar_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionPreferredSuggestions1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionPropertyShorthandForObjectLiteral2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionPropertyShorthandForObjectLiteral3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionPropertyShorthandForObjectLiteral4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionReturnConstAssertion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionSatisfiesKeyword_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionTypeAssertion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionTypeGuard_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionTypeofExpressions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionUsingKeyword_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionWithConditionalOperatorMissingColon_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionWithDotFollowedByNamespaceKeyword_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionWithNamespaceInsideFunction_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completions01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completions03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsAfterAsyncInObjectLiteral_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsAfterJSDoc_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsAfterKeywordsInBlock_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsAfterLessThanToken_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsAssertKeyword_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsAsserts_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsAtGenericTypeArguments_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsAtTypeArguments_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsAugmentedTypesClass2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsBeforeRestArg1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsBigIntShowNoCompletions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsClassPropertiesAfterPrivateProperty_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsCombineOverloads_restParameter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsCombineOverloads_returnType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsCombineOverloads_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsConditionalMember_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsDefaultExport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsDefaultKeywordWhenDefaultExportAvailable_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsDestructuring_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsDiscriminatedUnion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsDotDotDotInObjectLiteral1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsECMAPrivateMemberTriggerCharacter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsECMAPrivateMember_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsElementAccessNumeric_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsExportImport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsExternalModuleReferenceResolutionOrderInImportDeclaration_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsExternalModuleRenamedExports_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsForLatterTypeParametersInConstraints1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsForRecursiveGenericTypesMember_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsForSelfTypeParameterInConstraint1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsForStringDependingOnContexSensitiveSignature_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsGeneratorFunctions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsGenericIndexedAccess1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsGenericIndexedAccess2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsGenericIndexedAccess3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsGenericIndexedAccess4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsGenericIndexedAccess5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsGenericIndexedAccess6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsGenericTypeWithMultipleBases1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsGenericUnconstrained_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsImportDeclarationAttributesEmptyModuleSpecifier1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsImportDeclarationAttributesErrorModuleSpecifier1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsImportDefaultExportCrash1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsImportOrExportSpecifier_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsImport_computedSymbolName_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsImport_notFromUnrelatedNodeModules_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsImport_promoteTypeOnly2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsImport_shadowedByLocal_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsImport_umdDefaultNoCrash2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsInExport_invalid_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsInExport_moduleBlock_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsInExport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsInJsxTag_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsInRequire_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsIndexSignatureConstraint1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsInterfaceElement_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsIsTypeOnlyCompletion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsJSDocImportTagAttributesEmptyModuleSpecifier1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsJSDocImportTagAttributesErrorModuleSpecifier1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsJSDocImportTagEmptyModuleSpecifier1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsJSDocNoCrash1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsJSDocNoCrash2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsJSDocNoCrash3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsJsPropertyAssignment_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsJsdocParamTypeBeforeName_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsJsdocTag_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsJsdocTypeTagCast_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsJsxAttribute2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsJsxAttributeInitializer2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsJsxExpression_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsKeyof_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsKeywordsExtends_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsLiteralDirectlyInArgumentWithNullableConstraint_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsLiteralDirectlyInRestConstrainedToArrayType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsLiteralDirectlyInRestConstrainedToTupleType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsLiteralFromInferenceWithinInferredType1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsLiteralFromInferenceWithinInferredType2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsLiteralFromInferenceWithinInferredType3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsLiteralMatchingGenericSignature_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsLiteralOnPropertyValueMatchingGeneric_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsLiteralOverload_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsLiterals_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsMergedDeclarations1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsMergedDeclarations2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsNamespaceMergedWithClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsNamespaceMergedWithObject_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsNamespaceName_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsNewTarget_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsNonExistentImport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsObjectLiteralMethod6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsObjectLiteralModuleExports_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsObjectLiteralUnionStringMappingType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsObjectLiteralUnionTemplateLiteralType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsObjectLiteralWithPartialConstraint_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsOptionalKindModifier_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsOptionalMethod_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsOverridingMethod10_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsOverridingMethod11_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsOverridingMethod14_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsOverridingMethod17_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsOverridingMethod1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsOverridingMethod3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsOverridingMethod4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsOverridingMethod9_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsOverridingMethodCrash1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsOverridingProperties1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsPathsJsonModuleWithAmd_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsPathsJsonModuleWithoutResolveJsonModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsPathsJsonModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsPathsRelativeJsonModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsPaths_importType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsPaths_kinds_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsPaths_pathMapping_nonTrailingWildcard1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsPaths_pathMapping_notInNestedDirectory_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsPaths_pathMapping_parentDirectory_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsPaths_pathMapping_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsPrivateProperties_Js_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsPropertiesPriorities_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsPropertiesWithPromiseUnionType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsQuotedObjectLiteralUnion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsRecommended_equals_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsRecommended_nonAccessibleSymbol_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsRecommended_switch_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsRecommended_union_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsRecursiveNamespace_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsRedeclareModuleAsGlobal_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsSelfDeclaring2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsSelfDeclaring3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsStringLiteral_fromTypeConstraint_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsStringsWithTriggerCharacter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsSymbolMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsTriggerCharacter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsTuple_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsTypeAssertionKeywords_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsTypeKeywords_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsTypeOnlyNamespace_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsUnionStringLiteralProperty_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsUnion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsUniqueSymbol1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWithDeprecatedTag1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWithDeprecatedTag2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWithDeprecatedTag3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWithDeprecatedTag5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWithDeprecatedTag6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWithDeprecatedTag7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWithDeprecatedTag9_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWithGenericStringLiteral_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWithOptionalPropertiesGenericConstructor_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWithOptionalPropertiesGenericDeep_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWithOptionalPropertiesGenericPartial2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWithOptionalPropertiesGenericPartial3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWithOptionalPropertiesGenericPartial_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWithOptionalPropertiesGenericValidBoolean_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWithOptionalPropertiesGeneric_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWithOptionalProperties_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWithOverride1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWithOverride2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWithStringReplacementMode1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWrappedClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/completionsWritingSpreadArgument_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/constEnumQuickInfoAndCompletionList_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/constQuickInfoAndCompletionList_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/constructorFindAllReferences1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/constructorFindAllReferences2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/constructorFindAllReferences3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/constructorFindAllReferences4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/constructorQuickInfo_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/contextualTypingFromTypeAssertion1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/contextualTypingGenericFunction1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/contextualTypingOfGenericCallSignatures1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/contextualTypingReturnExpressions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/contextuallyTypedFunctionExpressionGeneric1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/contextuallyTypedObjectLiteralMethodDeclarationParam01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/contextuallyTypedParameters_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/declarationMapGoToDefinition_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/declarationMapsGoToDefinitionRelativeSourceRoot_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/declarationMapsGoToDefinitionSameNameDifferentDirectory_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/declarationMapsOutOfDateMapping_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/defaultParamsAndContextualTypes_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/definition01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/definitionNameOnEnumMember_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/definition_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/deprecatedInheritedJSDocOverload_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightAtInheritedProperties1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightAtInheritedProperties2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightAtInheritedProperties3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightAtInheritedProperties4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightAtInheritedProperties5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightAtInheritedProperties6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightAtParameterPropertyDeclaration1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightAtParameterPropertyDeclaration2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightAtParameterPropertyDeclaration3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightDefaultInKeyword_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightDefaultInSwitch_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightInExport1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightInKeyword_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightInTypeExport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightJSDocTypedef_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightMultilineTemplateStrings_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightTemplateStrings_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightVarianceModifiers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlights01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightsInvalidGlobalThis_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightsInvalidModifierLocations_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlightsTypeParameterInHeritageClause01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlights_33722_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlights_40082_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/documentHighlights_filesToSearch_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/doubleUnderscoreCompletions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/doubleUnderscoreRenames_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/duplicateFunctionImplementation_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/duplicateIndexers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/duplicateTypeParameters_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/editJsdocType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/editTemplateConstraint_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/emptyArrayInference_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/emptyExportFindReferences_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/enumAddition_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/esModuleInteropFindAllReferences2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/esModuleInteropFindAllReferences_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/excessivelyLargeArrayLiteralCompletions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/explainFilesNodeNextWithTypesReference_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/exportDefaultClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/exportDefaultFunction_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/exportEqualCallableInterface_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/exportEqualNamespaceClassESModuleInterop_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/exportEqualsInterfaceA_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/extendsKeywordCompletion1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/extendsKeywordCompletion2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferPropertyAccessExpressionHeritageClause_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesDynamicImport1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesDynamicImport2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesDynamicImport3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesFilteringMappedTypeProperty_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesFromLinkTagReference1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesFromLinkTagReference2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesFromLinkTagReference3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesFromLinkTagReference4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesFromLinkTagReference5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesImportMeta_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesJSDocFunctionNew_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesJSDocFunctionThis_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesJsDocTypeLiteral_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesJsOverloadedFunctionParameter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesJsRequireDestructuring1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesJsRequireDestructuring_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesLinkTag1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesLinkTag2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesLinkTag3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesNonExistentExportBinding_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesOfConstructor_badOverload_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesOfConstructor_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesOfJsonModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesTripleSlash_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesUmdModuleAsGlobalConst_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllReferencesUndefined_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsBadImport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsCatchClause_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsClassExpression0_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsClassExpression1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsClassExpression2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsClassStaticBlocks_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsClassWithStaticThisAccess_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsCommonJsRequire2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsCommonJsRequire3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsCommonJsRequire_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsConstructorFunctions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsDeclareClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsDefaultImport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsDefinition_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsDestructureGeneric_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsDestructureGetter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsEnumAsNamespace_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsEnumMember_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsExportConstEqualToClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsExportDefaultClassConstructor_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsExportEquals_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsExportNotAtTopLevel_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForComputedProperties2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForComputedProperties_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForDefaultExport01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForDefaultExport02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForDefaultExport03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForDefaultExport04_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForDefaultExport09_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForDefaultExport_anonymous_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForDefaultExport_reExport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForDefaultExport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForDefaultKeyword_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForFunctionExpression01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForImportCallType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForImportCall_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForMappedType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForObjectLiteralProperties_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForObjectSpread_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForRest_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForStaticInstanceMethodInheritance_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForStaticInstancePropertyInheritance_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForStringLiteralTypes_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForStringLiteral_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForUMDModuleAlias1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForVariableInExtendsClause01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForVariableInExtendsClause02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsForVariableInImplementsClause01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsGlobalThisKeywordInModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsImportEquals_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsImportType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsInClassExpression_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsIndexedAccessTypes_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsInheritedProperties1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsInheritedProperties2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsInheritedProperties3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsInheritedProperties4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsInheritedProperties5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsInsideTemplates1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsInsideTemplates2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsInsideWithBlock_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsIsDefinition_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsJsDocImportTag2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsJsDocImportTag3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsJsDocImportTag4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsJsDocImportTag5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsJsDocImportTag_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsJsDocTemplateTag_class_js_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsJsDocTemplateTag_class_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsJsDocTemplateTag_function_js_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsJsDocTemplateTag_function_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsJsDocTypeDef_js_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsJsDocTypeDef_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsJsThisPropertyAssignment2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsJsThisPropertyAssignment_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsMappedType_nonHomomorphic_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsMappedType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsMissingModulesOverlappingSpecifiers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsModuleDotExports_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsNoImportClause_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsNoSubstitutionTemplateLiteralNoCrash1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsNonModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsNonexistentPropertyNoCrash1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName04_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName05_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName06_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName07_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName10_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsOfConstructor_withModifier_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsOnDecorators_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsOnDefinition2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsOnDefinition_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsOnImportAliases2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsOnImportAliases_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsOnPrivateParameterProperty1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsParameterPropertyDeclaration1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsParameterPropertyDeclaration2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsParameterPropertyDeclaration3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsParameterPropertyDeclaration_inheritance_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsPrimitiveJsDoc_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsPrivateNameAccessors_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsPrivateNameMethods_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsPrivateNameProperties_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsPropertyContextuallyTypedByTypeParam01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsReExport_broken2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsReExport_broken_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsRedeclaredPropertyInDerivedInterface_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsRootSymbols_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsThisKeywordMultipleFiles_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsThisKeyword_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsTypeParameterInMergedInterface_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsTypedef_importType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsTypedef_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsTypeofImport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsUnionProperty_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsUnresolvedSymbols1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsUnresolvedSymbols2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsUnresolvedSymbols3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames9_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsWithShorthandPropertyAssignment2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsWithShorthandPropertyAssignment_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefsWriteAccess_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefs_importType_js4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefs_importType_meaningAtLocation_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefs_importType_named_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefs_importType_typeofImport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findAllRefs_jsEnum_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findReferencesAcrossMultipleProjects_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findReferencesAfterEdit_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findReferencesBindingPatternInJsdocNoCrash1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findReferencesBindingPatternInJsdocNoCrash2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findReferencesDefinitionDisplayParts_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findReferencesJSXTagName2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findReferencesJSXTagName3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findReferencesJSXTagName_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/findReferencesSeeTagInTs_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/fixingTypeParametersQuickInfo_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/forwardReference_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/genericCallSignaturesInNonGenericTypes1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/genericCallSignaturesInNonGenericTypes2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/genericCallsWithOptionalParams1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/genericCloduleCompletionList_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/genericCombinatorWithConstraints1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/genericCombinators3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/genericDerivedTypeAcrossModuleBoundary1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/genericFunctionWithGenericParams1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/genericInterfacesWithConstraints1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/genericTypeAliasIntersectionCompletions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/genericTypeParamUnrelatedToArguments1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/genericTypeWithMultipleBases1MultiFile_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/genericWithSpecializedProperties1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/genericWithSpecializedProperties2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/genericWithSpecializedProperties3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptCompletions10_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptCompletions11_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptCompletions12_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptCompletions13_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptCompletions14_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptCompletions15_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptCompletions18_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptCompletions19_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptCompletions1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptCompletions20_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptCompletions21_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptCompletions22_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptCompletions2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptCompletions3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptCompletions4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptCompletions5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptCompletions8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptCompletions9_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptCompletions_tsCheck_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptGlobalCompletions1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptQuickInfo1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptQuickInfo2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptQuickInfo3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptQuickInfo4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptQuickInfo5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptQuickInfo6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptQuickInfo7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptQuickInfo8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getJavaScriptSyntacticDiagnostics24_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesAbstract01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesAbstract02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesAbstract03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesAfterEdit_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesAsyncAwait2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesAsyncAwait3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesAsyncAwait_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesClassExpressionConstructor_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesClassExpressionPrivate_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesClassExpressionPublic_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesClassExpressionStaticThis_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesClassExpressionStatic_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesClassExpressionThis_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesConst01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesConst04_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesConstructor2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesConstructor_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesDeclare1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesDeclare2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesDeclare3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesExport1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesExport2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesExport3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesIfElse2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesIfElse3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesIfElseBroken_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesIfElse_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesIsDefinitionOfArrowFunction_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesIsDefinitionOfBindingPattern_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesIsDefinitionOfClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesIsDefinitionOfComputedProperty_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesIsDefinitionOfEnum_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesIsDefinitionOfExport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesIsDefinitionOfFunction_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesIsDefinitionOfInterfaceClassMerge_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesIsDefinitionOfInterface_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesIsDefinitionOfNamespace_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesIsDefinitionOfNumberNamedProperty_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesIsDefinitionOfParameter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesIsDefinitionOfStringNamedProperty_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesIsDefinitionOfTypeAlias_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesIsDefinitionOfVariable_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesLoopBreakContinue2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesLoopBreakContinue3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesLoopBreakContinue4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesLoopBreakContinue5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesLoopBreakContinue_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesModifiersNegatives1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesNonStringImportAssertion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesNonStringImportAttributes_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesOfAnonymousFunction2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesOfAnonymousFunction_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesOfDecorators_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesOfUndefinedSymbol_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesPrivate1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesPrivate2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesPropertyInAliasedInterface_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesProtected1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesProtected2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesPublic1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesPublic2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesReadonly1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesReadonly2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesReadonly3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesReturn2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesReturn3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesReturn_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesSetAndGet2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesSetAndGet3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesSetAndGet_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesStatic1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesStringLiteralTypes_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesStringLiterals_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesSuper2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesSuper3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesSuperNegatives_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesSuper_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesSwitchCaseDefault2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesSwitchCaseDefault3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesSwitchCaseDefault_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesThis2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesThis3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesThis4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesThis5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesThis_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesThrow2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesThrow3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesThrow4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesThrow5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesThrow6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesThrow7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesThrow8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesThrow_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getOccurrencesYield_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getPropertySymbolsFromBaseTypesDoesntCrash_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getQuickInfoForIntersectionTypes_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getRenameInfoTests1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/getRenameInfoTests2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/globalThisCompletion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionAcrossMultipleProjects_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionAlias_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionAmbiants_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionApparentTypeProperties_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionAwait1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionAwait2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionAwait3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionAwait4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionBuiltInTypes_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionBuiltInValues_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionCSSPatternAmbientModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionClassConstructors_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionClassStaticBlocks_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionConstructorOfClassExpression01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionConstructorOfClassWhenClassIsPrecededByNamespace01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionConstructorOverloads_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionDecoratorOverloads_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionDecorator_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionDestructuredRequire1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionDestructuredRequire2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionDifferentFileIndirectly_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionDifferentFile_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionDynamicImport1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionDynamicImport2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionDynamicImport3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionDynamicImport4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionExpandoClass1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionExpandoClass2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionExpandoElementAccess_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionExternalModuleName2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionExternalModuleName3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionExternalModuleName4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionExternalModuleName5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionExternalModuleName6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionExternalModuleName7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionExternalModuleName8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionExternalModuleName9_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionExternalModuleName_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionFunctionOverloadsInClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionFunctionOverloads_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionFunctionType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionImplicitConstructor_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionImport1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionImport2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionImport3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionImportedNames10_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionImportedNames11_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionImportedNames2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionImportedNames3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionImportedNames4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionImportedNames5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionImportedNames6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionImportedNames7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionImportedNames8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionImportedNames9_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionImportedNames_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionImports_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionInMemberDeclaration_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionInTypeArgument_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionIndexSignature2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionIndexSignature_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionInstanceof1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionInstanceof2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionInterfaceAfterImplement_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionJsDocImportTag1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionJsDocImportTag2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionJsDocImportTag3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionJsDocImportTag4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionJsDocImportTag5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionJsModuleExports_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionJsModuleNameAtImportName_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionJsModuleName_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionJsxCall_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionJsxNotSet_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionLabels_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionMember_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionMetaProperty_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionMethodOverloads_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionModifiers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionMultipleDefinitions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionNewExpressionTargetNotClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionObjectBindingElementPropertyName01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionObjectLiteralProperties1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionObjectLiteralProperties_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionObjectSpread_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverloadsInMultiplePropertyAccesses_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember10_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember11_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember12_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember13_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember14_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember15_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember16_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember17_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember18_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember19_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember20_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember21_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember22_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember23_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember24_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember25_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember26_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionOverriddenMember9_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionPartialImplementation_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionPrimitives_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionPrivateName_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionPropertyAssignment_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionRest_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionReturn1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionReturn2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionReturn3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionReturn4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionReturn5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionReturn6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionReturn7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionSameFile_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionSatisfiesExpression1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionScriptImportServer_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionScriptImport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionShadowVariableInsideModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionShadowVariable_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionShorthandProperty01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionShorthandProperty02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionShorthandProperty03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionShorthandProperty04_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionShorthandProperty05_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionShorthandProperty06_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionSignatureAlias_require_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionSimple_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionSourceUnit_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionSwitchCase1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionSwitchCase2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionSwitchCase3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionSwitchCase4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionSwitchCase5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionSwitchCase6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionSwitchCase7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionTaggedTemplateOverloads_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionThis_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionTypeOnlyImport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionTypePredicate_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionTypeReferenceDirective_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionTypeofThis_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionUndefinedSymbols_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionUnionTypeProperty1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionUnionTypeProperty2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionUnionTypeProperty3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionUnionTypeProperty4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionUnionTypeProperty_discriminated_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionVariableAssignment1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionVariableAssignment2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionVariableAssignment3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionVariableAssignment_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionYield1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionYield2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionYield3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinitionYield4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinition_filteringGenericMappedType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinition_filteringMappedType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinition_mappedType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinition_super_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToDefinition_untypedModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/goToModuleAliasDefinition_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/gotoDefinitionConstructorFunction_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/gotoDefinitionInObjectBindingPattern1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/gotoDefinitionInObjectBindingPattern2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/gotoDefinitionLinkTag1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/gotoDefinitionLinkTag2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/gotoDefinitionLinkTag3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/gotoDefinitionLinkTag4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/gotoDefinitionLinkTag5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/gotoDefinitionLinkTag6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/gotoDefinitionPropertyAccessExpressionHeritageClause_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/gotoDefinitionSatisfiesTag_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/gotoDefinitionThrowsTag_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/highlightsForExportFromUnfoundModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/hoverOverComment_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/hoverOverPrivateName_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletionsPackageJsonExportsSpecifierEndsInTs_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletionsPackageJsonExportsTrailingSlash1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletionsPackageJsonImportsConditions1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletionsPackageJsonImportsLength1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletionsPackageJsonImportsLength2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletionsPackageJsonImportsPattern2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletionsPackageJsonImportsPattern_capsInPath1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletionsPackageJsonImportsPattern_capsInPath2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletionsPackageJsonImportsPattern_js_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletionsPackageJsonImportsPattern_js_ts_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletionsPackageJsonImportsPattern_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletionsPackageJsonImportsPattern_ts_js_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletionsPackageJsonImportsPattern_ts_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletionsPackageJsonImportsPattern_ts_ts_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletionsPackageJsonImports_js_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletionsPackageJsonImports_ts_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletions_importsMap1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletions_importsMap2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletions_importsMap3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletions_importsMap4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importCompletions_importsMap5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importStatementCompletions4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importStatementCompletions_noPatternAmbient_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importStatementCompletions_pnpmTransitive_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importTypeCompletions2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importTypeMemberCompletions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importTypeNodeGoToDefinition_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/importValueUsedAsType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/incrementalParsingInsertIntoMethod1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/indexSignatureWithoutAnnotation_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/indexerReturnTypes1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/indirectClassInstantiation_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/indirectJsRequireRename_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/insertArgumentBeforeOverloadedConstructor_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/insertInterfaceAndCheckTypeLiteralField_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/insertMethodCallAboveOthers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/insertPublicBeforeSetter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/insertSecondTryCatchBlock_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/insertVarAfterEmptyTypeParamList_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/instanceTypesForGenericType1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/intellisenseInObjectLiteral_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/isDefinitionAcrossGlobalProjects_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/isDefinitionAcrossModuleProjects_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/isDefinitionInterfaceImplementation_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/isDefinitionOverloads_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/isDefinitionShorthandProperty_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/isDefinitionSingleImport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/isDefinitionSingleReference_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/javaScriptClass2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/javaScriptClass3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/javaScriptClass4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/javaScriptModules12_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/javaScriptModules13_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/javaScriptModules14_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/javaScriptModules18_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/javaScriptModules19_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/javaScriptModulesError1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/javaScriptModulesWithBackticks_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/javascriptModules20_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/javascriptModules21_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/javascriptModules23_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/javascriptModules25_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/javascriptModulesTypeImportAsValue_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/javascriptModulesTypeImport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocAliasQuickInfo_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocAugments_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocDontBreakWithNamespaces_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocExtends_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocForTypeAlias_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocFunctionSignatures10_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocFunctionSignatures11_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocFunctionSignatures12_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocFunctionSignatures13_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocFunctionSignatures3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocFunctionSignatures5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocFunctionSignatures6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocFunctionSignatures7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocFunctionSignatures8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocFunctionTypeCompletionsNoCrash_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocGenerics1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocGenerics2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocIndentationPreservation1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocIndentationPreservation2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocIndentationPreservation3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocInheritDoc_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocPropertyDescription10_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocPropertyDescription11_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocPropertyDescription12_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocPropertyDescription1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocPropertyDescription2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocPropertyDescription3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocPropertyDescription4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocPropertyDescription5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocPropertyDescription6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocPropertyDescription7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocPropertyDescription8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocPropertyDescription9_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocSee1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocSee2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocSee3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocSee4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocSee_rename1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocSignature-43394_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocTagsWithHyphen_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocTypeTagQuickInfo1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocTypeTagQuickInfo2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsDocTypedefQuickInfo1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsObjectDefinePropertyRenameLocations_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsQuickInfoGenerallyAcceptableSize_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsRequireQuickInfo_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocCallbackTagRename01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocCallbackTag_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocExtendsTagCompletion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocImplementsTagCompletion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocImportTagCompletion1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocLink1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocLink2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocLink3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocLink4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocLink5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocLink6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocLink_findAllReferences1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocLink_rename1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocNullableUnion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocOnInheritedMembers1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocOnInheritedMembers2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocOverloadTagCompletion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocParamTagSpecialKeywords_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocParameterNameCompletion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocPropTagCompletion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocPropertyTagCompletion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocReturnsTag_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocSatisfiesTagCompletion1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocSatisfiesTagCompletion2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocSatisfiesTagFindAllReferences_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocSatisfiesTagRename_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocTemplatePrototypeCompletions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocTemplateTagCompletion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocThrowsTagCompletion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocThrowsTag_findAllReferences_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocThrowsTag_rename_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocTypedefTag1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocTypedefTag2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocTypedefTagGoToDefinition_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocTypedefTagNamespace_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocTypedefTagRename01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocTypedefTagRename02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocTypedefTagRename03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocTypedefTagRename04_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocTypedefTagSemanticMeaning0_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocTypedefTagSemanticMeaning1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocTypedefTagServices_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocTypedefTagTypeExpressionCompletion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsdocTypedefTag_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsxAriaLikeCompletions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsxElementMissingOpeningTagNoCrash_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsxFindAllReferencesOnRuntimeImportWithPaths1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsxQualifiedTagCompletion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/jsxSpreadReference_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/lambdaThisMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/letQuickInfoAndCompletionList_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/localFunction_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/localGetReferences_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberCompletionFromFunctionCall_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberCompletionOnRightSideOfImport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberCompletionOnTypeParameters2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberCompletionOnTypeParameters_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListAfterDoubleDot_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListAfterSingleDot_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListErrorRecovery_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListInFunctionCall2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListInFunctionCall_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListInReopenedEnum_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListInWithBlock2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListInWithBlock3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListInWithBlock_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListInsideObjectLiterals_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListOfClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListOfEnumFromExternalModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListOfEnumInModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListOfExportedClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListOfModuleAfterInvalidCharater_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListOfModuleBeforeKeyword_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListOfModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListOfVarInArrowExpression_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListOnConstructorType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListOnContextualThis_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListOnExplicitThis_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListOnFunctionParameter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberListOnThisInClassWithPrivates_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/memberlistOnDDot_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/moduleEnumModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/moduleMembersOfGenericType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/moduleReexportedIntoGlobalQuickInfo_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/ngProxy1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/ngProxy2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/ngProxy3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/noCompletionListOnCommentsInsideObjectLiterals_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/noCompletionsForCurrentOrLaterParametersInDefaults_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/noQuickInfoForLabel_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/noQuickInfoInWhitespace_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/noTypeParameterInLHS_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/nodeModulesImportCompletions1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/nonExistingImport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/numericPropertyNames_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/objectLiteralBindingInParameter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/occurrences01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/occurrences02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/overloadObjectLiteralCrash_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/overloadQuickInfo_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/packageJsonImportsFailedLookups_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/parameterWithDestructuring_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/parameterWithNestedDestructuring_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/parameterlessSetter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsAllowModuleAugmentationExtensions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsAllowTsExtensions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonExportsBundlerNoNodeCondition_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonExportsCustomConditions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonExportsWildcard10_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonExportsWildcard11_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonExportsWildcard12_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonExportsWildcard1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonExportsWildcard2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonExportsWildcard3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonExportsWildcard4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonExportsWildcard5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonExportsWildcard6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonExportsWildcard7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonExportsWildcard8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonExportsWildcard9_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsBundlerNoNodeCondition_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsCustomConditions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsIgnoreMatchingNodeModule1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsIgnoreMatchingNodeModule2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsOnlyFromClosestScope1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsSrcNoDistWildcard1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsSrcNoDistWildcard2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsSrcNoDistWildcard3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsSrcNoDistWildcard4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsSrcNoDistWildcard5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsSrcNoDistWildcard6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsSrcNoDistWildcard7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsSrcNoDistWildcard8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsSrcNoDistWildcard9_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsWildcard10_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsWildcard11_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsWildcard12_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsWildcard1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsWildcard2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsWildcard3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsWildcard4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsWildcard5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsWildcard6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsWildcard7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsWildcard8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsPackageJsonImportsWildcard9_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsTypesVersionsLocal_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsTypesVersionsWildcard1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsTypesVersionsWildcard2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsTypesVersionsWildcard3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsTypesVersionsWildcard4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsTypesVersionsWildcard5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/pathCompletionsTypesVersionsWildcard6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/processInvalidSyntax1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/promiseTyping1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/promiseTyping2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/propertyDuplicateIdentifierError_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/protoPropertyInObjectLiteral_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/protoVarInContextualObjectLiteral_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/protoVarVisibleWithOuterScopeUnderscoreProto_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/prototypeProperty_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/publicBreak_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/qualifiedName_import-declaration-with-variable-entity-names_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoAlias_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoAssertionNodeNotReusedWhenTypeNotEquivalent1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoAssignToExistingClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoAtPropWithAmbientDeclarationInJs_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoBindingPatternInJsdocNoCrash1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoCallProperty_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoCircularInstantiationExpression_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoClassKeyword_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoCommentsClassMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoCommentsClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoCommentsCommentParsing_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoCommentsFunctionDeclaration_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoCommentsFunctionExpression_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoContextualTyping_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoContextuallyTypedSignatureOptionalParameterFromIntersection1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsArrowFunctionExpression_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsClassAccessors_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsClassAutoAccessors_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsClassConstructor_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsClassDefaultAnonymous_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsClassDefaultNamed_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsClassIncomplete_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsClassMethod_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsClassProperty_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsConst_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsEnum1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsEnum2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsEnum3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsEnum4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsExternalModuleAlias_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsExternalModules_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsFunctionExpression_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsFunctionIncomplete_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsFunction_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsIife_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsInterfaceMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsInterface_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsInternalModuleAlias_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsLet_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsLiteralLikeNames01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsLocalFunction_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsModules_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsParameters_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsTypeAlias_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsTypeParameterInClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsTypeParameterInFunctionLikeInTypeAlias_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsTypeParameterInFunction_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsTypeParameterInInterface_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsTypeParameterInTypeAlias_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsUsing_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsVarWithStringTypes01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoDisplayPartsVar_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoElementAccessDeclaration_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoEnumMembersAcceptNonAsciiStrings_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoExportAssignmentOfGenericInterface_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoExtendArray_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForAliasedGeneric_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForArgumentsPropertyNameInJsMode1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForArgumentsPropertyNameInJsMode2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForConstAssertions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForConstDeclaration_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForConstTypeReference_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForContextuallyTypedArrowFunctionInSuperCall_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForContextuallyTypedFunctionInReturnStatement_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForContextuallyTypedIife_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForContextuallyTypedParameters_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForDecorators_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForDerivedGenericTypeWithConstructor_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForDestructuringShorthandInitializer_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForFunctionDeclaration_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForGenericConstraints1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForGenericPrototypeMember_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForGenericTaggedTemplateExpression_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForGetterAndSetter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForIn_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForIndexerResultWithConstraint_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForJSDocCodefence_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForJSDocUnknownTag_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForJSDocWithHttpLinks_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForJSDocWithUnresolvedHttpLinks_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForNamedTupleMember_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForObjectBindingElementName01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForObjectBindingElementName02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForObjectBindingElementName03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForObjectBindingElementName04_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForObjectBindingElementName05_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForObjectBindingElementName06_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForObjectBindingElementPropertyName01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForObjectBindingElementPropertyName02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForObjectBindingElementPropertyName04_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForOverloadOnConst1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForRequire_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForShorthandProperty_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForSyntaxErrorNoError_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForTypeParameterInTypeAlias1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForTypeParameterInTypeAlias2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForTypeofParameter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoForUMDModuleAlias_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoFromContextualType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoFromContextualUnionType1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoFromEmptyBlockComment_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoFunctionCheckType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoFunctionKeyword_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoGenerics_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoGetterSetter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoImportMeta_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoImportNonunicodePath_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoInFunctionTypeReference_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoInInvalidIndexSignature_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoInJsdocInTsFile1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoInObjectLiteral_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoInOptionalChain_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoInWithBlock_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoInheritDoc2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoInheritDoc3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoInheritDoc4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoInheritDoc5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoInheritDoc6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoInheritDoc_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJSDocAtBeforeSpace_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJSDocBackticks_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJSDocFunctionNew_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJSDocFunctionThis_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJSDocTags_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJSExport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocAlias_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocGetterSetterNoCrash1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocGetterSetter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocInheritage_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocNonDiscriminatedUnionSharedProp_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTags10_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTags11_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTags12_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTags13_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTags14_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTags15_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTags16_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTags1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTags2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTags3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTags4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTags5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTags6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTags7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTags8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTags9_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTagsCallback_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTagsFunctionOverload01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTagsFunctionOverload03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTagsFunctionOverload05_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTagsTypedef_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocTextFormatting1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDocThisTag_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsDoc_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsPropertyAssignedAfterMethodDeclaration_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoJsdocTypedefMissingType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoLink10_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoLink11_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoLink5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoLink6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoLink7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoLink8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoLink9_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoMappedSpreadTypes_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoMappedTypeMethods_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoMappedTypeRecursiveInference_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoMappedType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoModuleVariables_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoNamedTupleMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoNarrowedTypeOfAliasSymbol_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoNestedExportEqualExportDefault_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoNestedGenericCalls_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOfGenericTypeAssertions1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOfLablledForStatementIterator_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOfStringPropertyNames1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnArgumentsInsideFunction_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnCatchVariable_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnCircularTypes_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnClassMergedWithFunction_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnClosingJsx_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnElementAccessInWriteLocation1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnElementAccessInWriteLocation2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnElementAccessInWriteLocation3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnElementAccessInWriteLocation4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnElementAccessInWriteLocation5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnErrorTypes1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnExpandoLikePropertyWithSetterDeclarationJs1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnExpandoLikePropertyWithSetterDeclarationJs2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnFunctionPropertyReturnedFromGenericFunction1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnFunctionPropertyReturnedFromGenericFunction2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnFunctionPropertyReturnedFromGenericFunction3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnGenericClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnGenericWithConstraints1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnInternalAliases_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnJsxIntrinsicDeclaredUsingCatchCallIndexSignature_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnJsxIntrinsicDeclaredUsingTemplateLiteralTypeSignatures_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnJsxNamespacedNameWithDoc1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnJsxNamespacedName_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnMergedInterfaces_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnMethodOfImportEquals_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnNarrowedTypeInModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnNarrowedType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnNewKeyword01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnObjectLiteralWithAccessors_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnObjectLiteralWithOnlyGetter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnObjectLiteralWithOnlySetter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnParameterProperties_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnPropDeclaredUsingIndexSignatureOnInterfaceWithBase_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnPropertyAccessInWriteLocation1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnPropertyAccessInWriteLocation2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnPropertyAccessInWriteLocation3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnPropertyAccessInWriteLocation4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnPropertyAccessInWriteLocation5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnThis2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnThis3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnThis4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnThis5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnThis_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnUnResolvedBaseConstructorSignature_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnUndefined_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnUnionPropertiesWithIdenticalJSDocComments01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnValueSymbolWithoutExportWithSameNameExportSymbol_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoOnVarInArrowExpression_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoParameter_skipThisParameter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoPrivateIdentifierInTypeReferenceNoCrash1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoPropertyTag_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoRecursiveObjectLiteral_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoSalsaMethodsOnAssignedFunctionExpressions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoSatisfiesTag_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoShowsGenericSpecialization_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoSignatureOptionalParameterFromUnion1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoSignatureRestParameterFromUnion1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoSignatureRestParameterFromUnion2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoSignatureRestParameterFromUnion3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoSignatureRestParameterFromUnion4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoSignatureWithTrailingComma_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoSpecialPropertyAssignment_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoStaticPrototypePropertyOnClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoTemplateTag_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoTypeAliasDefinedInDifferentFile_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoTypeArgumentInferenceWithMethodWithoutBody_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoTypeError_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoTypeOfThisInStatics_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoTypeOnlyNamespaceAndClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoTypedGenericPrototypeMember_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoTypedefTag_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoUnionOfNamespaces_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoUnion_discriminated_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoUniqueSymbolJsDoc_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoWidenedTypes_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfoWithNestedDestructuredParameterInLambda_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfo_errorSignatureFillsInTypeParameter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInfo_notInsideComment_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickInforForSucessiveInferencesIsNotAny_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickinfo01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickinfoExpressionTypeNotChangedViaDeletion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickinfoForNamespaceMergeWithClassConstrainedToSelf_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickinfoForUnionProperty_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/quickinfoWrongComment_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/reallyLargeFile_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/recursiveClassReference_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/recursiveGenerics2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/recursiveInternalModuleImport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/recursiveWrappedTypeParameters1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referenceInParameterPropertyDeclaration_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referenceToClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referenceToEmptyObject_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/references01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesBloomFilters2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesBloomFilters3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesBloomFilters_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForAmbients_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForClassLocal_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForClassMembersExtendingAbstractClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForClassMembersExtendingGenericClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForClassMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForClassParameter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForContextuallyTypedObjectLiteralProperties_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForContextuallyTypedUnionProperties2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForContextuallyTypedUnionProperties_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForDeclarationKeywords_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForEnums_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForExportedValues_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForExpressionKeywords_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForExternalModuleNames_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForFunctionOverloads_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForFunctionParameter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForGlobals2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForGlobals3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForGlobals4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForGlobals5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForGlobalsInExternalModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForGlobals_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForIllegalAssignment_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForImports_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForIndexProperty2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForIndexProperty3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForIndexProperty_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForInheritedProperties10_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForInheritedProperties2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForInheritedProperties3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForInheritedProperties4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForInheritedProperties5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForInheritedProperties6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForInheritedProperties7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForInheritedProperties8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForInheritedProperties9_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForInheritedProperties_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForLabel2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForLabel3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForLabel4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForLabel5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForLabel6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForLabel_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForMergedDeclarations2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForMergedDeclarations3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForMergedDeclarations4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForMergedDeclarations5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForMergedDeclarations6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForMergedDeclarations7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForMergedDeclarations8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForMergedDeclarations_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForModifiers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForNoContext_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForNumericLiteralPropertyNames_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForObjectLiteralProperties_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForOverrides_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForPropertiesOfGenericType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForStatementKeywords_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForStatic_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForStaticsAndMembersWithSameNames_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForStringLiteralPropertyNames2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForStringLiteralPropertyNames3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForStringLiteralPropertyNames4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForStringLiteralPropertyNames5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForStringLiteralPropertyNames6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForStringLiteralPropertyNames7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForStringLiteralPropertyNames_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForTypeKeywords_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesForUnionProperties_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesInComment_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesInConfiguredProject_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesInEmptyFileWithMultipleProjects_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesInEmptyFile_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesInStringLiteralValueWithMultipleProjects_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesIsAvailableThroughGlobalNoCrash_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesToNonPropertyNameStringLiteral_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/referencesToStringLiteralValue_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/regexDetection_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/regexErrorRecovery_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/regexp_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/remoteGetReferences_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/rename01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameAcrossMultipleProjects_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameAlias2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameAlias3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameAliasExternalModule2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameAliasExternalModule3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameAliasExternalModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameAlias_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameBindingElementInitializerExternal_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameBindingElementInitializerProperty_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameCommentsAndStrings1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameCommentsAndStrings2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameCommentsAndStrings3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameCommentsAndStrings4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameContextuallyTypedProperties2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameContextuallyTypedProperties_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameCrossJsTs01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameDeclarationKeywords_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameDefaultImportDifferentName_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameDefaultLibDontWork_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameDestructuringAssignmentNestedInArrayLiteral_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameDestructuringAssignmentNestedInForOf2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameDestructuringAssignment_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameDestructuringClassProperty_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameDestructuringDeclarationInForOf_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameDestructuringDeclarationInFor_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameDestructuringFunctionParameter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameDestructuringNestedBindingElement_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameExportCrash_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameExportSpecifier2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameExportSpecifier_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameForAliasingExport01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameForAliasingExport02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameForDefaultExport04_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameForDefaultExport05_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameForDefaultExport06_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameForDefaultExport07_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameForDefaultExport08_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameForDefaultExport09_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameForStringLiteral_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameFromNodeModulesDep1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameFromNodeModulesDep2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameFromNodeModulesDep3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameFromNodeModulesDep4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameFunctionParameter1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameFunctionParameter2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameImportAndExportInDiffFiles_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameImportAndExport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameImportAndShorthand_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameImportNamespaceAndShorthand_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameImportOfExportEquals_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameImportRequire_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameImportSpecifierPropertyName_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameInConfiguredProject_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameInfoForFunctionExpression01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameInheritedProperties1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameInheritedProperties2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameInheritedProperties3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameInheritedProperties4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameInheritedProperties5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameInheritedProperties6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameInheritedProperties7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameInheritedProperties8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameJSDocNamepath_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameJsDocImportTag_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameJsDocTypeLiteral_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameJsExports01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameJsExports02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameJsExports03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameJsOverloadedFunctionParameter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameJsPropertyAssignment2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameJsPropertyAssignment3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameJsPropertyAssignment4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameJsPropertyAssignment_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameJsPrototypeProperty01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameJsPrototypeProperty02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameJsSpecialAssignmentRhs1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameJsSpecialAssignmentRhs2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameJsThisProperty01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameJsThisProperty03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameJsThisProperty05_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameJsThisProperty06_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameLabel1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameLabel2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameLabel3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameLabel4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameLabel5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameLabel6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameLocationsForClassExpression01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameLocationsForFunctionExpression01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameLocationsForFunctionExpression02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameModifiers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameModuleExportsProperties1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameModuleExportsProperties2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameModuleExportsProperties3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameNameOnEnumMember_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameNamedImport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameNamespaceImport_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameNamespace_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameNoDefaultLib_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameNumericalIndexSingleQuoted_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameNumericalIndex_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameObjectBindingElementPropertyName01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameObjectSpreadAssignment_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameObjectSpread_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameParameterPropertyDeclaration1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameParameterPropertyDeclaration2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameParameterPropertyDeclaration3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameParameterPropertyDeclaration4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameParameterPropertyDeclaration5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renamePrivateAccessor_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renamePrivateFields1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renamePrivateFields_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renamePrivateMethod_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renamePropertyAccessExpressionHeritageClause_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameReExportDefault_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameReferenceFromLinkTag1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameReferenceFromLinkTag2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameReferenceFromLinkTag3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameReferenceFromLinkTag4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameReferenceFromLinkTag5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameRestBindingElement_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameRest_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameStringLiteralOk1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameStringLiteralOk_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameStringLiteralTypes1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameStringLiteralTypes2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameStringLiteralTypes3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameStringLiteralTypes4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameStringLiteralTypes5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameStringPropertyNames2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameStringPropertyNames_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameTemplateLiteralsComputedProperties_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameTemplateLiteralsDefinePropertyJs_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameThis_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameUMDModuleAlias1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/renameUMDModuleAlias2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/restArgType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/restParamsContextuallyTyped_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/returnRecursiveType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/returnTypeOfGenericFunction1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/reverseMappedTypeQuickInfo_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/satisfiesOperatorCompletion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/scopeOfUnionProperties_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/selfReferencedExternalModule2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/selfReferencedExternalModule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/signatureHelpAfterParameter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/signatureHelpCommentsClassMembers_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/signatureHelpCommentsClass_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/signatureHelpCommentsCommentParsing_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/signatureHelpCommentsFunctionDeclaration_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/signatureHelpCommentsFunctionExpression_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/signatureHelpConstructorCallParamProperties_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/signatureHelpExpandedRestTuplesLocalLabels1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/signatureHelpInferenceJsDocImportTag_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/signatureHelpIteratorNext_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/signatureHelpJSDocCallbackTag_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/signatureHelpJSDocTags_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/signatureHelpJSMissingPropertyAccess_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/signatureHelpRestArgs1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/signatureHelpRestArgs2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/signatureHelpRestArgs3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/signatureHelpSkippedArgs1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/signatureHelpTypeArguments2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/signatureHelpWithUnknown_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/signatureHelp_unionType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/specialIntersectionsOrderIndependent_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/stringCompletionsFromGenericConditionalTypesUsingTemplateLiteralTypes_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/stringCompletionsImportOrExportSpecifier_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/stringCompletionsVsEscaping_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/stringLiteralCompletionsForGenericConditionalTypesUsingTemplateLiteralTypes_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/stringLiteralCompletionsForOpenEndedTemplateLiteralType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/stringLiteralCompletionsForStringEnumContextualType_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/stringLiteralCompletionsForTypeIndexedAccess_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/stringLiteralCompletionsInArgUsingInferenceResultFromPreviousArg_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/stringLiteralCompletionsInJsxAttributeInitializer_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/stringLiteralCompletionsInPositionTypedUsingRest_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/stringLiteralTypeCompletionsInTypeArgForNonGeneric1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/stringPropertyNames1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/stringPropertyNames2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/superCallError0_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/switchCompletions_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/symbolCompletionLowerPriority_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/symbolNameAtUnparseableFunctionOverload_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/syntaxErrorAfterImport1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/syntheticImportFromBabelGeneratedFile1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/syntheticImportFromBabelGeneratedFile2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/thisBindingInLambda_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/thisPredicateFunctionCompletions02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/thisPredicateFunctionCompletions03_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/thisPredicateFunctionQuickInfo01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/thisPredicateFunctionQuickInfo02_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/thisPredicateFunctionQuickInfo_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/trailingCommaSignatureHelp_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tripleSlashRefPathCompletionAbsolutePaths_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tripleSlashRefPathCompletionContext_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tripleSlashRefPathCompletionExtensionsAllowJSFalse_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tripleSlashRefPathCompletionExtensionsAllowJSTrue_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tripleSlashRefPathCompletionHiddenFile_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tripleSlashRefPathCompletionRootdirs_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tslibFindAllReferencesOnRuntimeImportWithPaths1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletion10_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletion11_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletion13_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletion14_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletion15_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletion1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletion2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletion3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletion4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletion5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletion6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletion7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletion8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletionInFunctionExpressionOfChildrenCallback1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletionInFunctionExpressionOfChildrenCallback_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletionNonTagLessThan_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletionOnClosingTag1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletionOnClosingTag2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletionOnClosingTagWithoutJSX1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletionOnClosingTagWithoutJSX2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxCompletionsGenericComponent_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxFindAllReferences10_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxFindAllReferences11_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxFindAllReferences1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxFindAllReferences2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxFindAllReferences3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxFindAllReferences4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxFindAllReferences5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxFindAllReferences6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxFindAllReferences7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxFindAllReferences8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxFindAllReferences9_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxFindAllReferencesUnionElementType1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxFindAllReferencesUnionElementType2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxGoToDefinitionClasses_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxGoToDefinitionIntrinsics_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxGoToDefinitionStatelessFunction1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxGoToDefinitionStatelessFunction2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxGoToDefinitionUnionElementType1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxGoToDefinitionUnionElementType2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxIncrementalServer_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxIncremental_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxParsing_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxQuickInfo1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxQuickInfo2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxQuickInfo3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxQuickInfo4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxQuickInfo5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxQuickInfo6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxQuickInfo7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxRename1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxRename2_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxRename3_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxRename5_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxRename6_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxRename7_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxRename8_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/tsxRename9_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/typeAboveNumberLiteralExpressionStatement_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/typeArgCompletion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/typeCheckAfterAddingGenericParameter_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/typeCheckObjectInArrayLiteral_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/typeKeywordInFunction_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/typeOfAFundule_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/typeOfKeywordCompletion_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/typeOperatorNodeBuilding_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/typeReferenceOnServer_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/unclosedCommentsInConstructor_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/unclosedStringLiteralErrorRecovery_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/underscoreTypings01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/updateSourceFile_jsdocSignature_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/updateToClassStatics_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/gen/verifySingleFileEmitOutput1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/hoverAliasInImportedFile_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/manual/completionListInClosedFunction05_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/manual/completionsAtIncompleteObjectLiteralProperty_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/manual/completionsSelfDeclaring1_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/manual/completionsWithDeprecatedTag4_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/manual/renameDefaultKeyword_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/manual/renameForDefaultExport01_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/manual/tsxCompletion12_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/quickInfoCatch_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/signatureHelpCrash_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/signatureHelpTokenCrash_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/stringCompletionDetails_test.go create mode 100644 kitcom/internal/tsgo/fourslash/tests/util/util.go create mode 100644 kitcom/internal/tsgo/glob/glob.go create mode 100644 kitcom/internal/tsgo/jsnum/jsnum.go create mode 100644 kitcom/internal/tsgo/jsnum/jsnum_test.go create mode 100644 kitcom/internal/tsgo/jsnum/pseudobigint.go create mode 100644 kitcom/internal/tsgo/jsnum/pseudobigint_test.go create mode 100644 kitcom/internal/tsgo/jsnum/ryu_test.go create mode 100644 kitcom/internal/tsgo/jsnum/string.go create mode 100644 kitcom/internal/tsgo/jsnum/string_test.go create mode 100644 kitcom/internal/tsgo/jsonutil/jsonutil.go create mode 100644 kitcom/internal/tsgo/ls/api.go create mode 100644 kitcom/internal/tsgo/ls/autoImports_stringer_generated.go create mode 100644 kitcom/internal/tsgo/ls/autoimportfixes.go create mode 100644 kitcom/internal/tsgo/ls/autoimports.go create mode 100644 kitcom/internal/tsgo/ls/autoimportsexportinfo.go create mode 100644 kitcom/internal/tsgo/ls/autoimportstypes.go create mode 100644 kitcom/internal/tsgo/ls/changetracker.go create mode 100644 kitcom/internal/tsgo/ls/changetrackerimpl.go create mode 100644 kitcom/internal/tsgo/ls/completions.go create mode 100644 kitcom/internal/tsgo/ls/constants.go create mode 100644 kitcom/internal/tsgo/ls/converters.go create mode 100644 kitcom/internal/tsgo/ls/converters_test.go create mode 100644 kitcom/internal/tsgo/ls/definition.go create mode 100644 kitcom/internal/tsgo/ls/diagnostics.go create mode 100644 kitcom/internal/tsgo/ls/documenthighlights.go create mode 100644 kitcom/internal/tsgo/ls/findallreferences.go create mode 100644 kitcom/internal/tsgo/ls/format.go create mode 100644 kitcom/internal/tsgo/ls/host.go create mode 100644 kitcom/internal/tsgo/ls/hover.go create mode 100644 kitcom/internal/tsgo/ls/importTracker.go create mode 100644 kitcom/internal/tsgo/ls/languageservice.go create mode 100644 kitcom/internal/tsgo/ls/linemap.go create mode 100644 kitcom/internal/tsgo/ls/organizeimports.go create mode 100644 kitcom/internal/tsgo/ls/signaturehelp.go create mode 100644 kitcom/internal/tsgo/ls/source_map.go create mode 100644 kitcom/internal/tsgo/ls/string_completions.go create mode 100644 kitcom/internal/tsgo/ls/symbol_display.go create mode 100644 kitcom/internal/tsgo/ls/symbols.go create mode 100644 kitcom/internal/tsgo/ls/userpreferences.go create mode 100644 kitcom/internal/tsgo/ls/utilities.go create mode 100644 kitcom/internal/tsgo/lsp/lsproto/_generate/.gitignore create mode 100644 kitcom/internal/tsgo/lsp/lsproto/_generate/fetchModel.mts create mode 100644 kitcom/internal/tsgo/lsp/lsproto/_generate/generate.mts create mode 100644 kitcom/internal/tsgo/lsp/lsproto/_generate/metaModelSchema.mts create mode 100644 kitcom/internal/tsgo/lsp/lsproto/_generate/tsconfig.json create mode 100644 kitcom/internal/tsgo/lsp/lsproto/baseproto.go create mode 100644 kitcom/internal/tsgo/lsp/lsproto/baseproto_test.go create mode 100644 kitcom/internal/tsgo/lsp/lsproto/jsonrpc.go create mode 100644 kitcom/internal/tsgo/lsp/lsproto/lsp.go create mode 100644 kitcom/internal/tsgo/lsp/lsproto/lsp_generated.go create mode 100644 kitcom/internal/tsgo/lsp/lsproto/lsp_test.go create mode 100644 kitcom/internal/tsgo/lsp/server.go create mode 100644 kitcom/internal/tsgo/lsutil/asi.go create mode 100644 kitcom/internal/tsgo/lsutil/children.go create mode 100644 kitcom/internal/tsgo/module/cache.go create mode 100644 kitcom/internal/tsgo/module/resolver.go create mode 100644 kitcom/internal/tsgo/module/resolver_test.go create mode 100644 kitcom/internal/tsgo/module/types.go create mode 100644 kitcom/internal/tsgo/module/util.go create mode 100644 kitcom/internal/tsgo/modulespecifiers/compare.go create mode 100644 kitcom/internal/tsgo/modulespecifiers/preferences.go create mode 100644 kitcom/internal/tsgo/modulespecifiers/specifiers.go create mode 100644 kitcom/internal/tsgo/modulespecifiers/types.go create mode 100644 kitcom/internal/tsgo/modulespecifiers/util.go create mode 100644 kitcom/internal/tsgo/nodebuilder/types.go create mode 100644 kitcom/internal/tsgo/outputpaths/commonsourcedirectory.go create mode 100644 kitcom/internal/tsgo/outputpaths/outputpaths.go create mode 100644 kitcom/internal/tsgo/packagejson/cache.go create mode 100644 kitcom/internal/tsgo/packagejson/expected.go create mode 100644 kitcom/internal/tsgo/packagejson/expected_test.go create mode 100644 kitcom/internal/tsgo/packagejson/exportsorimports.go create mode 100644 kitcom/internal/tsgo/packagejson/exportsorimports_test.go create mode 100644 kitcom/internal/tsgo/packagejson/jsonvalue.go create mode 100644 kitcom/internal/tsgo/packagejson/jsonvalue_test.go create mode 100644 kitcom/internal/tsgo/packagejson/packagejson.go create mode 100644 kitcom/internal/tsgo/packagejson/packagejson_test.go create mode 100644 kitcom/internal/tsgo/packagejson/validated.go create mode 100644 kitcom/internal/tsgo/parser/jsdoc.go create mode 100644 kitcom/internal/tsgo/parser/parser.go create mode 100644 kitcom/internal/tsgo/parser/parser_test.go create mode 100644 kitcom/internal/tsgo/parser/references.go create mode 100644 kitcom/internal/tsgo/parser/reparser.go create mode 100644 kitcom/internal/tsgo/parser/testdata/fuzz/FuzzParser/02b74efe61495c2a create mode 100644 kitcom/internal/tsgo/parser/testdata/fuzz/FuzzParser/9ce2d994c65c7bfe create mode 100644 kitcom/internal/tsgo/parser/types.go create mode 100644 kitcom/internal/tsgo/parser/utilities.go create mode 100644 kitcom/internal/tsgo/pprof/pprof.go create mode 100644 kitcom/internal/tsgo/printer/changetrackerwriter.go create mode 100644 kitcom/internal/tsgo/printer/emitcontext.go create mode 100644 kitcom/internal/tsgo/printer/emitflags.go create mode 100644 kitcom/internal/tsgo/printer/emithost.go create mode 100644 kitcom/internal/tsgo/printer/emitresolver.go create mode 100644 kitcom/internal/tsgo/printer/emittextwriter.go create mode 100644 kitcom/internal/tsgo/printer/factory.go create mode 100644 kitcom/internal/tsgo/printer/generatedidentifierflags.go create mode 100644 kitcom/internal/tsgo/printer/helpers.go create mode 100644 kitcom/internal/tsgo/printer/namegenerator.go create mode 100644 kitcom/internal/tsgo/printer/namegenerator_test.go create mode 100644 kitcom/internal/tsgo/printer/printer.go create mode 100644 kitcom/internal/tsgo/printer/printer_test.go create mode 100644 kitcom/internal/tsgo/printer/singlelinestringwriter.go create mode 100644 kitcom/internal/tsgo/printer/sourcefilemetadataprovider.go create mode 100644 kitcom/internal/tsgo/printer/textwriter.go create mode 100644 kitcom/internal/tsgo/printer/utilities.go create mode 100644 kitcom/internal/tsgo/printer/utilities_test.go create mode 100644 kitcom/internal/tsgo/project/api.go create mode 100644 kitcom/internal/tsgo/project/ata/ata.go create mode 100644 kitcom/internal/tsgo/project/ata/ata_test.go create mode 100644 kitcom/internal/tsgo/project/ata/discovertypings.go create mode 100644 kitcom/internal/tsgo/project/ata/discovertypings_test.go create mode 100644 kitcom/internal/tsgo/project/ata/installnpmpackages_test.go create mode 100644 kitcom/internal/tsgo/project/ata/typesmap.go create mode 100644 kitcom/internal/tsgo/project/ata/validatepackagename.go create mode 100644 kitcom/internal/tsgo/project/ata/validatepackagename_test.go create mode 100644 kitcom/internal/tsgo/project/background/queue.go create mode 100644 kitcom/internal/tsgo/project/background/queue_test.go create mode 100644 kitcom/internal/tsgo/project/checkerpool.go create mode 100644 kitcom/internal/tsgo/project/client.go create mode 100644 kitcom/internal/tsgo/project/compilerhost.go create mode 100644 kitcom/internal/tsgo/project/configfilechanges_test.go create mode 100644 kitcom/internal/tsgo/project/configfileregistry.go create mode 100644 kitcom/internal/tsgo/project/configfileregistrybuilder.go create mode 100644 kitcom/internal/tsgo/project/dirty/box.go create mode 100644 kitcom/internal/tsgo/project/dirty/entry.go create mode 100644 kitcom/internal/tsgo/project/dirty/interfaces.go create mode 100644 kitcom/internal/tsgo/project/dirty/map.go create mode 100644 kitcom/internal/tsgo/project/dirty/syncmap.go create mode 100644 kitcom/internal/tsgo/project/dirty/syncmap_test.go create mode 100644 kitcom/internal/tsgo/project/dirty/util.go create mode 100644 kitcom/internal/tsgo/project/extendedconfigcache.go create mode 100644 kitcom/internal/tsgo/project/filechange.go create mode 100644 kitcom/internal/tsgo/project/logging/logcollector.go create mode 100644 kitcom/internal/tsgo/project/logging/logger.go create mode 100644 kitcom/internal/tsgo/project/logging/logtree.go create mode 100644 kitcom/internal/tsgo/project/logging/logtree_test.go create mode 100644 kitcom/internal/tsgo/project/overlayfs.go create mode 100644 kitcom/internal/tsgo/project/overlayfs_test.go create mode 100644 kitcom/internal/tsgo/project/parsecache.go create mode 100644 kitcom/internal/tsgo/project/programcounter.go create mode 100644 kitcom/internal/tsgo/project/project.go create mode 100644 kitcom/internal/tsgo/project/project_stringer_generated.go create mode 100644 kitcom/internal/tsgo/project/project_test.go create mode 100644 kitcom/internal/tsgo/project/projectcollection.go create mode 100644 kitcom/internal/tsgo/project/projectcollectionbuilder.go create mode 100644 kitcom/internal/tsgo/project/projectcollectionbuilder_test.go create mode 100644 kitcom/internal/tsgo/project/projectlifetime_test.go create mode 100644 kitcom/internal/tsgo/project/projectreferencesprogram_test.go create mode 100644 kitcom/internal/tsgo/project/refcounting_test.go create mode 100644 kitcom/internal/tsgo/project/session.go create mode 100644 kitcom/internal/tsgo/project/session_test.go create mode 100644 kitcom/internal/tsgo/project/snapshot.go create mode 100644 kitcom/internal/tsgo/project/snapshot_test.go create mode 100644 kitcom/internal/tsgo/project/snapshotfs.go create mode 100644 kitcom/internal/tsgo/project/untitled_test.go create mode 100644 kitcom/internal/tsgo/project/util.go create mode 100644 kitcom/internal/tsgo/project/watch.go create mode 100644 kitcom/internal/tsgo/project/watch_test.go create mode 100644 kitcom/internal/tsgo/repo/paths.go create mode 100644 kitcom/internal/tsgo/scanner/scanner.go create mode 100644 kitcom/internal/tsgo/scanner/utilities.go create mode 100644 kitcom/internal/tsgo/semver/version.go create mode 100644 kitcom/internal/tsgo/semver/version_range.go create mode 100644 kitcom/internal/tsgo/semver/version_range_test.go create mode 100644 kitcom/internal/tsgo/semver/version_test.go create mode 100644 kitcom/internal/tsgo/sourcemap/decoder.go create mode 100644 kitcom/internal/tsgo/sourcemap/generator.go create mode 100644 kitcom/internal/tsgo/sourcemap/generator_test.go create mode 100644 kitcom/internal/tsgo/sourcemap/lineinfo.go create mode 100644 kitcom/internal/tsgo/sourcemap/source.go create mode 100644 kitcom/internal/tsgo/sourcemap/source_mapper.go create mode 100644 kitcom/internal/tsgo/sourcemap/util.go create mode 100644 kitcom/internal/tsgo/stringutil/compare.go create mode 100644 kitcom/internal/tsgo/stringutil/format.go create mode 100644 kitcom/internal/tsgo/stringutil/util.go create mode 100644 kitcom/internal/tsgo/testrunner/compiler_runner.go create mode 100644 kitcom/internal/tsgo/testrunner/compiler_runner_test.go create mode 100644 kitcom/internal/tsgo/testrunner/runner.go create mode 100644 kitcom/internal/tsgo/testrunner/test_case_parser.go create mode 100644 kitcom/internal/tsgo/testrunner/test_case_parser_test.go create mode 100644 kitcom/internal/tsgo/testutil/baseline/baseline.go create mode 100644 kitcom/internal/tsgo/testutil/emittestutil/emittestutil.go create mode 100644 kitcom/internal/tsgo/testutil/filefixture/filefixture.go create mode 100644 kitcom/internal/tsgo/testutil/fixtures/benchfixtures.go create mode 100644 kitcom/internal/tsgo/testutil/harnessutil/harnessutil.go create mode 100644 kitcom/internal/tsgo/testutil/harnessutil/recorderfs.go create mode 100644 kitcom/internal/tsgo/testutil/harnessutil/sourcemap_recorder.go create mode 100644 kitcom/internal/tsgo/testutil/jstest/node.go create mode 100644 kitcom/internal/tsgo/testutil/parsetestutil/parsetestutil.go create mode 100644 kitcom/internal/tsgo/testutil/projecttestutil/clientmock_generated.go create mode 100644 kitcom/internal/tsgo/testutil/projecttestutil/npmexecutormock_generated.go create mode 100644 kitcom/internal/tsgo/testutil/projecttestutil/projecttestutil.go create mode 100644 kitcom/internal/tsgo/testutil/race/norace.go create mode 100644 kitcom/internal/tsgo/testutil/race/race.go create mode 100644 kitcom/internal/tsgo/testutil/stringtestutil/stringtestutil.go create mode 100644 kitcom/internal/tsgo/testutil/testutil.go create mode 100644 kitcom/internal/tsgo/testutil/tsbaseline/error_baseline.go create mode 100644 kitcom/internal/tsgo/testutil/tsbaseline/js_emit_baseline.go create mode 100644 kitcom/internal/tsgo/testutil/tsbaseline/module_resolution_baseline.go create mode 100644 kitcom/internal/tsgo/testutil/tsbaseline/sourcemap_baseline.go create mode 100644 kitcom/internal/tsgo/testutil/tsbaseline/sourcemap_record_baseline.go create mode 100644 kitcom/internal/tsgo/testutil/tsbaseline/type_symbol_baseline.go create mode 100644 kitcom/internal/tsgo/testutil/tsbaseline/util.go create mode 100644 kitcom/internal/tsgo/transformers/chain.go create mode 100644 kitcom/internal/tsgo/transformers/declarations/diagnostics.go create mode 100644 kitcom/internal/tsgo/transformers/declarations/tracker.go create mode 100644 kitcom/internal/tsgo/transformers/declarations/transform.go create mode 100644 kitcom/internal/tsgo/transformers/declarations/util.go create mode 100644 kitcom/internal/tsgo/transformers/estransforms/async.go create mode 100644 kitcom/internal/tsgo/transformers/estransforms/classfields.go create mode 100644 kitcom/internal/tsgo/transformers/estransforms/classstatic.go create mode 100644 kitcom/internal/tsgo/transformers/estransforms/classthis.go create mode 100644 kitcom/internal/tsgo/transformers/estransforms/definitions.go create mode 100644 kitcom/internal/tsgo/transformers/estransforms/esdecorator.go create mode 100644 kitcom/internal/tsgo/transformers/estransforms/exponentiation.go create mode 100644 kitcom/internal/tsgo/transformers/estransforms/forawait.go create mode 100644 kitcom/internal/tsgo/transformers/estransforms/logicalassignment.go create mode 100644 kitcom/internal/tsgo/transformers/estransforms/namedevaluation.go create mode 100644 kitcom/internal/tsgo/transformers/estransforms/nullishcoalescing.go create mode 100644 kitcom/internal/tsgo/transformers/estransforms/objectrestspread.go create mode 100644 kitcom/internal/tsgo/transformers/estransforms/optionalcatch.go create mode 100644 kitcom/internal/tsgo/transformers/estransforms/optionalchain.go create mode 100644 kitcom/internal/tsgo/transformers/estransforms/using.go create mode 100644 kitcom/internal/tsgo/transformers/estransforms/utilities.go create mode 100644 kitcom/internal/tsgo/transformers/inliners/constenum.go create mode 100644 kitcom/internal/tsgo/transformers/jsxtransforms/jsx.go create mode 100644 kitcom/internal/tsgo/transformers/jsxtransforms/utilities.go create mode 100644 kitcom/internal/tsgo/transformers/modifiervisitor.go create mode 100644 kitcom/internal/tsgo/transformers/moduletransforms/commonjsmodule.go create mode 100644 kitcom/internal/tsgo/transformers/moduletransforms/commonjsmodule_test.go create mode 100644 kitcom/internal/tsgo/transformers/moduletransforms/esmodule.go create mode 100644 kitcom/internal/tsgo/transformers/moduletransforms/esmodule_test.go create mode 100644 kitcom/internal/tsgo/transformers/moduletransforms/externalmoduleinfo.go create mode 100644 kitcom/internal/tsgo/transformers/moduletransforms/impliedmodule.go create mode 100644 kitcom/internal/tsgo/transformers/moduletransforms/utilities.go create mode 100644 kitcom/internal/tsgo/transformers/transformer.go create mode 100644 kitcom/internal/tsgo/transformers/tstransforms/importelision.go create mode 100644 kitcom/internal/tsgo/transformers/tstransforms/importelision_test.go create mode 100644 kitcom/internal/tsgo/transformers/tstransforms/runtimesyntax.go create mode 100644 kitcom/internal/tsgo/transformers/tstransforms/runtimesyntax_test.go create mode 100644 kitcom/internal/tsgo/transformers/tstransforms/typeeraser.go create mode 100644 kitcom/internal/tsgo/transformers/tstransforms/typeeraser_test.go create mode 100644 kitcom/internal/tsgo/transformers/tstransforms/utilities.go create mode 100644 kitcom/internal/tsgo/transformers/utilities.go create mode 100644 kitcom/internal/tsgo/tsoptions/commandlineoption.go create mode 100644 kitcom/internal/tsgo/tsoptions/commandlineparser.go create mode 100644 kitcom/internal/tsgo/tsoptions/commandlineparser_test.go create mode 100644 kitcom/internal/tsgo/tsoptions/decls_test.go create mode 100644 kitcom/internal/tsgo/tsoptions/declsbuild.go create mode 100644 kitcom/internal/tsgo/tsoptions/declscompiler.go create mode 100644 kitcom/internal/tsgo/tsoptions/declstypeacquisition.go create mode 100644 kitcom/internal/tsgo/tsoptions/declswatch.go create mode 100644 kitcom/internal/tsgo/tsoptions/diagnostics.go create mode 100644 kitcom/internal/tsgo/tsoptions/enummaps.go create mode 100644 kitcom/internal/tsgo/tsoptions/errors.go create mode 100644 kitcom/internal/tsgo/tsoptions/export_test.go create mode 100644 kitcom/internal/tsgo/tsoptions/namemap.go create mode 100644 kitcom/internal/tsgo/tsoptions/parsedbuildcommandline.go create mode 100644 kitcom/internal/tsgo/tsoptions/parsedcommandline.go create mode 100644 kitcom/internal/tsgo/tsoptions/parsedcommandline_test.go create mode 100644 kitcom/internal/tsgo/tsoptions/parsinghelpers.go create mode 100644 kitcom/internal/tsgo/tsoptions/parsinghelpers_test.go create mode 100644 kitcom/internal/tsgo/tsoptions/tsconfigparsing.go create mode 100644 kitcom/internal/tsgo/tsoptions/tsconfigparsing_test.go create mode 100644 kitcom/internal/tsgo/tsoptions/tsoptionstest/parsedcommandline.go create mode 100644 kitcom/internal/tsgo/tsoptions/tsoptionstest/vfsparseconfighost.go create mode 100644 kitcom/internal/tsgo/tsoptions/wildcarddirectories.go create mode 100644 kitcom/internal/tsgo/tspath/extension.go create mode 100644 kitcom/internal/tsgo/tspath/ignoredpaths.go create mode 100644 kitcom/internal/tsgo/tspath/path.go create mode 100644 kitcom/internal/tsgo/tspath/path_test.go create mode 100644 kitcom/internal/tsgo/tspath/untitled_test.go create mode 100644 kitcom/internal/tsgo/vfs/cachedvfs/cachedvfs.go create mode 100644 kitcom/internal/tsgo/vfs/cachedvfs/cachedvfs_test.go create mode 100644 kitcom/internal/tsgo/vfs/internal/internal.go create mode 100644 kitcom/internal/tsgo/vfs/iovfs/iofs.go create mode 100644 kitcom/internal/tsgo/vfs/iovfs/iofs_test.go create mode 100644 kitcom/internal/tsgo/vfs/osvfs/os.go create mode 100644 kitcom/internal/tsgo/vfs/osvfs/os_test.go create mode 100644 kitcom/internal/tsgo/vfs/osvfs/realpath_other.go create mode 100644 kitcom/internal/tsgo/vfs/osvfs/realpath_test.go create mode 100644 kitcom/internal/tsgo/vfs/osvfs/realpath_windows.go create mode 100644 kitcom/internal/tsgo/vfs/utilities.go create mode 100644 kitcom/internal/tsgo/vfs/vfs.go create mode 100644 kitcom/internal/tsgo/vfs/vfs_test.go create mode 100644 kitcom/internal/tsgo/vfs/vfsmock/mock_generated.go create mode 100644 kitcom/internal/tsgo/vfs/vfsmock/wrapper.go create mode 100644 kitcom/internal/tsgo/vfs/vfsmock/wrapper_test.go create mode 100644 kitcom/internal/tsgo/vfs/vfstest/vfstest.go create mode 100644 kitcom/internal/tsgo/vfs/vfstest/vfstest_test.go diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3719f09 --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ +default: + @echo "Please read Makefile for available targets" + +# Very bad. But i had no choice! its internal! +vendor_tsgo: + @mkdir -p ./kitcom/internal/tsgo + @git clone --depth 1 https://github.com/microsoft/typescript-go + @echo Renaming packages... + @find ./typescript-go/internal -type file -name "*.go" -exec sed -i -e 's!"github.com/microsoft/typescript-go/internal!"efprojects.com/kitten-ipc/kitcom/internal/tsgo!g' {} \; + @cp -r ./typescript-go/internal/* ./kitcom/internal/tsgo + @git add ./kitcom/internal/ + @echo Cleaning up... + @rm -rf @rm -rf typescript-go + echo Successfully copied tsgo code and renamed packages. + +.PHONY: vendor_tsgo diff --git a/go.work.sum b/go.work.sum index b25a0dd..9a565fc 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1,14 +1,26 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/matryer/moq v0.6.0 h1:FCccG09c3o4cg3gnrZ+7ty5Pa/sjmN24BMHp/0pwhjQ= +github.com/matryer/moq v0.6.0/go.mod h1:iEVhY/XBwFG/nbRyEf0oV+SqnTHZJ5wectzx7yT+y98= +github.com/peter-evans/patience v0.3.0 h1:rX0JdJeepqdQl1Sk9c9uvorjYYzL2TfgLX1adqYm9cA= +github.com/peter-evans/patience v0.3.0/go.mod h1:Kmxu5sY1NmBLFSStvXjX1wS9mIv7wMcP/ubucyMOAu0= github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= +github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= +golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ= +golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc= golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA= golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w= golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4= golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210= -golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= -golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= -golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= -golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/telemetry v0.0.0-20251008203120-078029d740a8 h1:LvzTn0GQhWuvKH/kVRS3R3bVAsdQWI7hvfLHGgh9+lU= golang.org/x/telemetry v0.0.0-20251008203120-078029d740a8/go.mod h1:Pi4ztBfryZoJEkyFTI5/Ocsu2jXyDr6iSdgJiYE/uwE= +golang.org/x/term v0.35.0 h1:bZBVKBudEyhRcajGcNc3jIfWPqV4y/Kt2XcoigOWtDQ= +golang.org/x/term v0.35.0/go.mod h1:TPGtkTLesOwf2DE8CgVYiZinHAOuy5AYUYT1lENIZnA= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= +mvdan.cc/gofumpt v0.9.1 h1:p5YT2NfFWsYyTieYgwcQ8aKV3xRvFH4uuN/zB2gBbMQ= +mvdan.cc/gofumpt v0.9.1/go.mod h1:3xYtNemnKiXaTh6R4VtlqDATFwBbdXI8lJvH/4qk7mw= diff --git a/kitcom/go.mod b/kitcom/go.mod index e3d6964..a7a7eb7 100644 --- a/kitcom/go.mod +++ b/kitcom/go.mod @@ -2,4 +2,9 @@ module efprojects.com/kitten-ipc/kitcom go 1.25.1 -require golang.org/x/tools v0.38.0 // indirect +require ( + github.com/go-json-experiment/json v0.0.0-20250910080747-cc2cfa0554c3 // indirect + golang.org/x/sync v0.17.0 // indirect + golang.org/x/sys v0.37.0 // indirect + golang.org/x/text v0.29.0 // indirect +) diff --git a/kitcom/go.sum b/kitcom/go.sum index 85d99f4..79bacf7 100644 --- a/kitcom/go.sum +++ b/kitcom/go.sum @@ -1,2 +1,16 @@ -golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ= -golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs= +github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZQ= +github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/go-json-experiment/json v0.0.0-20250910080747-cc2cfa0554c3 h1:02WINGfSX5w0Mn+F28UyRoSt9uvMhKguwWMlOAh6U/0= +github.com/go-json-experiment/json v0.0.0-20250910080747-cc2cfa0554c3/go.mod h1:uNVvRXArCGbZ508SxYYTC5v1JWoz2voff5pm25jU1Ok= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/microsoft/typescript-go v0.0.0-20251013215234-fd15f297d473 h1:LdsGx1nLOzsu2a1QORtbhZLaAlrQTbMKq3MlpuU3cCQ= +github.com/microsoft/typescript-go v0.0.0-20251013215234-fd15f297d473/go.mod h1:/yWoZzcFKn2eQjB4E+kfEhQ/iGVrFKYswH1ZW+jWZu8= +golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= +golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= +golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= +golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= +gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q= +gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA= diff --git a/kitcom/internal/tsgo/api/api.go b/kitcom/internal/tsgo/api/api.go new file mode 100644 index 0000000..49e7d3d --- /dev/null +++ b/kitcom/internal/tsgo/api/api.go @@ -0,0 +1,320 @@ +package api + +import ( + "context" + "errors" + "fmt" + "sync" + + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/api/encoder" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/ast" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/astnav" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/checker" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/core" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/ls" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/project" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/project/logging" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/tsoptions" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/tspath" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/vfs" + "github.com/go-json-experiment/json" +) + +type handleMap[T any] map[Handle[T]]*T + +type APIInit struct { + Logger logging.Logger + FS vfs.FS + SessionOptions *project.SessionOptions +} + +type API struct { + logger logging.Logger + session *project.Session + + projects map[Handle[project.Project]]tspath.Path + filesMu sync.Mutex + files handleMap[ast.SourceFile] + symbolsMu sync.Mutex + symbols handleMap[ast.Symbol] + typesMu sync.Mutex + types handleMap[checker.Type] +} + +func NewAPI(init *APIInit) *API { + api := &API{ + session: project.NewSession(&project.SessionInit{ + Logger: init.Logger, + FS: init.FS, + Options: init.SessionOptions, + }), + projects: make(map[Handle[project.Project]]tspath.Path), + files: make(handleMap[ast.SourceFile]), + symbols: make(handleMap[ast.Symbol]), + types: make(handleMap[checker.Type]), + } + + return api +} + +func (api *API) HandleRequest(ctx context.Context, method string, payload []byte) ([]byte, error) { + params, err := unmarshalPayload(method, payload) + if err != nil { + return nil, err + } + + switch Method(method) { + case MethodRelease: + if id, ok := params.(*string); ok { + return nil, api.releaseHandle(*id) + } else { + return nil, fmt.Errorf("expected string for release handle, got %T", params) + } + case MethodGetSourceFile: + params := params.(*GetSourceFileParams) + sourceFile, err := api.GetSourceFile(params.Project, params.FileName) + if err != nil { + return nil, err + } + return encoder.EncodeSourceFile(sourceFile, string(FileHandle(sourceFile))) + case MethodParseConfigFile: + return encodeJSON(api.ParseConfigFile(params.(*ParseConfigFileParams).FileName)) + case MethodLoadProject: + return encodeJSON(api.LoadProject(ctx, params.(*LoadProjectParams).ConfigFileName)) + case MethodGetSymbolAtPosition: + params := params.(*GetSymbolAtPositionParams) + return encodeJSON(api.GetSymbolAtPosition(ctx, params.Project, params.FileName, int(params.Position))) + case MethodGetSymbolsAtPositions: + params := params.(*GetSymbolsAtPositionsParams) + return encodeJSON(core.TryMap(params.Positions, func(position uint32) (any, error) { + return api.GetSymbolAtPosition(ctx, params.Project, params.FileName, int(position)) + })) + case MethodGetSymbolAtLocation: + params := params.(*GetSymbolAtLocationParams) + return encodeJSON(api.GetSymbolAtLocation(ctx, params.Project, params.Location)) + case MethodGetSymbolsAtLocations: + params := params.(*GetSymbolsAtLocationsParams) + return encodeJSON(core.TryMap(params.Locations, func(location Handle[ast.Node]) (any, error) { + return api.GetSymbolAtLocation(ctx, params.Project, location) + })) + case MethodGetTypeOfSymbol: + params := params.(*GetTypeOfSymbolParams) + return encodeJSON(api.GetTypeOfSymbol(ctx, params.Project, params.Symbol)) + case MethodGetTypesOfSymbols: + params := params.(*GetTypesOfSymbolsParams) + return encodeJSON(core.TryMap(params.Symbols, func(symbol Handle[ast.Symbol]) (any, error) { + return api.GetTypeOfSymbol(ctx, params.Project, symbol) + })) + default: + return nil, fmt.Errorf("unhandled API method %q", method) + } +} + +func (api *API) Close() { + api.session.Close() +} + +func (api *API) ParseConfigFile(configFileName string) (*ConfigFileResponse, error) { + configFileName = api.toAbsoluteFileName(configFileName) + configFileContent, ok := api.session.FS().ReadFile(configFileName) + if !ok { + return nil, fmt.Errorf("could not read file %q", configFileName) + } + configDir := tspath.GetDirectoryPath(configFileName) + tsConfigSourceFile := tsoptions.NewTsconfigSourceFileFromFilePath(configFileName, api.toPath(configFileName), configFileContent) + parsedCommandLine := tsoptions.ParseJsonSourceFileConfigFileContent( + tsConfigSourceFile, + api.session, + configDir, + nil, /*existingOptions*/ + configFileName, + nil, /*resolutionStack*/ + nil, /*extraFileExtensions*/ + nil, /*extendedConfigCache*/ + ) + return &ConfigFileResponse{ + FileNames: parsedCommandLine.FileNames(), + Options: parsedCommandLine.CompilerOptions(), + }, nil +} + +func (api *API) LoadProject(ctx context.Context, configFileName string) (*ProjectResponse, error) { + project, err := api.session.OpenProject(ctx, api.toAbsoluteFileName(configFileName)) + if err != nil { + return nil, err + } + data := NewProjectResponse(project) + api.projects[data.Id] = project.ConfigFilePath() + return data, nil +} + +func (api *API) GetSymbolAtPosition(ctx context.Context, projectId Handle[project.Project], fileName string, position int) (*SymbolResponse, error) { + projectPath, ok := api.projects[projectId] + if !ok { + return nil, errors.New("project ID not found") + } + snapshot, release := api.session.Snapshot() + defer release() + project := snapshot.ProjectCollection.GetProjectByPath(projectPath) + if project == nil { + return nil, errors.New("project not found") + } + + languageService := ls.NewLanguageService(project.GetProgram(), snapshot) + symbol, err := languageService.GetSymbolAtPosition(ctx, fileName, position) + if err != nil || symbol == nil { + return nil, err + } + data := NewSymbolResponse(symbol) + api.symbolsMu.Lock() + defer api.symbolsMu.Unlock() + api.symbols[data.Id] = symbol + return data, nil +} + +func (api *API) GetSymbolAtLocation(ctx context.Context, projectId Handle[project.Project], location Handle[ast.Node]) (*SymbolResponse, error) { + projectPath, ok := api.projects[projectId] + if !ok { + return nil, errors.New("project ID not found") + } + snapshot, release := api.session.Snapshot() + defer release() + project := snapshot.ProjectCollection.GetProjectByPath(projectPath) + if project == nil { + return nil, errors.New("project not found") + } + + fileHandle, pos, kind, err := parseNodeHandle(location) + if err != nil { + return nil, err + } + api.filesMu.Lock() + defer api.filesMu.Unlock() + sourceFile, ok := api.files[fileHandle] + if !ok { + return nil, fmt.Errorf("file %q not found", fileHandle) + } + token := astnav.GetTokenAtPosition(sourceFile, pos) + if token == nil { + return nil, fmt.Errorf("token not found at position %d in file %q", pos, sourceFile.FileName()) + } + node := ast.FindAncestorKind(token, kind) + if node == nil { + return nil, fmt.Errorf("node of kind %s not found at position %d in file %q", kind.String(), pos, sourceFile.FileName()) + } + languageService := ls.NewLanguageService(project.GetProgram(), snapshot) + symbol := languageService.GetSymbolAtLocation(ctx, node) + if symbol == nil { + return nil, nil + } + data := NewSymbolResponse(symbol) + api.symbolsMu.Lock() + defer api.symbolsMu.Unlock() + api.symbols[data.Id] = symbol + return data, nil +} + +func (api *API) GetTypeOfSymbol(ctx context.Context, projectId Handle[project.Project], symbolHandle Handle[ast.Symbol]) (*TypeResponse, error) { + projectPath, ok := api.projects[projectId] + if !ok { + return nil, errors.New("project ID not found") + } + snapshot, release := api.session.Snapshot() + defer release() + project := snapshot.ProjectCollection.GetProjectByPath(projectPath) + if project == nil { + return nil, errors.New("project not found") + } + + api.symbolsMu.Lock() + defer api.symbolsMu.Unlock() + symbol, ok := api.symbols[symbolHandle] + if !ok { + return nil, fmt.Errorf("symbol %q not found", symbolHandle) + } + languageService := ls.NewLanguageService(project.GetProgram(), snapshot) + t := languageService.GetTypeOfSymbol(ctx, symbol) + if t == nil { + return nil, nil + } + return NewTypeData(t), nil +} + +func (api *API) GetSourceFile(projectId Handle[project.Project], fileName string) (*ast.SourceFile, error) { + projectPath, ok := api.projects[projectId] + if !ok { + return nil, errors.New("project ID not found") + } + snapshot, release := api.session.Snapshot() + defer release() + project := snapshot.ProjectCollection.GetProjectByPath(projectPath) + if project == nil { + return nil, errors.New("project not found") + } + + sourceFile := project.GetProgram().GetSourceFile(fileName) + if sourceFile == nil { + return nil, fmt.Errorf("source file %q not found", fileName) + } + api.filesMu.Lock() + defer api.filesMu.Unlock() + api.files[FileHandle(sourceFile)] = sourceFile + return sourceFile, nil +} + +func (api *API) releaseHandle(handle string) error { + switch handle[0] { + case handlePrefixProject: + projectId := Handle[project.Project](handle) + _, ok := api.projects[projectId] + if !ok { + return fmt.Errorf("project %q not found", handle) + } + delete(api.projects, projectId) + case handlePrefixFile: + fileId := Handle[ast.SourceFile](handle) + api.filesMu.Lock() + defer api.filesMu.Unlock() + _, ok := api.files[fileId] + if !ok { + return fmt.Errorf("file %q not found", handle) + } + delete(api.files, fileId) + case handlePrefixSymbol: + symbolId := Handle[ast.Symbol](handle) + api.symbolsMu.Lock() + defer api.symbolsMu.Unlock() + _, ok := api.symbols[symbolId] + if !ok { + return fmt.Errorf("symbol %q not found", handle) + } + delete(api.symbols, symbolId) + case handlePrefixType: + typeId := Handle[checker.Type](handle) + api.typesMu.Lock() + defer api.typesMu.Unlock() + _, ok := api.types[typeId] + if !ok { + return fmt.Errorf("type %q not found", handle) + } + delete(api.types, typeId) + default: + return fmt.Errorf("unhandled handle type %q", handle[0]) + } + return nil +} + +func (api *API) toAbsoluteFileName(fileName string) string { + return tspath.GetNormalizedAbsolutePath(fileName, api.session.GetCurrentDirectory()) +} + +func (api *API) toPath(fileName string) tspath.Path { + return tspath.ToPath(fileName, api.session.GetCurrentDirectory(), api.session.FS().UseCaseSensitiveFileNames()) +} + +func encodeJSON(v any, err error) ([]byte, error) { + if err != nil { + return nil, err + } + return json.Marshal(v) +} diff --git a/kitcom/internal/tsgo/api/encoder/encoder.go b/kitcom/internal/tsgo/api/encoder/encoder.go new file mode 100644 index 0000000..b3867a8 --- /dev/null +++ b/kitcom/internal/tsgo/api/encoder/encoder.go @@ -0,0 +1,815 @@ +package encoder + +import ( + "encoding/binary" + "fmt" + "slices" + + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/ast" +) + +const ( + NodeOffsetKind = iota * 4 + NodeOffsetPos + NodeOffsetEnd + NodeOffsetNext + NodeOffsetParent + NodeOffsetData + // NodeSize is the number of bytes that represents a single node in the encoded format. + NodeSize +) + +const ( + NodeDataTypeChildren uint32 = iota << 30 + NodeDataTypeString + NodeDataTypeExtendedData +) + +const ( + NodeDataTypeMask uint32 = 0xc0_00_00_00 + NodeDataChildMask uint32 = 0x00_00_00_ff + NodeDataStringIndexMask uint32 = 0x00_ff_ff_ff +) + +const ( + SyntaxKindNodeList uint32 = 1<<32 - 1 +) + +const ( + HeaderOffsetMetadata = iota * 4 + HeaderOffsetStringOffsets + HeaderOffsetStringData + HeaderOffsetExtendedData + HeaderOffsetNodes + HeaderSize +) + +const ( + ProtocolVersion uint8 = 1 +) + +// Source File Binary Format +// ========================= +// +// The following defines a protocol for serializing TypeScript SourceFile objects to a compact binary format. All integer +// values are little-endian. +// +// Overview +// -------- +// +// The format comprises six sections: +// +// | Section | Length | Description | +// | ------------------ | ------------------ | ---------------------------------------------------------------------------------------- | +// | Header | 20 bytes | Contains byte offsets to the start of each section. | +// | String offsets | 8 bytes per string | Pairs of starting byte offsets and ending byte offsets into the **string data** section. | +// | String data | variable | UTF-8 encoded string data. | +// | Extended node data | variable | Extra data for some kinds of nodes. | +// | Nodes | 24 bytes per node | Defines the AST structure of the file, with references to strings and extended data. | +// +// Header (20 bytes) +// ----------------- +// +// The header contains the following fields: +// +// | Byte offset | Type | Field | +// | ----------- | ------ | ----------------------------------------- | +// | 0 | uint8 | Protocol version | +// | 1-4 | | Reserved | +// | 4-8 | uint32 | Byte offset to string offsets section | +// | 8-12 | uint32 | Byte offset to string data section | +// | 12-16 | uint32 | Byte offset to extended node data section | +// | 16-20 | uint32 | Byte offset to nodes section | +// +// String offsets (8 bytes per string) +// ----------------------------------- +// +// Each string offset entry consists of two 4-byte unsigned integers, representing the start and end byte offsets into the +// **string data** section. +// +// String data (variable) +// ---------------------- +// +// The string data section contains UTF-8 encoded string data. In typical cases, the entirety of the string data is the +// source file text, and individual nodes with string properties reference their positional slice of the file text. In +// cases where a node's string property is not equal to the slice of file text at its position, the unique string is +// appended to the string data section after the file text. +// +// Extended node data (variable) +// ----------------------------- +// +// The extended node data section contains additional data for specific node types. The length and meaning of each entry +// is defined by the node type. +// +// Currently, the only node types that use this section are `TemplateHead`, `TemplateMiddle`, `TemplateTail`, and +// `SourceFile`. The extended data format for the first three is: +// +// | Byte offset | Type | Field | +// | ----------- | ------ | ------------------------------------------------ | +// | 0-4 | uint32 | Index of `text` in the string offsets section | +// | 4-8 | uint32 | Index of `rawText` in the string offsets section | +// | 8-12 | uint32 | Value of `templateFlags` | +// +// and for `SourceFile` is: +// +// | Byte offset | Type | Field | +// | ----------- | ------ | ------------------------------------------------- | +// | 0-4 | uint32 | Index of `text` in the string offsets section | +// | 4-8 | uint32 | Index of `fileName` in the string offsets section | +// | 8-12 | uint32 | Index of `id` in the string offsets section | +// +// Nodes (24 bytes per node) +// ------------------------- +// +// The nodes section contains the AST structure of the file. Nodes are represented in a flat array in source order, +// heavily inspired by https://marvinh.dev/blog/speeding-up-javascript-ecosystem-part-11/. Each node has the following +// structure: +// +// | Byte offset | Type | Field | +// | ----------- | ------ | -------------------------- | +// | 0-4 | uint32 | Kind | +// | 4-8 | uint32 | Pos | +// | 8-12 | uint32 | End | +// | 12-16 | uint32 | Node index of next sibling | +// | 16-20 | uint32 | Node index of parent | +// | 20-24 | | Node data | +// +// The first 24 bytes of the nodes section are zeros representing a nil node, such that nodes without a parent or next +// sibling can unambiuously use `0` for those indices. +// +// NodeLists are represented as normal nodes with the special `kind` value `0xff_ff_ff_ff`. They are considered the parent +// of their contents in the encoded format. A client reconstructing an AST similar to TypeScript's internal representation +// should instead set the `parent` pointers of a NodeList's children to the NodeList's parent. A NodeList's `data` field +// is the uint32 length of the list, and does not use one of the data types described below. +// +// For node types other than NodeList, the node data field encodes one of the following, determined by the first 2 bits of +// the field: +// +// | Value | Data type | Description | +// | ----- | --------- | ------------------------------------------------------------------------------------ | +// | 0b00 | Children | Disambiguates which named properties of the node its children should be assigned to. | +// | 0b01 | String | The index of the node's string property in the **string offsets** section. | +// | 0b10 | Extended | The byte offset of the node's extended data into the **extended node data** section. | +// | 0b11 | Reserved | Reserved for future use. | +// +// In all node data types, the remaining 6 bits of the first byte are used to encode booleans specific to the node type: +// +// | Node type | Bits 2-5 | Bit 1 | Bit 0 | +// | ------------------------- | -------- | ------------- | ------------------------------- | +// | `ImportSpecifier` | | | `isTypeOnly` | +// | `ImportClause` | | | `isTypeOnly` | +// | `ExportSpecifier` | | | `isTypeOnly` | +// | `ImportEqualsDeclaration` | | | `isTypeOnly` | +// | `ExportDeclaration` | | | `isTypeOnly` | +// | `ImportTypeNode` | | | `isTypeOf` | +// | `ExportAssignment` | | | `isExportEquals` | +// | `Block` | | | `multiline` | +// | `ArrayLiteralExpression` | | | `multiline` | +// | `ObjectLiteralExpression` | | | `multiline` | +// | `JsxText` | | | `containsOnlyTriviaWhiteSpaces` | +// | `JSDocTypeLiteral` | | | `isArrayType` | +// | `JsDocPropertyTag` | | `isNameFirst` | `isBracketed` | +// | `JsDocParameterTag` | | `isNameFirst` | `isBracketed` | +// | `VariableDeclarationList` | | is `const` | is `let` | +// | `ImportAttributes` | | is `assert` | `multiline` | +// +// The remaining 3 bytes of the node data field vary by data type: +// +// ### Children (0b00) +// +// If a node has fewer children than its type allows, additional data is needed to determine which properties the children +// correspond to. The last byte of the 4-byte data field is a bitmask representing the child properties of the node type, +// in visitor order, where `1` indicates that the child at that property is present and `0` indicates that the property is +// nil. For example, a `MethodDeclaration` has the following child properties: +// +// | Property name | Bit position | +// | -------------- | ------------ | +// | modifiers | 0 | +// | asteriskToken | 1 | +// | name | 2 | +// | postfixToken | 3 | +// | typeParameters | 4 | +// | parameters | 5 | +// | returnType | 6 | +// | body | 7 | +// +// A bitmask with value `0b01100101` would indicate that the next four direct descendants (i.e., node records that have a +// `parent` set to the node index of the `MethodDeclaration`) of the node are its `modifiers`, `name`, `parameters`, and +// `body` properties, in that order. The remaining properties are nil. (To reconstruct the node with named properties, the +// client must consult a static table of each node type's child property names.) +// +// The bitmask may be zero for node types that can only have a single child, since no disambiguation is needed. +// Additionally, the children data type may be used for nodes that can never have children, but do not require other +// data types. +// +// ### String (0b01) +// +// The string data type is used for nodes with a single string property. (Currently, the name of that property is always +// `text`.) The last three bytes of the 4-byte data field form a single 24-bit unsigned integer (i.e., +// `uint32(0x00_ff_ff_ff & node.data)`) _N_ that is an index into the **string offsets** section. The *N*th 32-bit +// unsigned integer in the **string offsets** section is the byte offset of the start of the string in the **string data** +// section, and the *N+1*th 32-bit unsigned integer is the byte offset of the end of the string in the +// **string data** section. +// +// ### Extended (0b10) +// +// The extended data type is used for nodes with properties that don't fit into either the children or string data types. +// The last three bytes of the 4-byte data field form a single 24-bit unsigned integer (i.e., +// `uint32(0x00_ff_ff_ff & node.data)`) _N_ that is a byte offset into the **extended node data** section. The length and +// meaning of the data at that offset is defined by the node type. See the **Extended node data** section for details on +// the format of the extended data for specific node types. + +func EncodeSourceFile(sourceFile *ast.SourceFile, id string) ([]byte, error) { + var parentIndex, nodeCount, prevIndex uint32 + var extendedData []byte + strs := newStringTable(sourceFile.Text(), sourceFile.TextCount) + nodes := make([]byte, 0, (sourceFile.NodeCount+1)*NodeSize) + + visitor := &ast.NodeVisitor{ + Hooks: ast.NodeVisitorHooks{ + VisitNodes: func(nodeList *ast.NodeList, visitor *ast.NodeVisitor) *ast.NodeList { + if nodeList == nil || len(nodeList.Nodes) == 0 { + return nodeList + } + + nodeCount++ + if prevIndex != 0 { + // this is the next sibling of `prevNode` + b0, b1, b2, b3 := uint8(nodeCount), uint8(nodeCount>>8), uint8(nodeCount>>16), uint8(nodeCount>>24) + nodes[prevIndex*NodeSize+NodeOffsetNext+0] = b0 + nodes[prevIndex*NodeSize+NodeOffsetNext+1] = b1 + nodes[prevIndex*NodeSize+NodeOffsetNext+2] = b2 + nodes[prevIndex*NodeSize+NodeOffsetNext+3] = b3 + } + + nodes = appendUint32s(nodes, SyntaxKindNodeList, uint32(nodeList.Pos()), uint32(nodeList.End()), 0, parentIndex, uint32(len(nodeList.Nodes))) + + saveParentIndex := parentIndex + + currentIndex := nodeCount + prevIndex = 0 + parentIndex = currentIndex + visitor.VisitSlice(nodeList.Nodes) + prevIndex = currentIndex + parentIndex = saveParentIndex + + return nodeList + }, + VisitModifiers: func(modifiers *ast.ModifierList, visitor *ast.NodeVisitor) *ast.ModifierList { + if modifiers != nil && len(modifiers.Nodes) > 0 { + visitor.Hooks.VisitNodes(&modifiers.NodeList, visitor) + } + return modifiers + }, + }, + } + visitor.Visit = func(node *ast.Node) *ast.Node { + nodeCount++ + if prevIndex != 0 { + // this is the next sibling of `prevNode` + b0, b1, b2, b3 := uint8(nodeCount), uint8(nodeCount>>8), uint8(nodeCount>>16), uint8(nodeCount>>24) + nodes[prevIndex*NodeSize+NodeOffsetNext+0] = b0 + nodes[prevIndex*NodeSize+NodeOffsetNext+1] = b1 + nodes[prevIndex*NodeSize+NodeOffsetNext+2] = b2 + nodes[prevIndex*NodeSize+NodeOffsetNext+3] = b3 + } + + nodes = appendUint32s(nodes, uint32(node.Kind), uint32(node.Pos()), uint32(node.End()), 0, parentIndex, getNodeData(node, strs, &extendedData)) + + saveParentIndex := parentIndex + + currentIndex := nodeCount + prevIndex = 0 + parentIndex = currentIndex + visitor.VisitEachChild(node) + prevIndex = currentIndex + parentIndex = saveParentIndex + return node + } + + nodes = appendUint32s(nodes, 0, 0, 0, 0, 0, 0) + + nodeCount++ + parentIndex++ + nodes = appendUint32s(nodes, uint32(sourceFile.Kind), uint32(sourceFile.Pos()), uint32(sourceFile.End()), 0, 0, getSourceFileData(sourceFile, id, strs, &extendedData)) + + visitor.VisitEachChild(sourceFile.AsNode()) + + metadata := uint32(ProtocolVersion) << 24 + offsetStringTableOffsets := HeaderSize + offsetStringTableData := HeaderSize + len(strs.offsets)*4 + offsetExtendedData := offsetStringTableData + strs.stringLength() + offsetNodes := offsetExtendedData + len(extendedData) + + header := []uint32{ + metadata, + uint32(offsetStringTableOffsets), + uint32(offsetStringTableData), + uint32(offsetExtendedData), + uint32(offsetNodes), + } + + var headerBytes, strsBytes []byte + headerBytes = appendUint32s(nil, header...) + strsBytes = strs.encode() + + return slices.Concat( + headerBytes, + strsBytes, + extendedData, + nodes, + ), nil +} + +func appendUint32s(buf []byte, values ...uint32) []byte { + for _, value := range values { + var err error + if buf, err = binary.Append(buf, binary.LittleEndian, value); err != nil { + // The only error binary.Append can return is for values that are not fixed-size. + // This can never happen here, since we are always appending uint32. + panic(fmt.Sprintf("failed to append uint32: %v", err)) + } + } + return buf +} + +func getSourceFileData(sourceFile *ast.SourceFile, id string, strs *stringTable, extendedData *[]byte) uint32 { + t := NodeDataTypeExtendedData + extendedDataOffset := len(*extendedData) + textIndex := strs.add(sourceFile.Text(), sourceFile.Kind, sourceFile.Pos(), sourceFile.End()) + fileNameIndex := strs.add(sourceFile.FileName(), 0, 0, 0) + idIndex := strs.add(id, 0, 0, 0) + *extendedData = appendUint32s(*extendedData, textIndex, fileNameIndex, idIndex) + return t | uint32(extendedDataOffset) +} + +func getNodeData(node *ast.Node, strs *stringTable, extendedData *[]byte) uint32 { + t := getNodeDataType(node) + switch t { + case NodeDataTypeChildren: + return t | getNodeDefinedData(node) | uint32(getChildrenPropertyMask(node)) + case NodeDataTypeString: + return t | getNodeDefinedData(node) | recordNodeStrings(node, strs) + case NodeDataTypeExtendedData: + return t | getNodeDefinedData(node) | recordExtendedData(node, strs, extendedData) + default: + panic("unreachable") + } +} + +func getNodeDataType(node *ast.Node) uint32 { + switch node.Kind { + case ast.KindJsxText, + ast.KindIdentifier, + ast.KindPrivateIdentifier, + ast.KindStringLiteral, + ast.KindNumericLiteral, + ast.KindBigIntLiteral, + ast.KindRegularExpressionLiteral, + ast.KindNoSubstitutionTemplateLiteral, + ast.KindJSDocText: + return NodeDataTypeString + case ast.KindTemplateHead, + ast.KindTemplateMiddle, + ast.KindTemplateTail, + ast.KindSourceFile: + return NodeDataTypeExtendedData + default: + return NodeDataTypeChildren + } +} + +// getChildrenPropertyMask returns a mask of which children properties are present in the node. +// It is defined for node kinds that have more than one property that is a pointer to a child node. +// Example: QualifiedName has two children properties: Left and Right, which are visited in that order. +// result&1 is non-zero if Left is present, and result&2 is non-zero if Right is present. If the client +// knows that QualifiedName has properties ["Left", "Right"] and sees an encoded node with only one +// child, it can use the mask to determine which property is present. +func getChildrenPropertyMask(node *ast.Node) uint8 { + switch node.Kind { + case ast.KindQualifiedName: + n := node.AsQualifiedName() + return (boolToByte(n.Left != nil) << 0) | (boolToByte(n.Right != nil) << 1) + case ast.KindTypeParameter: + n := node.AsTypeParameter() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Name() != nil) << 1) | (boolToByte(n.Constraint != nil) << 2) | (boolToByte(n.DefaultType != nil) << 3) + case ast.KindIfStatement: + n := node.AsIfStatement() + return (boolToByte(n.Expression != nil) << 0) | (boolToByte(n.ThenStatement != nil) << 1) | (boolToByte(n.ElseStatement != nil) << 2) + case ast.KindDoStatement: + n := node.AsDoStatement() + return (boolToByte(n.Statement != nil) << 0) | (boolToByte(n.Expression != nil) << 1) + case ast.KindWhileStatement: + n := node.AsWhileStatement() + return (boolToByte(n.Expression != nil) << 0) | (boolToByte(n.Statement != nil) << 1) + case ast.KindForStatement: + n := node.AsForStatement() + return (boolToByte(n.Initializer != nil) << 0) | (boolToByte(n.Condition != nil) << 1) | (boolToByte(n.Incrementor != nil) << 2) | (boolToByte(n.Statement != nil) << 3) + case ast.KindForInStatement, ast.KindForOfStatement: + n := node.AsForInOrOfStatement() + return (boolToByte(n.AwaitModifier != nil) << 0) | (boolToByte(n.Initializer != nil) << 1) | (boolToByte(n.Expression != nil) << 2) | (boolToByte(n.Statement != nil) << 3) + case ast.KindWithStatement: + n := node.AsWithStatement() + return (boolToByte(n.Expression != nil) << 0) | (boolToByte(n.Statement != nil) << 1) + case ast.KindSwitchStatement: + n := node.AsSwitchStatement() + return (boolToByte(n.Expression != nil) << 0) | (boolToByte(n.CaseBlock != nil) << 1) + case ast.KindCaseClause, ast.KindDefaultClause: + n := node.AsCaseOrDefaultClause() + return (boolToByte(n.Expression != nil) << 0) | (boolToByte(n.Statements != nil) << 1) + case ast.KindTryStatement: + n := node.AsTryStatement() + return (boolToByte(n.TryBlock != nil) << 0) | (boolToByte(n.CatchClause != nil) << 1) | (boolToByte(n.FinallyBlock != nil) << 2) + case ast.KindCatchClause: + n := node.AsCatchClause() + return (boolToByte(n.VariableDeclaration != nil) << 0) | (boolToByte(n.Block != nil) << 1) + case ast.KindLabeledStatement: + n := node.AsLabeledStatement() + return (boolToByte(n.Label != nil) << 0) | (boolToByte(n.Statement != nil) << 1) + case ast.KindVariableStatement: + n := node.AsVariableStatement() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.DeclarationList != nil) << 1) + case ast.KindVariableDeclaration: + n := node.AsVariableDeclaration() + return (boolToByte(n.Name() != nil) << 0) | (boolToByte(n.ExclamationToken != nil) << 1) | (boolToByte(n.Type != nil) << 2) | (boolToByte(n.Initializer != nil) << 3) + case ast.KindParameter: + n := node.AsParameterDeclaration() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.DotDotDotToken != nil) << 1) | (boolToByte(n.Name() != nil) << 2) | (boolToByte(n.QuestionToken != nil) << 3) | (boolToByte(n.Type != nil) << 4) | (boolToByte(n.Initializer != nil) << 5) + case ast.KindBindingElement: + n := node.AsBindingElement() + return (boolToByte(n.DotDotDotToken != nil) << 0) | (boolToByte(n.PropertyName != nil) << 1) | (boolToByte(n.Name() != nil) << 2) | (boolToByte(n.Initializer != nil) << 3) + case ast.KindFunctionDeclaration: + n := node.AsFunctionDeclaration() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.AsteriskToken != nil) << 1) | (boolToByte(n.Name() != nil) << 2) | (boolToByte(n.TypeParameters != nil) << 3) | (boolToByte(n.Parameters != nil) << 4) | (boolToByte(n.Type != nil) << 5) | (boolToByte(n.Body != nil) << 6) + case ast.KindInterfaceDeclaration: + n := node.AsInterfaceDeclaration() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Name() != nil) << 1) | (boolToByte(n.TypeParameters != nil) << 2) | (boolToByte(n.HeritageClauses != nil) << 3) | (boolToByte(n.Members != nil) << 4) + case ast.KindTypeAliasDeclaration: + n := node.AsTypeAliasDeclaration() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Name() != nil) << 1) | (boolToByte(n.TypeParameters != nil) << 2) | (boolToByte(n.Type != nil) << 3) + case ast.KindEnumMember: + n := node.AsEnumMember() + return (boolToByte(n.Name() != nil) << 0) | (boolToByte(n.Initializer != nil) << 1) + case ast.KindEnumDeclaration: + n := node.AsEnumDeclaration() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Name() != nil) << 1) | (boolToByte(n.Members != nil) << 2) + case ast.KindModuleDeclaration: + n := node.AsModuleDeclaration() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Name() != nil) << 1) | (boolToByte(n.Body != nil) << 2) + case ast.KindImportEqualsDeclaration: + n := node.AsImportEqualsDeclaration() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Name() != nil) << 1) | (boolToByte(n.ModuleReference != nil) << 2) + case ast.KindImportDeclaration, ast.KindJSImportDeclaration: + n := node.AsImportDeclaration() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.ImportClause != nil) << 1) | (boolToByte(n.ModuleSpecifier != nil) << 2) | (boolToByte(n.Attributes != nil) << 3) + case ast.KindImportSpecifier: + n := node.AsImportSpecifier() + return (boolToByte(n.PropertyName != nil) << 0) | (boolToByte(n.Name() != nil) << 1) + case ast.KindImportClause: + n := node.AsImportClause() + return (boolToByte(n.Name() != nil) << 0) | (boolToByte(n.NamedBindings != nil) << 1) + case ast.KindExportAssignment, ast.KindJSExportAssignment: + n := node.AsExportAssignment() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Expression != nil) << 1) + case ast.KindNamespaceExportDeclaration: + n := node.AsNamespaceExportDeclaration() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Name() != nil) << 1) + case ast.KindExportDeclaration: + n := node.AsExportDeclaration() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.ExportClause != nil) << 1) | (boolToByte(n.ModuleSpecifier != nil) << 2) | (boolToByte(n.Attributes != nil) << 3) + case ast.KindExportSpecifier: + n := node.AsExportSpecifier() + return (boolToByte(n.PropertyName != nil) << 0) | (boolToByte(n.Name() != nil) << 1) + case ast.KindCallSignature: + n := node.AsCallSignatureDeclaration() + return (boolToByte(n.TypeParameters != nil) << 0) | (boolToByte(n.Parameters != nil) << 1) | (boolToByte(n.Type != nil) << 2) + case ast.KindConstructSignature: + n := node.AsConstructSignatureDeclaration() + return (boolToByte(n.TypeParameters != nil) << 0) | (boolToByte(n.Parameters != nil) << 1) | (boolToByte(n.Type != nil) << 2) + case ast.KindConstructor: + n := node.AsConstructorDeclaration() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.TypeParameters != nil) << 1) | (boolToByte(n.Parameters != nil) << 2) | (boolToByte(n.Type != nil) << 3) | (boolToByte(n.Body != nil) << 4) + case ast.KindGetAccessor: + n := node.AsGetAccessorDeclaration() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Name() != nil) << 1) | (boolToByte(n.TypeParameters != nil) << 2) | (boolToByte(n.Parameters != nil) << 3) | (boolToByte(n.Type != nil) << 4) | (boolToByte(n.Body != nil) << 5) + case ast.KindSetAccessor: + n := node.AsSetAccessorDeclaration() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Name() != nil) << 1) | (boolToByte(n.TypeParameters != nil) << 2) | (boolToByte(n.Parameters != nil) << 3) | (boolToByte(n.Type != nil) << 4) | (boolToByte(n.Body != nil) << 5) + case ast.KindIndexSignature: + n := node.AsIndexSignatureDeclaration() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Parameters != nil) << 1) | (boolToByte(n.Type != nil) << 2) + case ast.KindMethodSignature: + n := node.AsMethodSignatureDeclaration() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Name() != nil) << 1) | (boolToByte(n.PostfixToken != nil) << 2) | (boolToByte(n.TypeParameters != nil) << 3) | (boolToByte(n.Parameters != nil) << 4) | (boolToByte(n.Type != nil) << 5) + case ast.KindMethodDeclaration: + n := node.AsMethodDeclaration() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.AsteriskToken != nil) << 1) | (boolToByte(n.Name() != nil) << 2) | (boolToByte(n.PostfixToken != nil) << 3) | (boolToByte(n.TypeParameters != nil) << 4) | (boolToByte(n.Parameters != nil) << 5) | (boolToByte(n.Type != nil) << 6) | (boolToByte(n.Body != nil) << 7) + case ast.KindPropertySignature: + n := node.AsPropertySignatureDeclaration() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Name() != nil) << 1) | (boolToByte(n.PostfixToken != nil) << 2) | (boolToByte(n.Type != nil) << 3) | (boolToByte(n.Initializer != nil) << 4) + case ast.KindPropertyDeclaration: + n := node.AsPropertyDeclaration() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Name() != nil) << 1) | (boolToByte(n.PostfixToken != nil) << 2) | (boolToByte(n.Type != nil) << 3) | (boolToByte(n.Initializer != nil) << 4) + case ast.KindBinaryExpression: + n := node.AsBinaryExpression() + return (boolToByte(n.Left != nil) << 0) | (boolToByte(n.OperatorToken != nil) << 1) | (boolToByte(n.Right != nil) << 2) + case ast.KindYieldExpression: + n := node.AsYieldExpression() + return (boolToByte(n.AsteriskToken != nil) << 0) | (boolToByte(n.Expression != nil) << 1) + case ast.KindArrowFunction: + n := node.AsArrowFunction() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.TypeParameters != nil) << 1) | (boolToByte(n.Parameters != nil) << 2) | (boolToByte(n.Type != nil) << 3) | (boolToByte(n.EqualsGreaterThanToken != nil) << 4) | (boolToByte(n.Body != nil) << 5) + case ast.KindFunctionExpression: + n := node.AsFunctionExpression() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.AsteriskToken != nil) << 1) | (boolToByte(n.Name() != nil) << 2) | (boolToByte(n.TypeParameters != nil) << 3) | (boolToByte(n.Parameters != nil) << 4) | (boolToByte(n.Type != nil) << 5) | (boolToByte(n.Body != nil) << 6) + case ast.KindAsExpression: + n := node.AsAsExpression() + return (boolToByte(n.Expression != nil) << 0) | (boolToByte(n.Type != nil) << 1) + case ast.KindSatisfiesExpression: + n := node.AsSatisfiesExpression() + return (boolToByte(n.Expression != nil) << 0) | (boolToByte(n.Type != nil) << 1) + case ast.KindConditionalExpression: + n := node.AsConditionalExpression() + return (boolToByte(n.Condition != nil) << 0) | (boolToByte(n.QuestionToken != nil) << 1) | (boolToByte(n.WhenTrue != nil) << 2) | (boolToByte(n.ColonToken != nil) << 3) | (boolToByte(n.WhenFalse != nil) << 4) + case ast.KindPropertyAccessExpression: + n := node.AsPropertyAccessExpression() + return (boolToByte(n.Expression != nil) << 0) | (boolToByte(n.QuestionDotToken != nil) << 1) | (boolToByte(n.Name() != nil) << 2) + case ast.KindElementAccessExpression: + n := node.AsElementAccessExpression() + return (boolToByte(n.Expression != nil) << 0) | (boolToByte(n.QuestionDotToken != nil) << 1) | (boolToByte(n.ArgumentExpression != nil) << 2) + case ast.KindCallExpression: + n := node.AsCallExpression() + return (boolToByte(n.Expression != nil) << 0) | (boolToByte(n.QuestionDotToken != nil) << 1) | (boolToByte(n.TypeArguments != nil) << 2) | (boolToByte(n.Arguments != nil) << 3) + case ast.KindNewExpression: + n := node.AsNewExpression() + return (boolToByte(n.Expression != nil) << 0) | (boolToByte(n.TypeArguments != nil) << 1) | (boolToByte(n.Arguments != nil) << 2) + case ast.KindTemplateExpression: + n := node.AsTemplateExpression() + return (boolToByte(n.Head != nil) << 0) | (boolToByte(n.TemplateSpans != nil) << 1) + case ast.KindTemplateSpan: + n := node.AsTemplateSpan() + return (boolToByte(n.Expression != nil) << 0) | (boolToByte(n.Literal != nil) << 1) + case ast.KindTaggedTemplateExpression: + n := node.AsTaggedTemplateExpression() + return (boolToByte(n.Tag != nil) << 0) | (boolToByte(n.QuestionDotToken != nil) << 1) | (boolToByte(n.TypeArguments != nil) << 2) | (boolToByte(n.Template != nil) << 3) + case ast.KindPropertyAssignment: + n := node.AsPropertyAssignment() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Name() != nil) << 1) | (boolToByte(n.PostfixToken != nil) << 2) | (boolToByte(n.Initializer != nil) << 3) + case ast.KindShorthandPropertyAssignment: + n := node.AsShorthandPropertyAssignment() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Name() != nil) << 1) | (boolToByte(n.PostfixToken != nil) << 2) | (boolToByte(n.EqualsToken != nil) << 3) | (boolToByte(n.ObjectAssignmentInitializer != nil) << 4) + case ast.KindTypeAssertionExpression: + n := node.AsTypeAssertion() + return (boolToByte(n.Type != nil) << 0) | (boolToByte(n.Expression != nil) << 1) + case ast.KindConditionalType: + n := node.AsConditionalTypeNode() + return (boolToByte(n.CheckType != nil) << 0) | (boolToByte(n.ExtendsType != nil) << 1) | (boolToByte(n.TrueType != nil) << 2) | (boolToByte(n.FalseType != nil) << 3) + case ast.KindIndexedAccessType: + n := node.AsIndexedAccessTypeNode() + return (boolToByte(n.ObjectType != nil) << 0) | (boolToByte(n.IndexType != nil) << 1) + case ast.KindTypeReference: + n := node.AsTypeReferenceNode() + return (boolToByte(n.TypeName != nil) << 0) | (boolToByte(n.TypeArguments != nil) << 1) + case ast.KindExpressionWithTypeArguments: + n := node.AsExpressionWithTypeArguments() + return (boolToByte(n.Expression != nil) << 0) | (boolToByte(n.TypeArguments != nil) << 1) + case ast.KindTypePredicate: + n := node.AsTypePredicateNode() + return (boolToByte(n.AssertsModifier != nil) << 0) | (boolToByte(n.ParameterName != nil) << 1) | (boolToByte(n.Type != nil) << 2) + case ast.KindImportType: + n := node.AsImportTypeNode() + return (boolToByte(n.Argument != nil) << 0) | (boolToByte(n.Attributes != nil) << 1) | (boolToByte(n.Qualifier != nil) << 2) | (boolToByte(n.TypeArguments != nil) << 3) + case ast.KindImportAttribute: + n := node.AsImportAttribute() + return (boolToByte(n.Name() != nil) << 0) | (boolToByte(n.Value != nil) << 1) + case ast.KindTypeQuery: + n := node.AsTypeQueryNode() + return (boolToByte(n.ExprName != nil) << 0) | (boolToByte(n.TypeArguments != nil) << 1) + case ast.KindMappedType: + n := node.AsMappedTypeNode() + return (boolToByte(n.ReadonlyToken != nil) << 0) | (boolToByte(n.TypeParameter != nil) << 1) | (boolToByte(n.NameType != nil) << 2) | (boolToByte(n.QuestionToken != nil) << 3) | (boolToByte(n.Type != nil) << 4) | (boolToByte(n.Members != nil) << 5) + case ast.KindNamedTupleMember: + n := node.AsNamedTupleMember() + return (boolToByte(n.DotDotDotToken != nil) << 0) | (boolToByte(n.Name() != nil) << 1) | (boolToByte(n.QuestionToken != nil) << 2) | (boolToByte(n.Type != nil) << 3) + case ast.KindFunctionType: + n := node.AsFunctionTypeNode() + return (boolToByte(n.TypeParameters != nil) << 0) | (boolToByte(n.Parameters != nil) << 1) | (boolToByte(n.Type != nil) << 2) + case ast.KindConstructorType: + n := node.AsConstructorTypeNode() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.TypeParameters != nil) << 1) | (boolToByte(n.Parameters != nil) << 2) | (boolToByte(n.Type != nil) << 3) + case ast.KindTemplateLiteralType: + n := node.AsTemplateLiteralTypeNode() + return (boolToByte(n.Head != nil) << 0) | (boolToByte(n.TemplateSpans != nil) << 1) + case ast.KindTemplateLiteralTypeSpan: + n := node.AsTemplateLiteralTypeSpan() + return (boolToByte(n.Type != nil) << 0) | (boolToByte(n.Literal != nil) << 1) + case ast.KindJsxElement: + n := node.AsJsxElement() + return (boolToByte(n.OpeningElement != nil) << 0) | (boolToByte(n.Children != nil) << 1) | (boolToByte(n.ClosingElement != nil) << 2) + case ast.KindJsxNamespacedName: + n := node.AsJsxNamespacedName() + return (boolToByte(n.Name() != nil) << 0) | (boolToByte(n.Namespace != nil) << 1) + case ast.KindJsxOpeningElement: + n := node.AsJsxOpeningElement() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.TypeArguments != nil) << 1) | (boolToByte(n.Attributes != nil) << 2) + case ast.KindJsxSelfClosingElement: + n := node.AsJsxSelfClosingElement() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.TypeArguments != nil) << 1) | (boolToByte(n.Attributes != nil) << 2) + case ast.KindJsxFragment: + n := node.AsJsxFragment() + return (boolToByte(n.OpeningFragment != nil) << 0) | (boolToByte(n.Children != nil) << 1) | (boolToByte(n.ClosingFragment != nil) << 2) + case ast.KindJsxAttribute: + n := node.AsJsxAttribute() + return (boolToByte(n.Name() != nil) << 0) | (boolToByte(n.Initializer != nil) << 1) + case ast.KindJsxExpression: + n := node.AsJsxExpression() + return (boolToByte(n.DotDotDotToken != nil) << 0) | (boolToByte(n.Expression != nil) << 1) + case ast.KindJSDoc: + n := node.AsJSDoc() + return (boolToByte(n.Comment != nil) << 0) | (boolToByte(n.Tags != nil) << 1) + case ast.KindJSDocTypeTag: + n := node.AsJSDocTypeTag() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.TypeExpression != nil) << 1) | (boolToByte(n.Comment != nil) << 2) + case ast.KindJSDocTag: + n := node.AsJSDocUnknownTag() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.Comment != nil) << 1) + case ast.KindJSDocTemplateTag: + n := node.AsJSDocTemplateTag() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.Constraint != nil) << 1) | (boolToByte(n.TypeParameters != nil) << 2) | (boolToByte(n.Comment != nil) << 3) + case ast.KindJSDocReturnTag: + n := node.AsJSDocReturnTag() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.TypeExpression != nil) << 1) | (boolToByte(n.Comment != nil) << 2) + case ast.KindJSDocPublicTag: + n := node.AsJSDocPublicTag() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.Comment != nil) << 1) + case ast.KindJSDocPrivateTag: + n := node.AsJSDocPrivateTag() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.Comment != nil) << 1) + case ast.KindJSDocProtectedTag: + n := node.AsJSDocProtectedTag() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.Comment != nil) << 1) + case ast.KindJSDocReadonlyTag: + n := node.AsJSDocReadonlyTag() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.Comment != nil) << 1) + case ast.KindJSDocOverrideTag: + n := node.AsJSDocOverrideTag() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.Comment != nil) << 1) + case ast.KindJSDocDeprecatedTag: + n := node.AsJSDocDeprecatedTag() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.Comment != nil) << 1) + case ast.KindJSDocSeeTag: + n := node.AsJSDocSeeTag() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.NameExpression != nil) << 1) | (boolToByte(n.Comment != nil) << 2) + case ast.KindJSDocImplementsTag: + n := node.AsJSDocImplementsTag() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.ClassName != nil) << 1) | (boolToByte(n.Comment != nil) << 2) + case ast.KindJSDocAugmentsTag: + n := node.AsJSDocAugmentsTag() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.ClassName != nil) << 1) | (boolToByte(n.Comment != nil) << 2) + case ast.KindJSDocSatisfiesTag: + n := node.AsJSDocSatisfiesTag() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.TypeExpression != nil) << 1) | (boolToByte(n.Comment != nil) << 2) + case ast.KindJSDocThisTag: + n := node.AsJSDocThisTag() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.TypeExpression != nil) << 1) | (boolToByte(n.Comment != nil) << 2) + case ast.KindJSDocImportTag: + n := node.AsJSDocImportTag() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.ImportClause != nil) << 1) | (boolToByte(n.ModuleSpecifier != nil) << 2) | (boolToByte(n.Attributes != nil) << 3) | (boolToByte(n.Comment != nil) << 4) + case ast.KindJSDocCallbackTag: + n := node.AsJSDocCallbackTag() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.TypeExpression != nil) << 1) | (boolToByte(n.FullName != nil) << 2) | (boolToByte(n.Comment != nil) << 3) + case ast.KindJSDocOverloadTag: + n := node.AsJSDocOverloadTag() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.TypeExpression != nil) << 1) | (boolToByte(n.Comment != nil) << 2) + case ast.KindJSDocTypedefTag: + n := node.AsJSDocTypedefTag() + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.TypeExpression != nil) << 1) | (boolToByte(n.Name() != nil) << 2) | (boolToByte(n.Comment != nil) << 3) + case ast.KindJSDocSignature: + n := node.AsJSDocSignature() + return (boolToByte(n.TypeParameters != nil) << 0) | (boolToByte(n.Parameters != nil) << 1) | (boolToByte(n.Type != nil) << 2) + case ast.KindClassStaticBlockDeclaration: + n := node.AsClassStaticBlockDeclaration() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Body != nil) << 1) + case ast.KindClassDeclaration: + n := node.AsClassDeclaration() + return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Name() != nil) << 1) | (boolToByte(n.TypeParameters != nil) << 2) | (boolToByte(n.HeritageClauses != nil) << 3) | (boolToByte(n.Members != nil) << 4) + case ast.KindJSDocParameterTag, ast.KindJSDocPropertyTag: + n := node.AsJSDocParameterOrPropertyTag() + if n.IsNameFirst { + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.Name() != nil) << 1) | (boolToByte(n.TypeExpression != nil) << 2) | (boolToByte(n.Comment != nil) << 3) + } + return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.TypeExpression != nil) << 1) | (boolToByte(n.Name() != nil) << 2) | (boolToByte(n.Comment != nil) << 3) + default: + return 0 + } +} + +func getNodeDefinedData(node *ast.Node) uint32 { + switch node.Kind { + case ast.KindJSDocTypeLiteral: + n := node.AsJSDocTypeLiteral() + return uint32(boolToByte(n.IsArrayType)) << 24 + case ast.KindImportSpecifier: + n := node.AsImportSpecifier() + return uint32(boolToByte(n.IsTypeOnly)) << 24 + case ast.KindImportClause: + n := node.AsImportClause() + return uint32(boolToByte(n.PhaseModifier == ast.KindTypeKeyword))<<24 | uint32(boolToByte(n.PhaseModifier == ast.KindDeferKeyword))<<25 + case ast.KindExportSpecifier: + n := node.AsExportSpecifier() + return uint32(boolToByte(n.IsTypeOnly)) << 24 + case ast.KindImportType: + n := node.AsImportTypeNode() + return uint32(boolToByte(n.IsTypeOf)) << 24 + case ast.KindImportEqualsDeclaration: + n := node.AsImportEqualsDeclaration() + return uint32(boolToByte(n.IsTypeOnly)) << 24 + case ast.KindExportAssignment: + n := node.AsExportAssignment() + return uint32(boolToByte(n.IsExportEquals)) << 24 + case ast.KindExportDeclaration: + n := node.AsExportDeclaration() + return uint32(boolToByte(n.IsTypeOnly)) << 24 + case ast.KindBlock: + n := node.AsBlock() + return uint32(boolToByte(n.Multiline)) << 24 + case ast.KindArrayLiteralExpression: + n := node.AsArrayLiteralExpression() + return uint32(boolToByte(n.MultiLine)) << 24 + case ast.KindObjectLiteralExpression: + n := node.AsObjectLiteralExpression() + return uint32(boolToByte(n.MultiLine)) << 24 + case ast.KindJSDocParameterTag, ast.KindJSDocPropertyTag: + n := node.AsJSDocParameterOrPropertyTag() + return uint32(boolToByte(n.IsBracketed))<<24 | uint32(boolToByte(n.IsNameFirst))<<25 + case ast.KindJsxText: + n := node.AsJsxText() + return uint32(boolToByte(n.ContainsOnlyTriviaWhiteSpaces)) << 24 + case ast.KindVariableDeclarationList: + n := node.AsVariableDeclarationList() + return uint32(n.Flags & (ast.NodeFlagsLet | ast.NodeFlagsConst) << 24) + case ast.KindImportAttributes: + n := node.AsImportAttributes() + return uint32(boolToByte(n.MultiLine))<<24 | uint32(boolToByte(n.Token == ast.KindAssertKeyword))<<25 + } + return 0 +} + +func recordNodeStrings(node *ast.Node, strs *stringTable) uint32 { + switch node.Kind { + case ast.KindJsxText: + return strs.add(node.AsJsxText().Text, node.Kind, node.Pos(), node.End()) + case ast.KindIdentifier: + return strs.add(node.AsIdentifier().Text, node.Kind, node.Pos(), node.End()) + case ast.KindPrivateIdentifier: + return strs.add(node.AsPrivateIdentifier().Text, node.Kind, node.Pos(), node.End()) + case ast.KindStringLiteral: + return strs.add(node.AsStringLiteral().Text, node.Kind, node.Pos(), node.End()) + case ast.KindNumericLiteral: + return strs.add(node.AsNumericLiteral().Text, node.Kind, node.Pos(), node.End()) + case ast.KindBigIntLiteral: + return strs.add(node.AsBigIntLiteral().Text, node.Kind, node.Pos(), node.End()) + case ast.KindRegularExpressionLiteral: + return strs.add(node.AsRegularExpressionLiteral().Text, node.Kind, node.Pos(), node.End()) + case ast.KindNoSubstitutionTemplateLiteral: + return strs.add(node.AsNoSubstitutionTemplateLiteral().Text, node.Kind, node.Pos(), node.End()) + case ast.KindJSDocText: + return strs.add(node.AsJSDocText().Text(), node.Kind, node.Pos(), node.End()) + default: + panic(fmt.Sprintf("Unexpected node kind %v", node.Kind)) + } +} + +func recordExtendedData(node *ast.Node, strs *stringTable, extendedData *[]byte) uint32 { + offset := uint32(len(*extendedData)) + var text, rawText string + var templateFlags uint32 + switch node.Kind { + case ast.KindTemplateTail: + n := node.AsTemplateTail() + text = n.Text + rawText = n.RawText + templateFlags = uint32(n.TemplateFlags) + case ast.KindTemplateMiddle: + n := node.AsTemplateMiddle() + text = n.Text + rawText = n.RawText + templateFlags = uint32(n.TemplateFlags) + case ast.KindTemplateHead: + n := node.AsTemplateHead() + text = n.Text + rawText = n.RawText + templateFlags = uint32(n.TemplateFlags) + } + textIndex := strs.add(text, node.Kind, node.Pos(), node.End()) + rawTextIndex := strs.add(rawText, node.Kind, node.Pos(), node.End()) + *extendedData = appendUint32s(*extendedData, textIndex, rawTextIndex, templateFlags) + return offset +} + +func boolToByte(b bool) byte { + if b { + return 1 + } + return 0 +} diff --git a/kitcom/internal/tsgo/api/encoder/encoder_test.go b/kitcom/internal/tsgo/api/encoder/encoder_test.go new file mode 100644 index 0000000..cc215eb --- /dev/null +++ b/kitcom/internal/tsgo/api/encoder/encoder_test.go @@ -0,0 +1,94 @@ +package encoder_test + +import ( + "encoding/binary" + "fmt" + "os" + "path/filepath" + "strings" + "testing" + + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/api/encoder" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/ast" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/core" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/parser" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/repo" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil/baseline" + "gotest.tools/v3/assert" +) + +func TestEncodeSourceFile(t *testing.T) { + t.Parallel() + sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: "/test.ts", + Path: "/test.ts", + }, "import { bar } from \"bar\";\nexport function foo(a: string, b: string): any {}\nfoo();", core.ScriptKindTS) + t.Run("baseline", func(t *testing.T) { + t.Parallel() + buf, err := encoder.EncodeSourceFile(sourceFile, "") + assert.NilError(t, err) + + str := formatEncodedSourceFile(buf) + baseline.Run(t, "encodeSourceFile.txt", str, baseline.Options{ + Subfolder: "api", + }) + }) +} + +func BenchmarkEncodeSourceFile(b *testing.B) { + repo.SkipIfNoTypeScriptSubmodule(b) + filePath := filepath.Join(repo.TypeScriptSubmodulePath, "src/compiler/checker.ts") + fileContent, err := os.ReadFile(filePath) + assert.NilError(b, err) + sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: "/checker.ts", + Path: "/checker.ts", + }, string(fileContent), core.ScriptKindTS) + + for b.Loop() { + _, err := encoder.EncodeSourceFile(sourceFile, "") + assert.NilError(b, err) + } +} + +func readUint32(buf []byte, offset int) uint32 { + return binary.LittleEndian.Uint32(buf[offset : offset+4]) +} + +func formatEncodedSourceFile(encoded []byte) string { + var result strings.Builder + var getIndent func(parentIndex uint32) string + offsetNodes := readUint32(encoded, encoder.HeaderOffsetNodes) + offsetStringOffsets := readUint32(encoded, encoder.HeaderOffsetStringOffsets) + offsetStrings := readUint32(encoded, encoder.HeaderOffsetStringData) + getIndent = func(parentIndex uint32) string { + if parentIndex == 0 { + return "" + } + return " " + getIndent(readUint32(encoded, int(offsetNodes)+int(parentIndex)*encoder.NodeSize+encoder.NodeOffsetParent)) + } + j := 1 + for i := int(offsetNodes) + encoder.NodeSize; i < len(encoded); i += encoder.NodeSize { + kind := readUint32(encoded, i+encoder.NodeOffsetKind) + pos := readUint32(encoded, i+encoder.NodeOffsetPos) + end := readUint32(encoded, i+encoder.NodeOffsetEnd) + parentIndex := readUint32(encoded, i+encoder.NodeOffsetParent) + result.WriteString(getIndent(parentIndex)) + if kind == encoder.SyntaxKindNodeList { + result.WriteString("NodeList") + } else { + result.WriteString(ast.Kind(kind).String()) + } + if ast.Kind(kind) == ast.KindIdentifier || ast.Kind(kind) == ast.KindStringLiteral { + stringIndex := readUint32(encoded, i+encoder.NodeOffsetData) & encoder.NodeDataStringIndexMask + strStart := readUint32(encoded, int(offsetStringOffsets+stringIndex*4)) + strEnd := readUint32(encoded, int(offsetStringOffsets+stringIndex*4)+4) + str := string(encoded[offsetStrings+strStart : offsetStrings+strEnd]) + result.WriteString(fmt.Sprintf(" \"%s\"", str)) + } + fmt.Fprintf(&result, " [%d, %d), i=%d, next=%d", pos, end, j, encoded[i+encoder.NodeOffsetNext]) + result.WriteString("\n") + j++ + } + return result.String() +} diff --git a/kitcom/internal/tsgo/api/encoder/stringtable.go b/kitcom/internal/tsgo/api/encoder/stringtable.go new file mode 100644 index 0000000..8abf6f7 --- /dev/null +++ b/kitcom/internal/tsgo/api/encoder/stringtable.go @@ -0,0 +1,68 @@ +package encoder + +import ( + "strings" + + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/ast" +) + +type stringTable struct { + fileText string + otherStrings *strings.Builder + // offsets are pos/end pairs + offsets []uint32 +} + +func newStringTable(fileText string, stringCount int) *stringTable { + builder := &strings.Builder{} + return &stringTable{ + fileText: fileText, + otherStrings: builder, + offsets: make([]uint32, 0, stringCount*2), + } +} + +func (t *stringTable) add(text string, kind ast.Kind, pos int, end int) uint32 { + index := uint32(len(t.offsets)) + if kind == ast.KindSourceFile { + t.offsets = append(t.offsets, uint32(pos), uint32(end)) + return index + } + length := len(text) + if end-pos > 0 { + // pos includes leading trivia, but we can usually infer the actual start of the + // string from the kind and end + endOffset := 0 + if kind == ast.KindStringLiteral || kind == ast.KindTemplateTail || kind == ast.KindNoSubstitutionTemplateLiteral { + endOffset = 1 + } + end = end - endOffset + start := end - length + fileSlice := t.fileText[start:end] + if fileSlice == text { + t.offsets = append(t.offsets, uint32(start), uint32(end)) + return index + } + } + // no exact match, so we need to add it to the string table + offset := len(t.fileText) + t.otherStrings.Len() + t.otherStrings.WriteString(text) + t.offsets = append(t.offsets, uint32(offset), uint32(offset+length)) + return index +} + +func (t *stringTable) encode() []byte { + result := make([]byte, 0, t.encodedLength()) + result = appendUint32s(result, t.offsets...) + result = append(result, t.fileText...) + result = append(result, t.otherStrings.String()...) + return result +} + +func (t *stringTable) stringLength() int { + return len(t.fileText) + t.otherStrings.Len() +} + +func (t *stringTable) encodedLength() int { + return len(t.offsets)*4 + len(t.fileText) + t.otherStrings.Len() +} diff --git a/kitcom/internal/tsgo/api/proto.go b/kitcom/internal/tsgo/api/proto.go new file mode 100644 index 0000000..fcdb0e7 --- /dev/null +++ b/kitcom/internal/tsgo/api/proto.go @@ -0,0 +1,218 @@ +package api + +import ( + "errors" + "fmt" + "strconv" + "strings" + + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/ast" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/checker" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/core" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/project" + "github.com/go-json-experiment/json" + "github.com/go-json-experiment/json/jsontext" +) + +var ( + ErrInvalidRequest = errors.New("api: invalid request") + ErrClientError = errors.New("api: client error") +) + +type Method string + +type Handle[T any] string + +const ( + handlePrefixProject = 'p' + handlePrefixSymbol = 's' + handlePrefixType = 't' + handlePrefixFile = 'f' + handlePrefixNode = 'n' +) + +func ProjectHandle(p *project.Project) Handle[project.Project] { + return createHandle[project.Project](handlePrefixProject, p.Name()) +} + +func SymbolHandle(symbol *ast.Symbol) Handle[ast.Symbol] { + return createHandle[ast.Symbol](handlePrefixSymbol, ast.GetSymbolId(symbol)) +} + +func TypeHandle(t *checker.Type) Handle[checker.Type] { + return createHandle[checker.Type](handlePrefixType, t.Id()) +} + +func FileHandle(file *ast.SourceFile) Handle[ast.SourceFile] { + return createHandle[ast.SourceFile](handlePrefixFile, ast.GetNodeId(file.AsNode())) +} + +func NodeHandle(node *ast.Node) Handle[ast.Node] { + fileHandle := FileHandle(ast.GetSourceFileOfNode(node)) + return Handle[ast.Node](fmt.Sprintf("%s.%d.%d", fileHandle, node.Pos(), node.Kind)) +} + +func parseNodeHandle(handle Handle[ast.Node]) (Handle[ast.SourceFile], int, ast.Kind, error) { + parts := strings.SplitN(string(handle), ".", 3) + if len(parts) != 3 { + return "", 0, 0, fmt.Errorf("invalid node handle %q", handle) + } + + fileHandle := Handle[ast.SourceFile](parts[0]) + pos, err := strconv.ParseInt(parts[1], 10, 32) + if err != nil { + return "", 0, 0, fmt.Errorf("invalid node handle %q: %w", handle, err) + } + kind, err := strconv.ParseInt(parts[2], 10, 16) + if err != nil { + return "", 0, 0, fmt.Errorf("invalid node handle %q: %w", handle, err) + } + return fileHandle, int(pos), ast.Kind(kind), nil +} + +func createHandle[T any](prefix rune, id any) Handle[T] { + return Handle[T](fmt.Sprintf("%c%016x", prefix, id)) +} + +const ( + MethodConfigure Method = "configure" + MethodRelease Method = "release" + + MethodParseConfigFile Method = "parseConfigFile" + MethodLoadProject Method = "loadProject" + MethodGetSymbolAtPosition Method = "getSymbolAtPosition" + MethodGetSymbolsAtPositions Method = "getSymbolsAtPositions" + MethodGetSymbolAtLocation Method = "getSymbolAtLocation" + MethodGetSymbolsAtLocations Method = "getSymbolsAtLocations" + MethodGetTypeOfSymbol Method = "getTypeOfSymbol" + MethodGetTypesOfSymbols Method = "getTypesOfSymbols" + MethodGetSourceFile Method = "getSourceFile" +) + +var unmarshalers = map[Method]func([]byte) (any, error){ + MethodRelease: unmarshallerFor[string], + MethodParseConfigFile: unmarshallerFor[ParseConfigFileParams], + MethodLoadProject: unmarshallerFor[LoadProjectParams], + MethodGetSourceFile: unmarshallerFor[GetSourceFileParams], + MethodGetSymbolAtPosition: unmarshallerFor[GetSymbolAtPositionParams], + MethodGetSymbolsAtPositions: unmarshallerFor[GetSymbolsAtPositionsParams], + MethodGetSymbolAtLocation: unmarshallerFor[GetSymbolAtLocationParams], + MethodGetSymbolsAtLocations: unmarshallerFor[GetSymbolsAtLocationsParams], + MethodGetTypeOfSymbol: unmarshallerFor[GetTypeOfSymbolParams], + MethodGetTypesOfSymbols: unmarshallerFor[GetTypesOfSymbolsParams], +} + +type ConfigureParams struct { + Callbacks []string `json:"callbacks"` + LogFile string `json:"logFile"` +} + +type ParseConfigFileParams struct { + FileName string `json:"fileName"` +} + +type ConfigFileResponse struct { + FileNames []string `json:"fileNames"` + Options *core.CompilerOptions `json:"options"` +} + +type LoadProjectParams struct { + ConfigFileName string `json:"configFileName"` +} + +type ProjectResponse struct { + Id Handle[project.Project] `json:"id"` + ConfigFileName string `json:"configFileName"` + RootFiles []string `json:"rootFiles"` + CompilerOptions *core.CompilerOptions `json:"compilerOptions"` +} + +func NewProjectResponse(project *project.Project) *ProjectResponse { + return &ProjectResponse{ + Id: ProjectHandle(project), + ConfigFileName: project.Name(), + RootFiles: project.CommandLine.FileNames(), + CompilerOptions: project.CommandLine.CompilerOptions(), + } +} + +type GetSymbolAtPositionParams struct { + Project Handle[project.Project] `json:"project"` + FileName string `json:"fileName"` + Position uint32 `json:"position"` +} + +type GetSymbolsAtPositionsParams struct { + Project Handle[project.Project] `json:"project"` + FileName string `json:"fileName"` + Positions []uint32 `json:"positions"` +} + +type GetSymbolAtLocationParams struct { + Project Handle[project.Project] `json:"project"` + Location Handle[ast.Node] `json:"location"` +} + +type GetSymbolsAtLocationsParams struct { + Project Handle[project.Project] `json:"project"` + Locations []Handle[ast.Node] `json:"locations"` +} + +type SymbolResponse struct { + Id Handle[ast.Symbol] `json:"id"` + Name string `json:"name"` + Flags uint32 `json:"flags"` + CheckFlags uint32 `json:"checkFlags"` +} + +func NewSymbolResponse(symbol *ast.Symbol) *SymbolResponse { + return &SymbolResponse{ + Id: SymbolHandle(symbol), + Name: symbol.Name, + Flags: uint32(symbol.Flags), + CheckFlags: uint32(symbol.CheckFlags), + } +} + +type GetTypeOfSymbolParams struct { + Project Handle[project.Project] `json:"project"` + Symbol Handle[ast.Symbol] `json:"symbol"` +} + +type GetTypesOfSymbolsParams struct { + Project Handle[project.Project] `json:"project"` + Symbols []Handle[ast.Symbol] `json:"symbols"` +} + +type TypeResponse struct { + Id Handle[checker.Type] `json:"id"` + Flags uint32 `json:"flags"` +} + +func NewTypeData(t *checker.Type) *TypeResponse { + return &TypeResponse{ + Id: TypeHandle(t), + Flags: uint32(t.Flags()), + } +} + +type GetSourceFileParams struct { + Project Handle[project.Project] `json:"project"` + FileName string `json:"fileName"` +} + +func unmarshalPayload(method string, payload jsontext.Value) (any, error) { + unmarshaler, ok := unmarshalers[Method(method)] + if !ok { + return nil, fmt.Errorf("unknown API method %q", method) + } + return unmarshaler(payload) +} + +func unmarshallerFor[T any](data []byte) (any, error) { + var v T + if err := json.Unmarshal(data, &v); err != nil { + return nil, fmt.Errorf("failed to unmarshal %T: %w", (*T)(nil), err) + } + return &v, nil +} diff --git a/kitcom/internal/tsgo/api/server.go b/kitcom/internal/tsgo/api/server.go new file mode 100644 index 0000000..f11639c --- /dev/null +++ b/kitcom/internal/tsgo/api/server.go @@ -0,0 +1,497 @@ +package api + +import ( + "bufio" + "context" + "encoding/binary" + "fmt" + "io" + "runtime/debug" + "strconv" + "sync" + "time" + + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/bundled" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/core" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/project" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/project/logging" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/vfs" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/vfs/osvfs" + "github.com/go-json-experiment/json" +) + +//go:generate go tool golang.org/x/tools/cmd/stringer -type=MessageType -output=stringer_generated.go +//go:generate go tool mvdan.cc/gofumpt -w stringer_generated.go + +type MessageType uint8 + +const ( + MessageTypeUnknown MessageType = iota + MessageTypeRequest + MessageTypeCallResponse + MessageTypeCallError + MessageTypeResponse + MessageTypeError + MessageTypeCall +) + +func (m MessageType) IsValid() bool { + return m >= MessageTypeRequest && m <= MessageTypeCall +} + +type MessagePackType uint8 + +const ( + MessagePackTypeFixedArray3 MessagePackType = 0x93 + MessagePackTypeBin8 MessagePackType = 0xC4 + MessagePackTypeBin16 MessagePackType = 0xC5 + MessagePackTypeBin32 MessagePackType = 0xC6 + MessagePackTypeU8 MessagePackType = 0xCC +) + +type Callback int + +const ( + CallbackDirectoryExists Callback = 1 << iota + CallbackFileExists + CallbackGetAccessibleEntries + CallbackReadFile + CallbackRealpath +) + +type ServerOptions struct { + In io.Reader + Out io.Writer + Err io.Writer + Cwd string + DefaultLibraryPath string +} + +var _ vfs.FS = (*Server)(nil) + +type Server struct { + r *bufio.Reader + w *bufio.Writer + stderr io.Writer + + cwd string + newLine string + fs vfs.FS + defaultLibraryPath string + + callbackMu sync.Mutex + enabledCallbacks Callback + logger logging.Logger + api *API + + requestId int +} + +func NewServer(options *ServerOptions) *Server { + if options.Cwd == "" { + panic("Cwd is required") + } + + server := &Server{ + r: bufio.NewReader(options.In), + w: bufio.NewWriter(options.Out), + stderr: options.Err, + cwd: options.Cwd, + fs: bundled.WrapFS(osvfs.FS()), + defaultLibraryPath: options.DefaultLibraryPath, + } + logger := logging.NewLogger(options.Err) + server.logger = logger + server.api = NewAPI(&APIInit{ + Logger: logger, + FS: server, + SessionOptions: &project.SessionOptions{ + CurrentDirectory: options.Cwd, + DefaultLibraryPath: options.DefaultLibraryPath, + PositionEncoding: lsproto.PositionEncodingKindUTF8, + LoggingEnabled: true, + }, + }) + return server +} + +// DefaultLibraryPath implements APIHost. +func (s *Server) DefaultLibraryPath() string { + return s.defaultLibraryPath +} + +// FS implements APIHost. +func (s *Server) FS() vfs.FS { + return s +} + +// GetCurrentDirectory implements APIHost. +func (s *Server) GetCurrentDirectory() string { + return s.cwd +} + +func (s *Server) Run() error { + for { + messageType, method, payload, err := s.readRequest("") + if err != nil { + return err + } + + switch messageType { + case MessageTypeRequest: + defer func() { + if r := recover(); r != nil { + stack := debug.Stack() + err = fmt.Errorf("panic handling request: %v\n%s", r, string(stack)) + if fatalErr := s.sendError(method, err); fatalErr != nil { + panic("fatal error sending panic response") + } + } + }() + + result, err := s.handleRequest(method, payload) + + if err != nil { + if err := s.sendError(method, err); err != nil { + return err + } + } else { + if err := s.sendResponse(method, result); err != nil { + return err + } + } + default: + return fmt.Errorf("%w: expected request, received: %s", ErrInvalidRequest, messageType.String()) + } + } +} + +func (s *Server) readRequest(expectedMethod string) (messageType MessageType, method string, payload []byte, err error) { + t, err := s.r.ReadByte() + if err != nil { + return messageType, method, payload, err + } + if MessagePackType(t) != MessagePackTypeFixedArray3 { + return messageType, method, payload, fmt.Errorf("%w: expected message to be encoded as fixed 3-element array (0x93), received: 0x%2x", ErrInvalidRequest, t) + } + t, err = s.r.ReadByte() + if err != nil { + return messageType, method, payload, err + } + if MessagePackType(t) != MessagePackTypeU8 { + return messageType, method, payload, fmt.Errorf("%w: expected first element of message tuple to be encoded as unsigned 8-bit int (0xcc), received: 0x%2x", ErrInvalidRequest, t) + } + rawMessageType, err := s.r.ReadByte() + if err != nil { + return messageType, method, payload, err + } + messageType = MessageType(rawMessageType) + if !messageType.IsValid() { + return messageType, method, payload, fmt.Errorf("%w: unknown message type: %d", ErrInvalidRequest, messageType) + } + rawMethod, err := s.readBin() + if err != nil { + return messageType, method, payload, err + } + method = string(rawMethod) + if expectedMethod != "" && method != expectedMethod { + return messageType, method, payload, fmt.Errorf("%w: expected method %q, received %q", ErrInvalidRequest, expectedMethod, method) + } + payload, err = s.readBin() + return messageType, method, payload, err +} + +func (s *Server) readBin() ([]byte, error) { + // https://github.com/msgpack/msgpack/blob/master/spec.md#bin-format-family + t, err := s.r.ReadByte() + if err != nil { + return nil, err + } + var size uint + switch MessagePackType(t) { + case MessagePackTypeBin8: + var size8 uint8 + if err = binary.Read(s.r, binary.BigEndian, &size8); err != nil { + return nil, err + } + size = uint(size8) + case MessagePackTypeBin16: + var size16 uint16 + if err = binary.Read(s.r, binary.BigEndian, &size16); err != nil { + return nil, err + } + size = uint(size16) + case MessagePackTypeBin32: + var size32 uint32 + if err = binary.Read(s.r, binary.BigEndian, &size32); err != nil { + return nil, err + } + size = uint(size32) + default: + return nil, fmt.Errorf("%w: expected binary data length (0xc4-0xc6), received: 0x%2x", ErrInvalidRequest, t) + } + payload := make([]byte, size) + bytesRead, err := io.ReadFull(s.r, payload) + if err != nil { + return nil, err + } + if bytesRead != int(size) { + return nil, fmt.Errorf("%w: expected %d bytes, read %d", ErrInvalidRequest, size, bytesRead) + } + return payload, nil +} + +func (s *Server) enableCallback(callback string) error { + switch callback { + case "directoryExists": + s.enabledCallbacks |= CallbackDirectoryExists + case "fileExists": + s.enabledCallbacks |= CallbackFileExists + case "getAccessibleEntries": + s.enabledCallbacks |= CallbackGetAccessibleEntries + case "readFile": + s.enabledCallbacks |= CallbackReadFile + case "realpath": + s.enabledCallbacks |= CallbackRealpath + default: + return fmt.Errorf("unknown callback: %s", callback) + } + return nil +} + +func (s *Server) handleRequest(method string, payload []byte) ([]byte, error) { + s.requestId++ + switch method { + case "configure": + return nil, s.handleConfigure(payload) + case "echo": + return payload, nil + default: + return s.api.HandleRequest(core.WithRequestID(context.Background(), strconv.Itoa(s.requestId)), method, payload) + } +} + +func (s *Server) handleConfigure(payload []byte) error { + var params *ConfigureParams + if err := json.Unmarshal(payload, ¶ms); err != nil { + return fmt.Errorf("%w: %w", ErrInvalidRequest, err) + } + for _, callback := range params.Callbacks { + if err := s.enableCallback(callback); err != nil { + return err + } + } + // !!! + if params.LogFile != "" { + // s.logger.SetFile(params.LogFile) + } else { + // s.logger.SetFile("") + } + return nil +} + +func (s *Server) sendResponse(method string, result []byte) error { + return s.writeMessage(MessageTypeResponse, method, result) +} + +func (s *Server) sendError(method string, err error) error { + return s.writeMessage(MessageTypeError, method, []byte(err.Error())) +} + +func (s *Server) writeMessage(messageType MessageType, method string, payload []byte) error { + if err := s.w.WriteByte(byte(MessagePackTypeFixedArray3)); err != nil { + return err + } + if err := s.w.WriteByte(byte(MessagePackTypeU8)); err != nil { + return err + } + if err := s.w.WriteByte(byte(messageType)); err != nil { + return err + } + if err := s.writeBin([]byte(method)); err != nil { + return err + } + if err := s.writeBin(payload); err != nil { + return err + } + return s.w.Flush() +} + +func (s *Server) writeBin(payload []byte) error { + length := len(payload) + if length < 256 { + if err := s.w.WriteByte(byte(MessagePackTypeBin8)); err != nil { + return err + } + if err := s.w.WriteByte(byte(length)); err != nil { + return err + } + } else if length < 1<<16 { + if err := s.w.WriteByte(byte(MessagePackTypeBin16)); err != nil { + return err + } + if err := binary.Write(s.w, binary.BigEndian, uint16(length)); err != nil { + return err + } + } else { + if err := s.w.WriteByte(byte(MessagePackTypeBin32)); err != nil { + return err + } + if err := binary.Write(s.w, binary.BigEndian, uint32(length)); err != nil { + return err + } + } + _, err := s.w.Write(payload) + return err +} + +func (s *Server) call(method string, payload any) ([]byte, error) { + s.callbackMu.Lock() + defer s.callbackMu.Unlock() + jsonPayload, err := json.Marshal(payload) + if err != nil { + return nil, err + } + if err = s.writeMessage(MessageTypeCall, method, jsonPayload); err != nil { + return nil, err + } + + messageType, _, responsePayload, err := s.readRequest(method) + if err != nil { + return nil, err + } + + if messageType != MessageTypeCallResponse && messageType != MessageTypeCallError { + return nil, fmt.Errorf("%w: expected call-response or call-error, received: %s", ErrInvalidRequest, messageType.String()) + } + + if messageType == MessageTypeCallError { + return nil, fmt.Errorf("%w: %s", ErrClientError, responsePayload) + } + + return responsePayload, nil +} + +// DirectoryExists implements vfs.FS. +func (s *Server) DirectoryExists(path string) bool { + if s.enabledCallbacks&CallbackDirectoryExists != 0 { + result, err := s.call("directoryExists", path) + if err != nil { + panic(err) + } + if len(result) > 0 { + return string(result) == "true" + } + } + return s.fs.DirectoryExists(path) +} + +// FileExists implements vfs.FS. +func (s *Server) FileExists(path string) bool { + if s.enabledCallbacks&CallbackFileExists != 0 { + result, err := s.call("fileExists", path) + if err != nil { + panic(err) + } + if len(result) > 0 { + return string(result) == "true" + } + } + return s.fs.FileExists(path) +} + +// GetAccessibleEntries implements vfs.FS. +func (s *Server) GetAccessibleEntries(path string) vfs.Entries { + if s.enabledCallbacks&CallbackGetAccessibleEntries != 0 { + result, err := s.call("getAccessibleEntries", path) + if err != nil { + panic(err) + } + if len(result) > 0 { + var rawEntries *struct { + Files []string `json:"files"` + Directories []string `json:"directories"` + } + if err := json.Unmarshal(result, &rawEntries); err != nil { + panic(err) + } + if rawEntries != nil { + return vfs.Entries{ + Files: rawEntries.Files, + Directories: rawEntries.Directories, + } + } + } + } + return s.fs.GetAccessibleEntries(path) +} + +// ReadFile implements vfs.FS. +func (s *Server) ReadFile(path string) (contents string, ok bool) { + if s.enabledCallbacks&CallbackReadFile != 0 { + data, err := s.call("readFile", path) + if err != nil { + panic(err) + } + if string(data) == "null" { + return "", false + } + if len(data) > 0 { + var result string + if err := json.Unmarshal(data, &result); err != nil { + panic(err) + } + return result, true + } + } + return s.fs.ReadFile(path) +} + +// Realpath implements vfs.FS. +func (s *Server) Realpath(path string) string { + if s.enabledCallbacks&CallbackRealpath != 0 { + data, err := s.call("realpath", path) + if err != nil { + panic(err) + } + if len(data) > 0 { + var result string + if err := json.Unmarshal(data, &result); err != nil { + panic(err) + } + return result + } + } + return s.fs.Realpath(path) +} + +// UseCaseSensitiveFileNames implements vfs.FS. +func (s *Server) UseCaseSensitiveFileNames() bool { + return s.fs.UseCaseSensitiveFileNames() +} + +// WriteFile implements vfs.FS. +func (s *Server) WriteFile(path string, data string, writeByteOrderMark bool) error { + return s.fs.WriteFile(path, data, writeByteOrderMark) +} + +// WalkDir implements vfs.FS. +func (s *Server) WalkDir(root string, walkFn vfs.WalkDirFunc) error { + panic("unimplemented") +} + +// Stat implements vfs.FS. +func (s *Server) Stat(path string) vfs.FileInfo { + panic("unimplemented") +} + +// Remove implements vfs.FS. +func (s *Server) Remove(path string) error { + panic("unimplemented") +} + +// Chtimes implements vfs.FS. +func (s *Server) Chtimes(path string, aTime time.Time, mTime time.Time) error { + panic("unimplemented") +} diff --git a/kitcom/internal/tsgo/api/stringer_generated.go b/kitcom/internal/tsgo/api/stringer_generated.go new file mode 100644 index 0000000..0a740d3 --- /dev/null +++ b/kitcom/internal/tsgo/api/stringer_generated.go @@ -0,0 +1,29 @@ +// Code generated by "stringer -type=MessageType -output=stringer_generated.go"; DO NOT EDIT. + +package api + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[MessageTypeUnknown-0] + _ = x[MessageTypeRequest-1] + _ = x[MessageTypeCallResponse-2] + _ = x[MessageTypeCallError-3] + _ = x[MessageTypeResponse-4] + _ = x[MessageTypeError-5] + _ = x[MessageTypeCall-6] +} + +const _MessageType_name = "MessageTypeUnknownMessageTypeRequestMessageTypeCallResponseMessageTypeCallErrorMessageTypeResponseMessageTypeErrorMessageTypeCall" + +var _MessageType_index = [...]uint8{0, 18, 36, 59, 79, 98, 114, 129} + +func (i MessageType) String() string { + if i >= MessageType(len(_MessageType_index)-1) { + return "MessageType(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _MessageType_name[_MessageType_index[i]:_MessageType_index[i+1]] +} diff --git a/kitcom/internal/tsgo/ast/ast.go b/kitcom/internal/tsgo/ast/ast.go new file mode 100644 index 0000000..992a742 --- /dev/null +++ b/kitcom/internal/tsgo/ast/ast.go @@ -0,0 +1,11118 @@ +package ast + +import ( + "fmt" + "iter" + "strings" + "sync" + "sync/atomic" + + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/collections" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/core" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/tspath" +) + +// Visitor + +type Visitor func(*Node) bool + +func visit(v Visitor, node *Node) bool { + if node != nil { + return v(node) + } + return false +} + +func visitNodes(v Visitor, nodes []*Node) bool { + for _, node := range nodes { + if v(node) { + return true + } + } + return false +} + +func visitNodeList(v Visitor, nodeList *NodeList) bool { + if nodeList != nil { + return visitNodes(v, nodeList.Nodes) + } + return false +} + +func visitModifiers(v Visitor, modifiers *ModifierList) bool { + if modifiers != nil { + return visitNodes(v, modifiers.Nodes) + } + return false +} + +// NodeFactory + +type NodeFactory struct { + hooks NodeFactoryHooks + arrayTypeNodePool core.Pool[ArrayTypeNode] + binaryExpressionPool core.Pool[BinaryExpression] + blockPool core.Pool[Block] + callExpressionPool core.Pool[CallExpression] + conditionalExpressionPool core.Pool[ConditionalExpression] + constructSignatureDeclarationPool core.Pool[ConstructSignatureDeclaration] + elementAccessExpressionPool core.Pool[ElementAccessExpression] + expressionStatementPool core.Pool[ExpressionStatement] + expressionWithTypeArgumentsPool core.Pool[ExpressionWithTypeArguments] + functionDeclarationPool core.Pool[FunctionDeclaration] + functionTypeNodePool core.Pool[FunctionTypeNode] + heritageClausePool core.Pool[HeritageClause] + identifierPool core.Pool[Identifier] + ifStatementPool core.Pool[IfStatement] + importSpecifierPool core.Pool[ImportSpecifier] + indexedAccessTypeNodePool core.Pool[IndexedAccessTypeNode] + interfaceDeclarationPool core.Pool[InterfaceDeclaration] + intersectionTypeNodePool core.Pool[IntersectionTypeNode] + jsdocDeprecatedTagPool core.Pool[JSDocDeprecatedTag] + jsdocParameterOrPropertyTagPool core.Pool[JSDocParameterOrPropertyTag] + jsdocPool core.Pool[JSDoc] + jsdocTextPool core.Pool[JSDocText] + jsdocUnknownTagPool core.Pool[JSDocUnknownTag] + keywordExpressionPool core.Pool[KeywordExpression] + keywordTypeNodePool core.Pool[KeywordTypeNode] + literalTypeNodePool core.Pool[LiteralTypeNode] + methodSignatureDeclarationPool core.Pool[MethodSignatureDeclaration] + modifierListPool core.Pool[ModifierList] + nodeListPool core.Pool[NodeList] + numericLiteralPool core.Pool[NumericLiteral] + parameterDeclarationPool core.Pool[ParameterDeclaration] + parenthesizedExpressionPool core.Pool[ParenthesizedExpression] + parenthesizedTypeNodePool core.Pool[ParenthesizedTypeNode] + prefixUnaryExpressionPool core.Pool[PrefixUnaryExpression] + propertyAccessExpressionPool core.Pool[PropertyAccessExpression] + propertyAssignmentPool core.Pool[PropertyAssignment] + propertySignatureDeclarationPool core.Pool[PropertySignatureDeclaration] + returnStatementPool core.Pool[ReturnStatement] + stringLiteralPool core.Pool[StringLiteral] + tokenPool core.Pool[Token] + typeAliasDeclarationPool core.Pool[TypeAliasDeclaration] + typeLiteralNodePool core.Pool[TypeLiteralNode] + typeOperatorNodePool core.Pool[TypeOperatorNode] + typeParameterDeclarationPool core.Pool[TypeParameterDeclaration] + typeReferenceNodePool core.Pool[TypeReferenceNode] + unionTypeNodePool core.Pool[UnionTypeNode] + variableDeclarationListPool core.Pool[VariableDeclarationList] + variableDeclarationPool core.Pool[VariableDeclaration] + variableStatementPool core.Pool[VariableStatement] + + nodeCount int + textCount int +} + +type NodeFactoryHooks struct { + OnCreate func(node *Node) // Hooks the creation of a node. + OnUpdate func(node *Node, original *Node) // Hooks the updating of a node. + OnClone func(node *Node, original *Node) // Hooks the cloning of a node. +} + +type NodeFactoryCoercible interface { + AsNodeFactory() *NodeFactory +} + +func NewNodeFactory(hooks NodeFactoryHooks) *NodeFactory { + return &NodeFactory{hooks: hooks} +} + +func newNode(kind Kind, data nodeData, hooks NodeFactoryHooks) *Node { + n := data.AsNode() + n.Loc = core.UndefinedTextRange() + n.Kind = kind + n.data = data + if hooks.OnCreate != nil { + hooks.OnCreate(n) + } + return n +} + +func (f *NodeFactory) newNode(kind Kind, data nodeData) *Node { + f.nodeCount++ + return newNode(kind, data, f.hooks) +} + +func (f *NodeFactory) NodeCount() int { + return f.nodeCount +} + +func (f *NodeFactory) TextCount() int { + return f.textCount +} + +func (f *NodeFactory) AsNodeFactory() *NodeFactory { + return f +} + +func updateNode(updated *Node, original *Node, hooks NodeFactoryHooks) *Node { + if updated != original { + updated.Flags = original.Flags + updated.Loc = original.Loc + if hooks.OnUpdate != nil { + hooks.OnUpdate(updated, original) + } + } + return updated +} + +func cloneNode(updated *Node, original *Node, hooks NodeFactoryHooks) *Node { + updateNode(updated, original, hooks) + if updated != original && hooks.OnClone != nil { + hooks.OnClone(updated, original) + } + return updated +} + +// NodeList + +type NodeList struct { + Loc core.TextRange + Nodes []*Node +} + +func (f *NodeFactory) NewNodeList(nodes []*Node) *NodeList { + list := f.nodeListPool.New() + list.Loc = core.UndefinedTextRange() + list.Nodes = nodes + return list +} + +func (list *NodeList) Pos() int { return list.Loc.Pos() } +func (list *NodeList) End() int { return list.Loc.End() } + +func (list *NodeList) HasTrailingComma() bool { + if len(list.Nodes) == 0 { + return false + } + last := list.Nodes[len(list.Nodes)-1] + return last.End() < list.End() +} + +func (list *NodeList) Clone(f NodeFactoryCoercible) *NodeList { + result := f.AsNodeFactory().NewNodeList(list.Nodes) + result.Loc = list.Loc + return result +} + +// ModifierList + +type ModifierList struct { + NodeList + ModifierFlags ModifierFlags +} + +func (f *NodeFactory) NewModifierList(nodes []*Node) *ModifierList { + list := f.modifierListPool.New() + list.Loc = core.UndefinedTextRange() + list.Nodes = nodes + list.ModifierFlags = ModifiersToFlags(nodes) + return list +} + +func (list *ModifierList) Clone(f *NodeFactory) *ModifierList { + res := f.modifierListPool.New() + res.Loc = list.Loc + res.Nodes = list.Nodes + res.ModifierFlags = list.ModifierFlags + return res +} + +// AST Node +// Interface values stored in AST nodes are never typed nil values. Construction code must ensure that +// interface valued properties either store a true nil or a reference to a non-nil struct. + +type Node struct { + Kind Kind + Flags NodeFlags + Loc core.TextRange + id atomic.Uint64 + Parent *Node + data nodeData +} + +// Node accessors. Some accessors are implemented as methods on NodeData, others are implemented though +// type switches. Either approach is fine. Interface methods are likely more performant, but have higher +// code size costs because we have hundreds of implementations of the NodeData interface. + +func (n *Node) AsNode() *Node { return n } +func (n *Node) Pos() int { return n.Loc.Pos() } +func (n *Node) End() int { return n.Loc.End() } +func (n *Node) ForEachChild(v Visitor) bool { return n.data.ForEachChild(v) } +func (n *Node) IterChildren() iter.Seq[*Node] { return n.data.IterChildren() } +func (n *Node) Clone(f NodeFactoryCoercible) *Node { return n.data.Clone(f) } +func (n *Node) VisitEachChild(v *NodeVisitor) *Node { return n.data.VisitEachChild(v) } +func (n *Node) Name() *DeclarationName { return n.data.Name() } +func (n *Node) Modifiers() *ModifierList { return n.data.Modifiers() } +func (n *Node) FlowNodeData() *FlowNodeBase { return n.data.FlowNodeData() } +func (n *Node) DeclarationData() *DeclarationBase { return n.data.DeclarationData() } +func (n *Node) ExportableData() *ExportableBase { return n.data.ExportableData() } +func (n *Node) LocalsContainerData() *LocalsContainerBase { return n.data.LocalsContainerData() } +func (n *Node) FunctionLikeData() *FunctionLikeBase { return n.data.FunctionLikeData() } +func (n *Node) ParameterList() *ParameterList { return n.data.FunctionLikeData().Parameters } +func (n *Node) Parameters() []*ParameterDeclarationNode { return n.ParameterList().Nodes } +func (n *Node) ClassLikeData() *ClassLikeBase { return n.data.ClassLikeData() } +func (n *Node) BodyData() *BodyBase { return n.data.BodyData() } +func (n *Node) SubtreeFacts() SubtreeFacts { return n.data.SubtreeFacts() } +func (n *Node) propagateSubtreeFacts() SubtreeFacts { return n.data.propagateSubtreeFacts() } +func (n *Node) LiteralLikeData() *LiteralLikeBase { return n.data.LiteralLikeData() } +func (n *Node) TemplateLiteralLikeData() *TemplateLiteralLikeBase { + return n.data.TemplateLiteralLikeData() +} +func (n *Node) KindString() string { return n.Kind.String() } +func (n *Node) KindValue() int16 { return int16(n.Kind) } + +type mutableNode Node + +func (n *Node) AsMutable() *mutableNode { return (*mutableNode)(n) } +func (n *mutableNode) SetModifiers(modifiers *ModifierList) { n.data.setModifiers(modifiers) } + +func (n *Node) Symbol() *Symbol { + data := n.DeclarationData() + if data != nil { + return data.Symbol + } + return nil +} + +func (n *Node) LocalSymbol() *Symbol { + data := n.ExportableData() + if data != nil { + return data.LocalSymbol + } + return nil +} + +func (n *Node) Locals() SymbolTable { + data := n.LocalsContainerData() + if data != nil { + return data.Locals + } + return nil +} + +func (n *Node) Body() *Node { + data := n.BodyData() + if data != nil { + return data.Body + } + return nil +} + +func (n *Node) Text() string { + switch n.Kind { + case KindIdentifier: + return n.AsIdentifier().Text + case KindPrivateIdentifier: + return n.AsPrivateIdentifier().Text + case KindStringLiteral: + return n.AsStringLiteral().Text + case KindNumericLiteral: + return n.AsNumericLiteral().Text + case KindBigIntLiteral: + return n.AsBigIntLiteral().Text + case KindMetaProperty: + return n.AsMetaProperty().Name().Text() + case KindNoSubstitutionTemplateLiteral: + return n.AsNoSubstitutionTemplateLiteral().Text + case KindTemplateHead: + return n.AsTemplateHead().Text + case KindTemplateMiddle: + return n.AsTemplateMiddle().Text + case KindTemplateTail: + return n.AsTemplateTail().Text + case KindJsxNamespacedName: + return n.AsJsxNamespacedName().Namespace.Text() + ":" + n.AsJsxNamespacedName().name.Text() + case KindRegularExpressionLiteral: + return n.AsRegularExpressionLiteral().Text + case KindJSDocText: + return strings.Join(n.AsJSDocText().text, "") + case KindJSDocLink: + return strings.Join(n.AsJSDocLink().text, "") + case KindJSDocLinkCode: + return strings.Join(n.AsJSDocLinkCode().text, "") + case KindJSDocLinkPlain: + return strings.Join(n.AsJSDocLinkPlain().text, "") + } + panic(fmt.Sprintf("Unhandled case in Node.Text: %T", n.data)) +} + +func (n *Node) Expression() *Node { + switch n.Kind { + case KindPropertyAccessExpression: + return n.AsPropertyAccessExpression().Expression + case KindElementAccessExpression: + return n.AsElementAccessExpression().Expression + case KindParenthesizedExpression: + return n.AsParenthesizedExpression().Expression + case KindCallExpression: + return n.AsCallExpression().Expression + case KindNewExpression: + return n.AsNewExpression().Expression + case KindExpressionWithTypeArguments: + return n.AsExpressionWithTypeArguments().Expression + case KindComputedPropertyName: + return n.AsComputedPropertyName().Expression + case KindNonNullExpression: + return n.AsNonNullExpression().Expression + case KindTypeAssertionExpression: + return n.AsTypeAssertion().Expression + case KindAsExpression: + return n.AsAsExpression().Expression + case KindSatisfiesExpression: + return n.AsSatisfiesExpression().Expression + case KindTypeOfExpression: + return n.AsTypeOfExpression().Expression + case KindSpreadAssignment: + return n.AsSpreadAssignment().Expression + case KindSpreadElement: + return n.AsSpreadElement().Expression + case KindTemplateSpan: + return n.AsTemplateSpan().Expression + case KindDeleteExpression: + return n.AsDeleteExpression().Expression + case KindVoidExpression: + return n.AsVoidExpression().Expression + case KindAwaitExpression: + return n.AsAwaitExpression().Expression + case KindYieldExpression: + return n.AsYieldExpression().Expression + case KindPartiallyEmittedExpression: + return n.AsPartiallyEmittedExpression().Expression + case KindIfStatement: + return n.AsIfStatement().Expression + case KindDoStatement: + return n.AsDoStatement().Expression + case KindWhileStatement: + return n.AsWhileStatement().Expression + case KindWithStatement: + return n.AsWithStatement().Expression + case KindForInStatement, KindForOfStatement: + return n.AsForInOrOfStatement().Expression + case KindSwitchStatement: + return n.AsSwitchStatement().Expression + case KindCaseClause: + return n.AsCaseOrDefaultClause().Expression + case KindExpressionStatement: + return n.AsExpressionStatement().Expression + case KindReturnStatement: + return n.AsReturnStatement().Expression + case KindThrowStatement: + return n.AsThrowStatement().Expression + case KindExternalModuleReference: + return n.AsExternalModuleReference().Expression + case KindExportAssignment, KindJSExportAssignment: + return n.AsExportAssignment().Expression + case KindDecorator: + return n.AsDecorator().Expression + case KindJsxExpression: + return n.AsJsxExpression().Expression + case KindJsxSpreadAttribute: + return n.AsJsxSpreadAttribute().Expression + } + panic("Unhandled case in Node.Expression: " + n.Kind.String()) +} + +func (m *mutableNode) SetExpression(expr *Node) { + n := (*Node)(m) + switch n.Kind { + case KindPropertyAccessExpression: + n.AsPropertyAccessExpression().Expression = expr + case KindElementAccessExpression: + n.AsElementAccessExpression().Expression = expr + case KindParenthesizedExpression: + n.AsParenthesizedExpression().Expression = expr + case KindCallExpression: + n.AsCallExpression().Expression = expr + case KindNewExpression: + n.AsNewExpression().Expression = expr + case KindExpressionWithTypeArguments: + n.AsExpressionWithTypeArguments().Expression = expr + case KindComputedPropertyName: + n.AsComputedPropertyName().Expression = expr + case KindNonNullExpression: + n.AsNonNullExpression().Expression = expr + case KindTypeAssertionExpression: + n.AsTypeAssertion().Expression = expr + case KindAsExpression: + n.AsAsExpression().Expression = expr + case KindSatisfiesExpression: + n.AsSatisfiesExpression().Expression = expr + case KindTypeOfExpression: + n.AsTypeOfExpression().Expression = expr + case KindSpreadAssignment: + n.AsSpreadAssignment().Expression = expr + case KindSpreadElement: + n.AsSpreadElement().Expression = expr + case KindTemplateSpan: + n.AsTemplateSpan().Expression = expr + case KindDeleteExpression: + n.AsDeleteExpression().Expression = expr + case KindVoidExpression: + n.AsVoidExpression().Expression = expr + case KindAwaitExpression: + n.AsAwaitExpression().Expression = expr + case KindYieldExpression: + n.AsYieldExpression().Expression = expr + case KindPartiallyEmittedExpression: + n.AsPartiallyEmittedExpression().Expression = expr + case KindIfStatement: + n.AsIfStatement().Expression = expr + case KindDoStatement: + n.AsDoStatement().Expression = expr + case KindWhileStatement: + n.AsWhileStatement().Expression = expr + case KindWithStatement: + n.AsWithStatement().Expression = expr + case KindForInStatement, KindForOfStatement: + n.AsForInOrOfStatement().Expression = expr + case KindSwitchStatement: + n.AsSwitchStatement().Expression = expr + case KindCaseClause: + n.AsCaseOrDefaultClause().Expression = expr + case KindExpressionStatement: + n.AsExpressionStatement().Expression = expr + case KindReturnStatement: + n.AsReturnStatement().Expression = expr + case KindThrowStatement: + n.AsThrowStatement().Expression = expr + case KindExternalModuleReference: + n.AsExternalModuleReference().Expression = expr + case KindExportAssignment, KindJSExportAssignment: + n.AsExportAssignment().Expression = expr + case KindDecorator: + n.AsDecorator().Expression = expr + case KindJsxExpression: + n.AsJsxExpression().Expression = expr + case KindJsxSpreadAttribute: + n.AsJsxSpreadAttribute().Expression = expr + default: + panic("Unhandled case in mutableNode.SetExpression: " + n.Kind.String()) + } +} + +func (n *Node) ArgumentList() *NodeList { + switch n.Kind { + case KindCallExpression: + return n.AsCallExpression().Arguments + case KindNewExpression: + return n.AsNewExpression().Arguments + } + panic("Unhandled case in Node.Arguments: " + n.Kind.String()) +} + +func (n *Node) Arguments() []*Node { + list := n.ArgumentList() + if list != nil { + return list.Nodes + } + return nil +} + +func (n *Node) TypeArgumentList() *NodeList { + switch n.Kind { + case KindCallExpression: + return n.AsCallExpression().TypeArguments + case KindNewExpression: + return n.AsNewExpression().TypeArguments + case KindTaggedTemplateExpression: + return n.AsTaggedTemplateExpression().TypeArguments + case KindTypeReference: + return n.AsTypeReference().TypeArguments + case KindExpressionWithTypeArguments: + return n.AsExpressionWithTypeArguments().TypeArguments + case KindImportType: + return n.AsImportTypeNode().TypeArguments + case KindTypeQuery: + return n.AsTypeQueryNode().TypeArguments + case KindJsxOpeningElement: + return n.AsJsxOpeningElement().TypeArguments + case KindJsxSelfClosingElement: + return n.AsJsxSelfClosingElement().TypeArguments + } + panic("Unhandled case in Node.TypeArguments") +} + +func (n *Node) TypeArguments() []*Node { + list := n.TypeArgumentList() + if list != nil { + return list.Nodes + } + return nil +} + +func (n *Node) TypeParameterList() *NodeList { + switch n.Kind { + case KindClassDeclaration: + return n.AsClassDeclaration().TypeParameters + case KindClassExpression: + return n.AsClassExpression().TypeParameters + case KindInterfaceDeclaration: + return n.AsInterfaceDeclaration().TypeParameters + case KindTypeAliasDeclaration, KindJSTypeAliasDeclaration: + return n.AsTypeAliasDeclaration().TypeParameters + case KindJSDocTemplateTag: + return n.AsJSDocTemplateTag().TypeParameters + default: + funcLike := n.FunctionLikeData() + if funcLike != nil { + return funcLike.TypeParameters + } + } + panic("Unhandled case in Node.TypeParameterList") +} + +func (n *Node) TypeParameters() []*Node { + list := n.TypeParameterList() + if list != nil { + return list.Nodes + } + return nil +} + +func (n *Node) MemberList() *NodeList { + switch n.Kind { + case KindClassDeclaration: + return n.AsClassDeclaration().Members + case KindClassExpression: + return n.AsClassExpression().Members + case KindInterfaceDeclaration: + return n.AsInterfaceDeclaration().Members + case KindEnumDeclaration: + return n.AsEnumDeclaration().Members + case KindTypeLiteral: + return n.AsTypeLiteralNode().Members + case KindMappedType: + return n.AsMappedTypeNode().Members + } + panic("Unhandled case in Node.MemberList: " + n.Kind.String()) +} + +func (n *Node) Members() []*Node { + list := n.MemberList() + if list != nil { + return list.Nodes + } + return nil +} + +func (n *Node) StatementList() *NodeList { + switch n.Kind { + case KindSourceFile: + return n.AsSourceFile().Statements + case KindBlock: + return n.AsBlock().Statements + case KindModuleBlock: + return n.AsModuleBlock().Statements + } + panic("Unhandled case in Node.StatementList: " + n.Kind.String()) +} + +func (n *Node) Statements() []*Node { + list := n.StatementList() + if list != nil { + return list.Nodes + } + return nil +} + +func (n *Node) ModifierFlags() ModifierFlags { + modifiers := n.Modifiers() + if modifiers != nil { + return modifiers.ModifierFlags + } + return ModifierFlagsNone +} + +func (n *Node) ModifierNodes() []*Node { + modifiers := n.Modifiers() + if modifiers != nil { + return modifiers.Nodes + } + return nil +} + +func (n *Node) Type() *Node { + switch n.Kind { + case KindVariableDeclaration: + return n.AsVariableDeclaration().Type + case KindParameter: + return n.AsParameterDeclaration().Type + case KindPropertySignature: + return n.AsPropertySignatureDeclaration().Type + case KindPropertyDeclaration: + return n.AsPropertyDeclaration().Type + case KindPropertyAssignment: + return n.AsPropertyAssignment().Type + case KindShorthandPropertyAssignment: + return n.AsShorthandPropertyAssignment().Type + case KindTypePredicate: + return n.AsTypePredicateNode().Type + case KindParenthesizedType: + return n.AsParenthesizedTypeNode().Type + case KindTypeOperator: + return n.AsTypeOperatorNode().Type + case KindMappedType: + return n.AsMappedTypeNode().Type + case KindTypeAssertionExpression: + return n.AsTypeAssertion().Type + case KindAsExpression: + return n.AsAsExpression().Type + case KindSatisfiesExpression: + return n.AsSatisfiesExpression().Type + case KindTypeAliasDeclaration, KindJSTypeAliasDeclaration: + return n.AsTypeAliasDeclaration().Type + case KindNamedTupleMember: + return n.AsNamedTupleMember().Type + case KindOptionalType: + return n.AsOptionalTypeNode().Type + case KindRestType: + return n.AsRestTypeNode().Type + case KindTemplateLiteralTypeSpan: + return n.AsTemplateLiteralTypeSpan().Type + case KindJSDocTypeExpression: + return n.AsJSDocTypeExpression().Type + case KindJSDocParameterTag, KindJSDocPropertyTag: + return n.AsJSDocParameterOrPropertyTag().TypeExpression + case KindJSDocNullableType: + return n.AsJSDocNullableType().Type + case KindJSDocNonNullableType: + return n.AsJSDocNonNullableType().Type + case KindJSDocOptionalType: + return n.AsJSDocOptionalType().Type + case KindExportAssignment, KindJSExportAssignment: + return n.AsExportAssignment().Type + case KindCommonJSExport: + return n.AsCommonJSExport().Type + case KindBinaryExpression: + return n.AsBinaryExpression().Type + default: + if funcLike := n.FunctionLikeData(); funcLike != nil { + return funcLike.Type + } + } + return nil +} + +func (m *mutableNode) SetType(t *Node) { + n := (*Node)(m) + switch m.Kind { + case KindVariableDeclaration: + n.AsVariableDeclaration().Type = t + case KindParameter: + n.AsParameterDeclaration().Type = t + case KindPropertySignature: + n.AsPropertySignatureDeclaration().Type = t + case KindPropertyDeclaration: + n.AsPropertyDeclaration().Type = t + case KindPropertyAssignment: + n.AsPropertyAssignment().Type = t + case KindShorthandPropertyAssignment: + n.AsShorthandPropertyAssignment().Type = t + case KindTypePredicate: + n.AsTypePredicateNode().Type = t + case KindParenthesizedType: + n.AsParenthesizedTypeNode().Type = t + case KindTypeOperator: + n.AsTypeOperatorNode().Type = t + case KindMappedType: + n.AsMappedTypeNode().Type = t + case KindTypeAssertionExpression: + n.AsTypeAssertion().Type = t + case KindAsExpression: + n.AsAsExpression().Type = t + case KindSatisfiesExpression: + n.AsSatisfiesExpression().Type = t + case KindTypeAliasDeclaration, KindJSTypeAliasDeclaration: + n.AsTypeAliasDeclaration().Type = t + case KindNamedTupleMember: + n.AsNamedTupleMember().Type = t + case KindOptionalType: + n.AsOptionalTypeNode().Type = t + case KindRestType: + n.AsRestTypeNode().Type = t + case KindTemplateLiteralTypeSpan: + n.AsTemplateLiteralTypeSpan().Type = t + case KindJSDocTypeExpression: + n.AsJSDocTypeExpression().Type = t + case KindJSDocParameterTag, KindJSDocPropertyTag: + n.AsJSDocParameterOrPropertyTag().TypeExpression = t + case KindJSDocNullableType: + n.AsJSDocNullableType().Type = t + case KindJSDocNonNullableType: + n.AsJSDocNonNullableType().Type = t + case KindJSDocOptionalType: + n.AsJSDocOptionalType().Type = t + case KindExportAssignment, KindJSExportAssignment: + n.AsExportAssignment().Type = t + case KindCommonJSExport: + n.AsCommonJSExport().Type = t + case KindBinaryExpression: + n.AsBinaryExpression().Type = t + default: + if funcLike := n.FunctionLikeData(); funcLike != nil { + funcLike.Type = t + } else { + panic("Unhandled case in mutableNode.SetType: " + n.Kind.String()) + } + } +} + +func (n *Node) Initializer() *Node { + switch n.Kind { + case KindVariableDeclaration: + return n.AsVariableDeclaration().Initializer + case KindParameter: + return n.AsParameterDeclaration().Initializer + case KindBindingElement: + return n.AsBindingElement().Initializer + case KindPropertyDeclaration: + return n.AsPropertyDeclaration().Initializer + case KindPropertySignature: + return n.AsPropertySignatureDeclaration().Initializer + case KindPropertyAssignment: + return n.AsPropertyAssignment().Initializer + case KindEnumMember: + return n.AsEnumMember().Initializer + case KindForStatement: + return n.AsForStatement().Initializer + case KindForInStatement, KindForOfStatement: + return n.AsForInOrOfStatement().Initializer + case KindJsxAttribute: + return n.AsJsxAttribute().Initializer + case KindCommonJSExport: + return n.AsCommonJSExport().Initializer + } + panic("Unhandled case in Node.Initializer") +} + +func (m *mutableNode) SetInitializer(initializer *Node) { + n := (*Node)(m) + switch n.Kind { + case KindVariableDeclaration: + n.AsVariableDeclaration().Initializer = initializer + case KindParameter: + n.AsParameterDeclaration().Initializer = initializer + case KindBindingElement: + n.AsBindingElement().Initializer = initializer + case KindPropertyDeclaration: + n.AsPropertyDeclaration().Initializer = initializer + case KindPropertySignature: + n.AsPropertySignatureDeclaration().Initializer = initializer + case KindPropertyAssignment: + n.AsPropertyAssignment().Initializer = initializer + case KindEnumMember: + n.AsEnumMember().Initializer = initializer + case KindForStatement: + n.AsForStatement().Initializer = initializer + case KindForInStatement, KindForOfStatement: + n.AsForInOrOfStatement().Initializer = initializer + case KindJsxAttribute: + n.AsJsxAttribute().Initializer = initializer + case KindCommonJSExport: + n.AsCommonJSExport().Initializer = initializer + default: + panic("Unhandled case in mutableNode.SetInitializer") + } +} + +func (n *Node) TagName() *Node { + switch n.Kind { + case KindJsxOpeningElement: + return n.AsJsxOpeningElement().TagName + case KindJsxClosingElement: + return n.AsJsxClosingElement().TagName + case KindJsxSelfClosingElement: + return n.AsJsxSelfClosingElement().TagName + case KindJSDocTag: + return n.AsJSDocUnknownTag().TagName + case KindJSDocAugmentsTag: + return n.AsJSDocAugmentsTag().TagName + case KindJSDocImplementsTag: + return n.AsJSDocImplementsTag().TagName + case KindJSDocDeprecatedTag: + return n.AsJSDocDeprecatedTag().TagName + case KindJSDocPublicTag: + return n.AsJSDocPublicTag().TagName + case KindJSDocPrivateTag: + return n.AsJSDocPrivateTag().TagName + case KindJSDocProtectedTag: + return n.AsJSDocProtectedTag().TagName + case KindJSDocReadonlyTag: + return n.AsJSDocReadonlyTag().TagName + case KindJSDocOverrideTag: + return n.AsJSDocOverrideTag().TagName + case KindJSDocCallbackTag: + return n.AsJSDocCallbackTag().TagName + case KindJSDocOverloadTag: + return n.AsJSDocOverloadTag().TagName + case KindJSDocParameterTag, KindJSDocPropertyTag: + return n.AsJSDocParameterOrPropertyTag().TagName + case KindJSDocReturnTag: + return n.AsJSDocReturnTag().TagName + case KindJSDocThisTag: + return n.AsJSDocThisTag().TagName + case KindJSDocTypeTag: + return n.AsJSDocTypeTag().TagName + case KindJSDocTemplateTag: + return n.AsJSDocTemplateTag().TagName + case KindJSDocTypedefTag: + return n.AsJSDocTypedefTag().TagName + case KindJSDocSeeTag: + return n.AsJSDocSeeTag().TagName + case KindJSDocSatisfiesTag: + return n.AsJSDocSatisfiesTag().TagName + case KindJSDocImportTag: + return n.AsJSDocImportTag().TagName + } + panic("Unhandled case in Node.TagName: " + n.Kind.String()) +} + +func (n *Node) PropertyName() *Node { + switch n.Kind { + case KindImportSpecifier: + return n.AsImportSpecifier().PropertyName + case KindExportSpecifier: + return n.AsExportSpecifier().PropertyName + case KindBindingElement: + return n.AsBindingElement().PropertyName + } + return nil +} + +func (n *Node) PropertyNameOrName() *Node { + name := n.PropertyName() + if name == nil { + name = n.Name() + } + return name +} + +func (n *Node) IsTypeOnly() bool { + switch n.Kind { + case KindImportEqualsDeclaration: + return n.AsImportEqualsDeclaration().IsTypeOnly + case KindImportSpecifier: + return n.AsImportSpecifier().IsTypeOnly + case KindImportClause: + return n.AsImportClause().PhaseModifier == KindTypeKeyword + case KindExportDeclaration: + return n.AsExportDeclaration().IsTypeOnly + case KindExportSpecifier: + return n.AsExportSpecifier().IsTypeOnly + } + return false +} + +// If updating this function, also update `hasComment`. +func (n *Node) CommentList() *NodeList { + switch n.Kind { + case KindJSDoc: + return n.AsJSDoc().Comment + case KindJSDocTag: + return n.AsJSDocUnknownTag().Comment + case KindJSDocAugmentsTag: + return n.AsJSDocAugmentsTag().Comment + case KindJSDocImplementsTag: + return n.AsJSDocImplementsTag().Comment + case KindJSDocDeprecatedTag: + return n.AsJSDocDeprecatedTag().Comment + case KindJSDocPublicTag: + return n.AsJSDocPublicTag().Comment + case KindJSDocPrivateTag: + return n.AsJSDocPrivateTag().Comment + case KindJSDocProtectedTag: + return n.AsJSDocProtectedTag().Comment + case KindJSDocReadonlyTag: + return n.AsJSDocReadonlyTag().Comment + case KindJSDocOverrideTag: + return n.AsJSDocOverrideTag().Comment + case KindJSDocCallbackTag: + return n.AsJSDocCallbackTag().Comment + case KindJSDocOverloadTag: + return n.AsJSDocOverloadTag().Comment + case KindJSDocParameterTag, KindJSDocPropertyTag: + return n.AsJSDocParameterOrPropertyTag().Comment + case KindJSDocReturnTag: + return n.AsJSDocReturnTag().Comment + case KindJSDocThisTag: + return n.AsJSDocThisTag().Comment + case KindJSDocTypeTag: + return n.AsJSDocTypeTag().Comment + case KindJSDocTemplateTag: + return n.AsJSDocTemplateTag().Comment + case KindJSDocTypedefTag: + return n.AsJSDocTypedefTag().Comment + case KindJSDocSeeTag: + return n.AsJSDocSeeTag().Comment + case KindJSDocSatisfiesTag: + return n.AsJSDocSatisfiesTag().Comment + case KindJSDocImportTag: + return n.AsJSDocImportTag().Comment + } + panic("Unhandled case in Node.CommentList: " + n.Kind.String()) +} + +func (n *Node) Comments() []*Node { + list := n.CommentList() + if list != nil { + return list.Nodes + } + return nil +} + +func (n *Node) Label() *Node { + switch n.Kind { + case KindLabeledStatement: + return n.AsLabeledStatement().Label + case KindBreakStatement: + return n.AsBreakStatement().Label + case KindContinueStatement: + return n.AsContinueStatement().Label + } + panic("Unhandled case in Node.Label: " + n.Kind.String()) +} + +func (n *Node) Attributes() *Node { + switch n.Kind { + case KindJsxOpeningElement: + return n.AsJsxOpeningElement().Attributes + case KindJsxSelfClosingElement: + return n.AsJsxSelfClosingElement().Attributes + } + panic("Unhandled case in Node.Attributes: " + n.Kind.String()) +} + +func (n *Node) Children() *NodeList { + switch n.Kind { + case KindJsxElement: + return n.AsJsxElement().Children + case KindJsxFragment: + return n.AsJsxFragment().Children + } + panic("Unhandled case in Node.Children: " + n.Kind.String()) +} + +func (n *Node) ModuleSpecifier() *Expression { + switch n.Kind { + case KindImportDeclaration, KindJSImportDeclaration: + return n.AsImportDeclaration().ModuleSpecifier + case KindExportDeclaration: + return n.AsExportDeclaration().ModuleSpecifier + case KindJSDocImportTag: + return n.AsJSDocImportTag().ModuleSpecifier + } + panic("Unhandled case in Node.ModuleSpecifier: " + n.Kind.String()) +} + +func (n *Node) ImportClause() *Node { + switch n.Kind { + case KindImportDeclaration, KindJSImportDeclaration: + return n.AsImportDeclaration().ImportClause + case KindJSDocImportTag: + return n.AsJSDocImportTag().ImportClause + } + panic("Unhandled case in Node.ImportClause: " + n.Kind.String()) +} + +func (n *Node) Statement() *Statement { + switch n.Kind { + case KindDoStatement: + return n.AsDoStatement().Statement + case KindWhileStatement: + return n.AsWhileStatement().Statement + case KindForStatement: + return n.AsForStatement().Statement + case KindForInStatement, KindForOfStatement: + return n.AsForInOrOfStatement().Statement + } + panic("Unhandled case in Node.Statement: " + n.Kind.String()) +} + +func (n *Node) PropertyList() *NodeList { + switch n.Kind { + case KindObjectLiteralExpression: + return n.AsObjectLiteralExpression().Properties + case KindJsxAttributes: + return n.AsJsxAttributes().Properties + } + panic("Unhandled case in Node.PropertyList: " + n.Kind.String()) +} + +func (n *Node) Properties() []*Node { + list := n.PropertyList() + if list != nil { + return list.Nodes + } + return nil +} + +func (n *Node) ElementList() *NodeList { + switch n.Kind { + case KindNamedImports: + return n.AsNamedImports().Elements + case KindNamedExports: + return n.AsNamedExports().Elements + case KindObjectBindingPattern, KindArrayBindingPattern: + return n.AsBindingPattern().Elements + } + + panic("Unhandled case in Node.ElementList: " + n.Kind.String()) +} + +func (n *Node) Elements() []*Node { + list := n.ElementList() + if list != nil { + return list.Nodes + } + return nil +} + +func (n *Node) postfixToken() *Node { + switch n.Kind { + case KindEnumMember: + return n.AsEnumMember().PostfixToken + case KindPropertyAssignment: + return n.AsPropertyAssignment().PostfixToken + case KindShorthandPropertyAssignment: + return n.AsShorthandPropertyAssignment().PostfixToken + case KindPropertySignature: + return n.AsPropertySignatureDeclaration().PostfixToken + case KindPropertyDeclaration: + return n.AsPropertyDeclaration().PostfixToken + case KindMethodSignature: + return n.AsMethodSignatureDeclaration().PostfixToken + case KindMethodDeclaration: + return n.AsMethodDeclaration().PostfixToken + case KindGetAccessor: + return n.AsGetAccessorDeclaration().PostfixToken + case KindSetAccessor: + return n.AsSetAccessorDeclaration().PostfixToken + } + return nil +} + +func (n *Node) QuestionToken() *TokenNode { + switch n.Kind { + case KindParameter: + return n.AsParameterDeclaration().QuestionToken + case KindConditionalExpression: + return n.AsConditionalExpression().QuestionToken + case KindMappedType: + return n.AsMappedTypeNode().QuestionToken + case KindNamedTupleMember: + return n.AsNamedTupleMember().QuestionToken + } + postfix := n.postfixToken() + if postfix != nil && postfix.Kind == KindQuestionToken { + return postfix + } + return nil +} + +func (n *Node) QuestionDotToken() *Node { + switch n.Kind { + case KindElementAccessExpression: + return n.AsElementAccessExpression().QuestionDotToken + case KindPropertyAccessExpression: + return n.AsPropertyAccessExpression().QuestionDotToken + case KindCallExpression: + return n.AsCallExpression().QuestionDotToken + case KindTaggedTemplateExpression: + return n.AsTaggedTemplateExpression().QuestionDotToken + } + panic("Unhandled case in Node.QuestionDotToken: " + n.Kind.String()) +} + +func (n *Node) TypeExpression() *Node { + switch n.Kind { + case KindJSDocPropertyTag, KindJSDocParameterTag: + return n.AsJSDocParameterOrPropertyTag().TypeExpression + case KindJSDocReturnTag: + return n.AsJSDocReturnTag().TypeExpression + case KindJSDocTypeTag: + return n.AsJSDocTypeTag().TypeExpression + case KindJSDocTypedefTag: + return n.AsJSDocTypedefTag().TypeExpression + case KindJSDocSatisfiesTag: + return n.AsJSDocSatisfiesTag().TypeExpression + } + panic("Unhandled case in Node.TypeExpression: " + n.Kind.String()) +} + +func (n *Node) ClassName() *Node { + switch n.Kind { + case KindJSDocAugmentsTag: + return n.AsJSDocAugmentsTag().ClassName + case KindJSDocImplementsTag: + return n.AsJSDocImplementsTag().ClassName + } + panic("Unhandled case in Node.ClassName: " + n.Kind.String()) +} + +func (n *Node) PostfixToken() *Node { + switch n.Kind { + case KindParameter: + return n.AsParameterDeclaration().QuestionToken + case KindMethodDeclaration: + return n.AsMethodDeclaration().PostfixToken + case KindShorthandPropertyAssignment: + return n.AsShorthandPropertyAssignment().PostfixToken + case KindMethodSignature: + return n.AsMethodSignatureDeclaration().PostfixToken + case KindPropertySignature: + return n.AsPropertySignatureDeclaration().PostfixToken + case KindPropertyAssignment: + return n.AsPropertyAssignment().PostfixToken + case KindPropertyDeclaration: + return n.AsPropertyDeclaration().PostfixToken + } + return nil +} + +// Determines if `n` contains `descendant` by walking up the `Parent` pointers from `descendant`. This method panics if +// `descendant` or one of its ancestors is not parented except when that node is a `SourceFile`. +func (n *Node) Contains(descendant *Node) bool { + for descendant != nil { + if descendant == n { + return true + } + parent := descendant.Parent + if parent == nil && !IsSourceFile(descendant) { + panic("descendant is not parented") + } + descendant = parent + } + return false +} + +// Node casts + +func (n *Node) AsIdentifier() *Identifier { + return n.data.(*Identifier) +} + +func (n *Node) AsPrivateIdentifier() *PrivateIdentifier { + return n.data.(*PrivateIdentifier) +} + +func (n *Node) AsQualifiedName() *QualifiedName { + return n.data.(*QualifiedName) +} + +func (n *Node) AsSourceFile() *SourceFile { + return n.data.(*SourceFile) +} + +func (n *Node) AsPrefixUnaryExpression() *PrefixUnaryExpression { + return n.data.(*PrefixUnaryExpression) +} + +func (n *Node) AsPostfixUnaryExpression() *PostfixUnaryExpression { + return n.data.(*PostfixUnaryExpression) +} + +func (n *Node) AsParenthesizedExpression() *ParenthesizedExpression { + return n.data.(*ParenthesizedExpression) +} + +func (n *Node) AsTypeAssertion() *TypeAssertion { + return n.data.(*TypeAssertion) +} + +func (n *Node) AsAsExpression() *AsExpression { + return n.data.(*AsExpression) +} + +func (n *Node) AsSatisfiesExpression() *SatisfiesExpression { + return n.data.(*SatisfiesExpression) +} + +func (n *Node) AsExpressionWithTypeArguments() *ExpressionWithTypeArguments { + return n.data.(*ExpressionWithTypeArguments) +} + +func (n *Node) AsNonNullExpression() *NonNullExpression { + return n.data.(*NonNullExpression) +} + +func (n *Node) AsBindingElement() *BindingElement { + return n.data.(*BindingElement) +} + +func (n *Node) AsMissingDeclaration() *MissingDeclaration { + return n.data.(*MissingDeclaration) +} + +func (n *Node) AsImportSpecifier() *ImportSpecifier { + return n.data.(*ImportSpecifier) +} + +func (n *Node) AsArrowFunction() *ArrowFunction { + return n.data.(*ArrowFunction) +} + +func (n *Node) AsCallExpression() *CallExpression { + return n.data.(*CallExpression) +} + +func (n *Node) AsPropertyAccessExpression() *PropertyAccessExpression { + return n.data.(*PropertyAccessExpression) +} + +func (n *Node) AsElementAccessExpression() *ElementAccessExpression { + return n.data.(*ElementAccessExpression) +} + +func (n *Node) AsComputedPropertyName() *ComputedPropertyName { + return n.data.(*ComputedPropertyName) +} + +func (n *Node) AsBinaryExpression() *BinaryExpression { + return n.data.(*BinaryExpression) +} + +func (n *Node) AsModuleDeclaration() *ModuleDeclaration { + return n.data.(*ModuleDeclaration) +} + +func (n *Node) AsStringLiteral() *StringLiteral { + return n.data.(*StringLiteral) +} + +func (n *Node) AsNumericLiteral() *NumericLiteral { + return n.data.(*NumericLiteral) +} + +func (n *Node) AsBigIntLiteral() *BigIntLiteral { + return n.data.(*BigIntLiteral) +} + +func (n *Node) AsNoSubstitutionTemplateLiteral() *NoSubstitutionTemplateLiteral { + return n.data.(*NoSubstitutionTemplateLiteral) +} + +func (n *Node) AsRegularExpressionLiteral() *RegularExpressionLiteral { + return n.data.(*RegularExpressionLiteral) +} + +func (n *Node) AsTemplateHead() *TemplateHead { + return n.data.(*TemplateHead) +} + +func (n *Node) AsTemplateMiddle() *TemplateMiddle { + return n.data.(*TemplateMiddle) +} + +func (n *Node) AsTemplateTail() *TemplateTail { + return n.data.(*TemplateTail) +} + +func (n *Node) AsVariableDeclaration() *VariableDeclaration { + return n.data.(*VariableDeclaration) +} + +func (n *Node) AsExportAssignment() *ExportAssignment { + return n.data.(*ExportAssignment) +} + +func (n *Node) AsCommonJSExport() *CommonJSExport { + return n.data.(*CommonJSExport) +} + +func (n *Node) AsObjectLiteralExpression() *ObjectLiteralExpression { + return n.data.(*ObjectLiteralExpression) +} + +func (n *Node) AsIfStatement() *IfStatement { + return n.data.(*IfStatement) +} + +func (n *Node) AsWhileStatement() *WhileStatement { + return n.data.(*WhileStatement) +} + +func (n *Node) AsDoStatement() *DoStatement { + return n.data.(*DoStatement) +} + +func (n *Node) AsForStatement() *ForStatement { + return n.data.(*ForStatement) +} + +func (n *Node) AsConditionalExpression() *ConditionalExpression { + return n.data.(*ConditionalExpression) +} + +func (n *Node) AsForInOrOfStatement() *ForInOrOfStatement { + return n.data.(*ForInOrOfStatement) +} + +func (n *Node) AsShorthandPropertyAssignment() *ShorthandPropertyAssignment { + return n.data.(*ShorthandPropertyAssignment) +} + +func (n *Node) AsPropertyAssignment() *PropertyAssignment { + return n.data.(*PropertyAssignment) +} + +func (n *Node) AsExpressionStatement() *ExpressionStatement { + return n.data.(*ExpressionStatement) +} + +func (n *Node) AsBlock() *Block { + return n.data.(*Block) +} + +func (n *Node) AsModuleBlock() *ModuleBlock { + return n.data.(*ModuleBlock) +} + +func (n *Node) AsVariableStatement() *VariableStatement { + return n.data.(*VariableStatement) +} + +func (n *Node) AsVariableDeclarationList() *VariableDeclarationList { + return n.data.(*VariableDeclarationList) +} + +func (n *Node) AsMetaProperty() *MetaProperty { + return n.data.(*MetaProperty) +} + +func (n *Node) AsTypeReference() *TypeReferenceNode { + return n.data.(*TypeReferenceNode) +} + +func (n *Node) AsConstructorDeclaration() *ConstructorDeclaration { + return n.data.(*ConstructorDeclaration) +} + +func (n *Node) AsConditionalTypeNode() *ConditionalTypeNode { + return n.data.(*ConditionalTypeNode) +} + +func (n *Node) AsClassExpression() *ClassExpression { + return n.data.(*ClassExpression) +} + +func (n *Node) AsHeritageClause() *HeritageClause { + return n.data.(*HeritageClause) +} + +func (n *Node) AsFunctionExpression() *FunctionExpression { + return n.data.(*FunctionExpression) +} + +func (n *Node) AsParameterDeclaration() *ParameterDeclaration { + return n.data.(*ParameterDeclaration) +} + +func (n *Node) AsDecorator() *Decorator { + return n.data.(*Decorator) +} + +func (n *Node) AsInferTypeNode() *InferTypeNode { + return n.data.(*InferTypeNode) +} + +func (n *Node) AsTypeParameter() *TypeParameterDeclaration { + return n.data.(*TypeParameterDeclaration) +} + +func (n *Node) AsExportSpecifier() *ExportSpecifier { + return n.data.(*ExportSpecifier) +} + +func (n *Node) AsExportDeclaration() *ExportDeclaration { + return n.data.(*ExportDeclaration) +} + +func (n *Node) AsPropertyDeclaration() *PropertyDeclaration { + return n.data.(*PropertyDeclaration) +} + +func (n *Node) AsImportClause() *ImportClause { + return n.data.(*ImportClause) +} + +func (n *Node) AsImportEqualsDeclaration() *ImportEqualsDeclaration { + return n.data.(*ImportEqualsDeclaration) +} + +func (n *Node) AsNamespaceImport() *NamespaceImport { + return n.data.(*NamespaceImport) +} + +func (n *Node) AsPropertySignatureDeclaration() *PropertySignatureDeclaration { + return n.data.(*PropertySignatureDeclaration) +} + +func (n *Node) AsEnumMember() *EnumMember { + return n.data.(*EnumMember) +} + +func (n *Node) AsReturnStatement() *ReturnStatement { + return n.data.(*ReturnStatement) +} + +func (n *Node) AsWithStatement() *WithStatement { + return n.data.(*WithStatement) +} + +func (n *Node) AsSwitchStatement() *SwitchStatement { + return n.data.(*SwitchStatement) +} + +func (n *Node) AsCaseOrDefaultClause() *CaseOrDefaultClause { + return n.data.(*CaseOrDefaultClause) +} + +func (n *Node) AsThrowStatement() *ThrowStatement { + return n.data.(*ThrowStatement) +} + +func (n *Node) AsTemplateSpan() *TemplateSpan { + return n.data.(*TemplateSpan) +} + +func (n *Node) AsImportTypeNode() *ImportTypeNode { + return n.data.(*ImportTypeNode) +} + +func (n *Node) AsNewExpression() *NewExpression { + return n.data.(*NewExpression) +} + +func (n *Node) AsTaggedTemplateExpression() *TaggedTemplateExpression { + return n.data.(*TaggedTemplateExpression) +} + +func (n *Node) AsJsxOpeningElement() *JsxOpeningElement { + return n.data.(*JsxOpeningElement) +} + +func (n *Node) AsJsxSelfClosingElement() *JsxSelfClosingElement { + return n.data.(*JsxSelfClosingElement) +} + +func (n *Node) AsJsxClosingElement() *JsxClosingElement { + return n.data.(*JsxClosingElement) +} + +func (n *Node) AsJsxOpeningFragment() *JsxOpeningFragment { + return n.data.(*JsxOpeningFragment) +} + +func (n *Node) AsJsxClosingFragment() *JsxClosingFragment { + return n.data.(*JsxClosingFragment) +} + +func (n *Node) AsImportDeclaration() *ImportDeclaration { + return n.data.(*ImportDeclaration) +} + +func (n *Node) AsExternalModuleReference() *ExternalModuleReference { + return n.data.(*ExternalModuleReference) +} + +func (n *Node) AsLiteralTypeNode() *LiteralTypeNode { + return n.data.(*LiteralTypeNode) +} + +func (n *Node) AsJsxNamespacedName() *JsxNamespacedName { + return n.data.(*JsxNamespacedName) +} + +func (n *Node) AsClassDeclaration() *ClassDeclaration { + return n.data.(*ClassDeclaration) +} + +func (n *Node) AsInterfaceDeclaration() *InterfaceDeclaration { + return n.data.(*InterfaceDeclaration) +} + +func (n *Node) AsTypeAliasDeclaration() *TypeAliasDeclaration { + return n.data.(*TypeAliasDeclaration) +} + +func (n *Node) AsJsxAttribute() *JsxAttribute { + return n.data.(*JsxAttribute) +} + +func (n *Node) AsJsxAttributes() *JsxAttributes { + return n.data.(*JsxAttributes) +} + +func (n *Node) AsJsxSpreadAttribute() *JsxSpreadAttribute { + return n.data.(*JsxSpreadAttribute) +} + +func (n *Node) AsJsxExpression() *JsxExpression { + return n.data.(*JsxExpression) +} + +func (n *Node) AsJsxText() *JsxText { + return n.data.(*JsxText) +} + +func (n *Node) AsKeywordTypeNode() *KeywordTypeNode { + return n.data.(*KeywordTypeNode) +} + +func (n *Node) AsThisTypeNode() *ThisTypeNode { + return n.data.(*ThisTypeNode) +} + +func (n *Node) AsParenthesizedTypeNode() *ParenthesizedTypeNode { + return n.data.(*ParenthesizedTypeNode) +} + +func (n *Node) AsTypePredicateNode() *TypePredicateNode { + return n.data.(*TypePredicateNode) +} + +func (n *Node) AsTypeOperatorNode() *TypeOperatorNode { + return n.data.(*TypeOperatorNode) +} + +func (n *Node) AsMappedTypeNode() *MappedTypeNode { + return n.data.(*MappedTypeNode) +} + +func (n *Node) AsArrayLiteralExpression() *ArrayLiteralExpression { + return n.data.(*ArrayLiteralExpression) +} + +func (n *Node) AsMethodDeclaration() *MethodDeclaration { + return n.data.(*MethodDeclaration) +} + +func (n *Node) AsMethodSignatureDeclaration() *MethodSignatureDeclaration { + return n.data.(*MethodSignatureDeclaration) +} + +func (n *Node) AsTemplateLiteralTypeSpan() *TemplateLiteralTypeSpan { + return n.data.(*TemplateLiteralTypeSpan) +} + +func (n *Node) AsJsxElement() *JsxElement { + return n.data.(*JsxElement) +} + +func (n *Node) AsJsxFragment() *JsxFragment { + return n.data.(*JsxFragment) +} + +func (n *Node) AsKeywordExpression() *KeywordExpression { + return n.data.(*KeywordExpression) +} + +func (n *Node) AsCatchClause() *CatchClause { + return n.data.(*CatchClause) +} + +func (n *Node) AsDeleteExpression() *DeleteExpression { + return n.data.(*DeleteExpression) +} + +func (n *Node) AsLabeledStatement() *LabeledStatement { + return n.data.(*LabeledStatement) +} + +func (n *Node) AsNamespaceExportDeclaration() *NamespaceExportDeclaration { + return n.data.(*NamespaceExportDeclaration) +} + +func (n *Node) AsNamedImports() *NamedImports { + return n.data.(*NamedImports) +} + +func (n *Node) AsNamedExports() *NamedExports { + return n.data.(*NamedExports) +} + +func (n *Node) AsBreakStatement() *BreakStatement { + return n.data.(*BreakStatement) +} + +func (n *Node) AsContinueStatement() *ContinueStatement { + return n.data.(*ContinueStatement) +} + +func (n *Node) AsCaseBlock() *CaseBlock { + return n.data.(*CaseBlock) +} + +func (n *Node) AsTryStatement() *TryStatement { + return n.data.(*TryStatement) +} + +func (n *Node) AsBindingPattern() *BindingPattern { + return n.data.(*BindingPattern) +} + +func (n *Node) AsFunctionDeclaration() *FunctionDeclaration { + return n.data.(*FunctionDeclaration) +} + +func (n *Node) AsTypeOfExpression() *TypeOfExpression { + return n.data.(*TypeOfExpression) +} + +func (n *Node) AsVoidExpression() *VoidExpression { + return n.data.(*VoidExpression) +} + +func (n *Node) AsAwaitExpression() *AwaitExpression { + return n.data.(*AwaitExpression) +} + +func (n *Node) AsTemplateExpression() *TemplateExpression { + return n.data.(*TemplateExpression) +} + +func (n *Node) AsYieldExpression() *YieldExpression { + return n.data.(*YieldExpression) +} + +func (n *Node) AsPartiallyEmittedExpression() *PartiallyEmittedExpression { + return n.data.(*PartiallyEmittedExpression) +} + +func (n *Node) AsSpreadElement() *SpreadElement { + return n.data.(*SpreadElement) +} + +func (n *Node) AsSpreadAssignment() *SpreadAssignment { + return n.data.(*SpreadAssignment) +} + +func (n *Node) AsArrayTypeNode() *ArrayTypeNode { + return n.data.(*ArrayTypeNode) +} + +func (n *Node) AsTupleTypeNode() *TupleTypeNode { + return n.data.(*TupleTypeNode) +} + +func (n *Node) AsUnionTypeNode() *UnionTypeNode { + return n.data.(*UnionTypeNode) +} + +func (n *Node) AsIntersectionTypeNode() *IntersectionTypeNode { + return n.data.(*IntersectionTypeNode) +} + +func (n *Node) AsRestTypeNode() *RestTypeNode { + return n.data.(*RestTypeNode) +} + +func (n *Node) AsNamedTupleMember() *NamedTupleMember { + return n.data.(*NamedTupleMember) +} + +func (n *Node) AsOptionalTypeNode() *OptionalTypeNode { + return n.data.(*OptionalTypeNode) +} + +func (n *Node) AsTemplateLiteralTypeNode() *TemplateLiteralTypeNode { + return n.data.(*TemplateLiteralTypeNode) +} + +func (n *Node) AsTypeReferenceNode() *TypeReferenceNode { + return n.data.(*TypeReferenceNode) +} + +func (n *Node) AsFunctionTypeNode() *FunctionTypeNode { + return n.data.(*FunctionTypeNode) +} + +func (n *Node) AsConstructorTypeNode() *ConstructorTypeNode { + return n.data.(*ConstructorTypeNode) +} + +func (n *Node) AsTypeQueryNode() *TypeQueryNode { + return n.data.(*TypeQueryNode) +} + +func (n *Node) AsTypeLiteralNode() *TypeLiteralNode { + return n.data.(*TypeLiteralNode) +} + +func (n *Node) AsIndexedAccessTypeNode() *IndexedAccessTypeNode { + return n.data.(*IndexedAccessTypeNode) +} + +func (n *Node) AsGetAccessorDeclaration() *GetAccessorDeclaration { + return n.data.(*GetAccessorDeclaration) +} + +func (n *Node) AsSetAccessorDeclaration() *SetAccessorDeclaration { + return n.data.(*SetAccessorDeclaration) +} + +func (n *Node) AsClassStaticBlockDeclaration() *ClassStaticBlockDeclaration { + return n.data.(*ClassStaticBlockDeclaration) +} + +func (n *Node) AsSemicolonClassElement() *SemicolonClassElement { + return n.data.(*SemicolonClassElement) +} + +func (n *Node) AsCallSignatureDeclaration() *CallSignatureDeclaration { + return n.data.(*CallSignatureDeclaration) +} + +func (n *Node) AsConstructSignatureDeclaration() *ConstructSignatureDeclaration { + return n.data.(*ConstructSignatureDeclaration) +} + +func (n *Node) AsIndexSignatureDeclaration() *IndexSignatureDeclaration { + return n.data.(*IndexSignatureDeclaration) +} + +func (n *Node) AsDebuggerStatement() *DebuggerStatement { + return n.data.(*DebuggerStatement) +} + +func (n *Node) AsEmptyStatement() *EmptyStatement { + return n.data.(*EmptyStatement) +} + +func (n *Node) AsEnumDeclaration() *EnumDeclaration { + return n.data.(*EnumDeclaration) +} + +func (n *Node) AsNotEmittedStatement() *NotEmittedStatement { + return n.data.(*NotEmittedStatement) +} + +func (n *Node) AsNotEmittedTypeElement() *NotEmittedTypeElement { + return n.data.(*NotEmittedTypeElement) +} + +func (n *Node) AsJSDoc() *JSDoc { + return n.data.(*JSDoc) +} + +func (n *Node) AsJSDocTagBase() *JSDocTagBase { + return n.data.(*JSDocTagBase) +} + +func (n *Node) AsJSDocCommentBase() *JSDocCommentBase { + return n.data.(*JSDocCommentBase) +} + +func (n *Node) AsJSDocText() *JSDocText { + return n.data.(*JSDocText) +} + +func (n *Node) AsJSDocLink() *JSDocLink { + return n.data.(*JSDocLink) +} + +func (n *Node) AsJSDocLinkPlain() *JSDocLinkPlain { + return n.data.(*JSDocLinkPlain) +} + +func (n *Node) AsJSDocLinkCode() *JSDocLinkCode { + return n.data.(*JSDocLinkCode) +} + +func (n *Node) AsJSDocTypeExpression() *JSDocTypeExpression { + return n.data.(*JSDocTypeExpression) +} + +func (n *Node) AsJSDocNonNullableType() *JSDocNonNullableType { + return n.data.(*JSDocNonNullableType) +} + +func (n *Node) AsJSDocNullableType() *JSDocNullableType { + return n.data.(*JSDocNullableType) +} + +func (n *Node) AsJSDocAllType() *JSDocAllType { + return n.data.(*JSDocAllType) +} + +func (n *Node) AsJSDocVariadicType() *JSDocVariadicType { + return n.data.(*JSDocVariadicType) +} + +func (n *Node) AsJSDocOptionalType() *JSDocOptionalType { + return n.data.(*JSDocOptionalType) +} + +func (n *Node) AsJSDocTypeTag() *JSDocTypeTag { + return n.data.(*JSDocTypeTag) +} + +func (n *Node) AsJSDocUnknownTag() *JSDocUnknownTag { + return n.data.(*JSDocUnknownTag) +} + +func (n *Node) AsJSDocTemplateTag() *JSDocTemplateTag { + return n.data.(*JSDocTemplateTag) +} + +func (n *Node) AsJSDocParameterOrPropertyTag() *JSDocParameterOrPropertyTag { + return n.data.(*JSDocParameterOrPropertyTag) +} + +func (n *Node) AsJSDocReturnTag() *JSDocReturnTag { + return n.data.(*JSDocReturnTag) +} + +func (n *Node) AsJSDocPublicTag() *JSDocPublicTag { + return n.data.(*JSDocPublicTag) +} + +func (n *Node) AsJSDocPrivateTag() *JSDocPrivateTag { + return n.data.(*JSDocPrivateTag) +} + +func (n *Node) AsJSDocProtectedTag() *JSDocProtectedTag { + return n.data.(*JSDocProtectedTag) +} + +func (n *Node) AsJSDocReadonlyTag() *JSDocReadonlyTag { + return n.data.(*JSDocReadonlyTag) +} + +func (n *Node) AsJSDocOverrideTag() *JSDocOverrideTag { + return n.data.(*JSDocOverrideTag) +} + +func (n *Node) AsJSDocDeprecatedTag() *JSDocDeprecatedTag { + return n.data.(*JSDocDeprecatedTag) +} + +func (n *Node) AsJSDocSeeTag() *JSDocSeeTag { + return n.data.(*JSDocSeeTag) +} + +func (n *Node) AsJSDocImplementsTag() *JSDocImplementsTag { + return n.data.(*JSDocImplementsTag) +} + +func (n *Node) AsJSDocAugmentsTag() *JSDocAugmentsTag { + return n.data.(*JSDocAugmentsTag) +} + +func (n *Node) AsJSDocSatisfiesTag() *JSDocSatisfiesTag { + return n.data.(*JSDocSatisfiesTag) +} + +func (n *Node) AsJSDocThisTag() *JSDocThisTag { + return n.data.(*JSDocThisTag) +} + +func (n *Node) AsJSDocImportTag() *JSDocImportTag { + return n.data.(*JSDocImportTag) +} + +func (n *Node) AsJSDocCallbackTag() *JSDocCallbackTag { + return n.data.(*JSDocCallbackTag) +} + +func (n *Node) AsJSDocOverloadTag() *JSDocOverloadTag { + return n.data.(*JSDocOverloadTag) +} + +func (n *Node) AsJSDocTypedefTag() *JSDocTypedefTag { + return n.data.(*JSDocTypedefTag) +} + +func (n *Node) AsJSDocTypeLiteral() *JSDocTypeLiteral { + return n.data.(*JSDocTypeLiteral) +} + +func (n *Node) AsJSDocSignature() *JSDocSignature { + return n.data.(*JSDocSignature) +} + +func (n *Node) AsJSDocNameReference() *JSDocNameReference { + return n.data.(*JSDocNameReference) +} + +func (n *Node) AsNamespaceExport() *NamespaceExport { + return n.data.(*NamespaceExport) +} + +func (n *Node) AsImportAttribute() *ImportAttribute { + return n.data.(*ImportAttribute) +} + +func (n *Node) AsImportAttributes() *ImportAttributes { + return n.data.(*ImportAttributes) +} + +func (n *Node) AsFlowSwitchClauseData() *FlowSwitchClauseData { + return n.data.(*FlowSwitchClauseData) +} + +func (n *Node) AsFlowReduceLabelData() *FlowReduceLabelData { + return n.data.(*FlowReduceLabelData) +} + +func (n *Node) AsSyntheticExpression() *SyntheticExpression { + return n.data.(*SyntheticExpression) +} + +func (n *Node) AsSyntaxList() *SyntaxList { + return n.data.(*SyntaxList) +} + +func (n *Node) AsSyntheticReferenceExpression() *SyntheticReferenceExpression { + return n.data.(*SyntheticReferenceExpression) +} + +// NodeData + +type nodeData interface { + AsNode() *Node + ForEachChild(v Visitor) bool + IterChildren() iter.Seq[*Node] + VisitEachChild(v *NodeVisitor) *Node + Clone(v NodeFactoryCoercible) *Node + Name() *DeclarationName + Modifiers() *ModifierList + setModifiers(modifiers *ModifierList) + FlowNodeData() *FlowNodeBase + DeclarationData() *DeclarationBase + ExportableData() *ExportableBase + LocalsContainerData() *LocalsContainerBase + FunctionLikeData() *FunctionLikeBase + ClassLikeData() *ClassLikeBase + BodyData() *BodyBase + LiteralLikeData() *LiteralLikeBase + TemplateLiteralLikeData() *TemplateLiteralLikeBase + SubtreeFacts() SubtreeFacts + computeSubtreeFacts() SubtreeFacts + subtreeFactsWorker(self nodeData) SubtreeFacts + propagateSubtreeFacts() SubtreeFacts +} + +// NodeDefault + +type NodeDefault struct { + Node +} + +func invert(yield func(v *Node) bool) Visitor { + return func(n *Node) bool { + return !yield(n) + } +} + +func (node *NodeDefault) AsNode() *Node { return &node.Node } +func (node *NodeDefault) ForEachChild(v Visitor) bool { return false } +func (node *NodeDefault) forEachChildIter(yield func(v *Node) bool) { + node.data.ForEachChild(invert(yield)) // `true` is return early for a ts visitor, `false` is return early for a go iterator yield function +} + +func (node *NodeDefault) IterChildren() iter.Seq[*Node] { + return node.forEachChildIter +} +func (node *NodeDefault) VisitEachChild(v *NodeVisitor) *Node { return node.AsNode() } +func (node *NodeDefault) Clone(v NodeFactoryCoercible) *Node { return nil } +func (node *NodeDefault) Name() *DeclarationName { return nil } +func (node *NodeDefault) Modifiers() *ModifierList { return nil } +func (node *NodeDefault) setModifiers(modifiers *ModifierList) {} +func (node *NodeDefault) FlowNodeData() *FlowNodeBase { return nil } +func (node *NodeDefault) DeclarationData() *DeclarationBase { return nil } +func (node *NodeDefault) ExportableData() *ExportableBase { return nil } +func (node *NodeDefault) LocalsContainerData() *LocalsContainerBase { return nil } +func (node *NodeDefault) FunctionLikeData() *FunctionLikeBase { return nil } +func (node *NodeDefault) ClassLikeData() *ClassLikeBase { return nil } +func (node *NodeDefault) BodyData() *BodyBase { return nil } +func (node *NodeDefault) LiteralLikeData() *LiteralLikeBase { return nil } +func (node *NodeDefault) TemplateLiteralLikeData() *TemplateLiteralLikeBase { return nil } +func (node *NodeDefault) SubtreeFacts() SubtreeFacts { + return node.data.subtreeFactsWorker(node.data) +} + +func (node *NodeDefault) subtreeFactsWorker(self nodeData) SubtreeFacts { + // To avoid excessive conditional checks, the default implementation of subtreeFactsWorker directly invokes + // computeSubtreeFacts. More complex nodes should implement CompositeNodeBase, which overrides this + // method to cache the result. `self` is passed along to ensure we lookup `computeSubtreeFacts` on the + // correct type, as `CompositeNodeBase` does not, itself, inherit from `Node`. + return self.computeSubtreeFacts() +} + +func (node *NodeDefault) computeSubtreeFacts() SubtreeFacts { + return SubtreeFactsNone +} + +func (node *NodeDefault) propagateSubtreeFacts() SubtreeFacts { + return node.data.SubtreeFacts() & ^SubtreeExclusionsNode +} + +// NodeBase + +type NodeBase struct { + NodeDefault +} + +// Aliases for Node unions + +type ( + Statement = Node // Node with StatementBase + Declaration = Node // Node with DeclarationBase + Expression = Node // Node with ExpressionBase + TypeNode = Node // Node with TypeNodeBase + TypeElement = Node // Node with TypeElementBase + ClassElement = Node // Node with ClassElementBase + NamedMember = Node // Node with NamedMemberBase + ObjectLiteralElement = Node // Node with ObjectLiteralElementBase + BlockOrExpression = Node // Block | Expression + AccessExpression = Node // PropertyAccessExpression | ElementAccessExpression + DeclarationName = Node // Identifier | PrivateIdentifier | StringLiteral | NumericLiteral | BigIntLiteral | NoSubstitutionTemplateLiteral | ComputedPropertyName | BindingPattern | ElementAccessExpression + ModuleName = Node // Identifier | StringLiteral + ModuleExportName = Node // Identifier | StringLiteral + PropertyName = Node // Identifier | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | ComputedPropertyName | PrivateIdentifier | BigIntLiteral + ModuleBody = Node // ModuleBlock | ModuleDeclaration + ForInitializer = Node // Expression | MissingDeclaration | VariableDeclarationList + ModuleReference = Node // Identifier | QualifiedName | ExternalModuleReference + NamedImportBindings = Node // NamespaceImport | NamedImports + NamedExportBindings = Node // NamespaceExport | NamedExports + MemberName = Node // Identifier | PrivateIdentifier + EntityName = Node // Identifier | QualifiedName + BindingName = Node // Identifier | BindingPattern + ModifierLike = Node // Modifier | Decorator + JsxChild = Node // JsxText | JsxExpression | JsxElement | JsxSelfClosingElement | JsxFragment + JsxAttributeLike = Node // JsxAttribute | JsxSpreadAttribute + JsxAttributeName = Node // Identifier | JsxNamespacedName + JsxAttributeValue = Node // StringLiteral | JsxExpression | JsxElement | JsxSelfClosingElement | JsxFragment + JsxTagNameExpression = Node // IdentifierReference | KeywordExpression | JsxTagNamePropertyAccess | JsxNamespacedName + ClassLikeDeclaration = Node // ClassDeclaration | ClassExpression + AccessorDeclaration = Node // GetAccessorDeclaration | SetAccessorDeclaration + LiteralLikeNode = Node // StringLiteral | NumericLiteral | BigIntLiteral | RegularExpressionLiteral | TemplateLiteralLikeNode | JsxText + LiteralExpression = Node // StringLiteral | NumericLiteral | BigIntLiteral | RegularExpressionLiteral | NoSubstitutionTemplateLiteral + UnionOrIntersectionTypeNode = Node // UnionTypeNode | IntersectionTypeNode + TemplateLiteralLikeNode = Node // TemplateHead | TemplateMiddle | TemplateTail + TemplateMiddleOrTail = Node // TemplateMiddle | TemplateTail + TemplateLiteral = Node // TemplateExpression | NoSubstitutionTemplateLiteral + TypePredicateParameterName = Node // Identifier | ThisTypeNode + ImportAttributeName = Node // Identifier | StringLiteral + LeftHandSideExpression = Node // subset of Expression + JSDocComment = Node // JSDocText | JSDocLink | JSDocLinkCode | JSDocLinkPlain; + JSDocTag = Node // Node with JSDocTagBase + SignatureDeclaration = Node // CallSignatureDeclaration | ConstructSignatureDeclaration | MethodSignature | IndexSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | AccessorDeclaration | FunctionExpression | ArrowFunction; + StringLiteralLike = Node // StringLiteral | NoSubstitutionTemplateLiteral + AnyValidImportOrReExport = Node // (ImportDeclaration | ExportDeclaration | JSDocImportTag) & { moduleSpecifier: StringLiteral } | ImportEqualsDeclaration & { moduleReference: ExternalModuleReference & { expression: StringLiteral }} | RequireOrImportCall | ValidImportTypeNode + ValidImportTypeNode = Node // ImportTypeNode & { argument: LiteralTypeNode & { literal: StringLiteral } } + NumericOrStringLikeLiteral = Node // StringLiteralLike | NumericLiteral + TypeOnlyImportDeclaration = Node // ImportClause | ImportEqualsDeclaration | ImportSpecifier | NamespaceImport with isTypeOnly: true + ObjectLiteralLike = Node // ObjectLiteralExpression | ObjectBindingPattern + ObjectTypeDeclaration = Node // ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode + JsxOpeningLikeElement = Node // JsxOpeningElement | JsxSelfClosingElement + NamedImportsOrExports = Node // NamedImports | NamedExports + BreakOrContinueStatement = Node // BreakStatement | ContinueStatement + CallLikeExpression = Node // CallExpression | NewExpression | TaggedTemplateExpression | Decorator | JsxCallLike | InstanceofExpression +) + +// Aliases for node singletons + +type ( + IdentifierNode = Node + PrivateIdentifierNode = Node + TokenNode = Node + StringLiteralNode = Node + TemplateHeadNode = Node + TemplateMiddleNode = Node + TemplateTailNode = Node + TemplateSpanNode = Node + TemplateLiteralTypeSpanNode = Node + BlockNode = Node + CatchClauseNode = Node + CaseBlockNode = Node + CaseOrDefaultClauseNode = Node + CaseClauseNode = Node + VariableDeclarationNode = Node + VariableDeclarationListNode = Node + BindingElementNode = Node + TypeParameterDeclarationNode = Node + ParameterDeclarationNode = Node + HeritageClauseNode = Node + ExpressionWithTypeArgumentsNode = Node + EnumDeclarationNode = Node + EnumMemberNode = Node + ModuleDeclarationNode = Node + FunctionDeclarationNode = Node + ImportClauseNode = Node + ImportAttributesNode = Node + ImportAttributeNode = Node + ImportSpecifierNode = Node + ExportSpecifierNode = Node + JsxAttributesNode = Node + JsxOpeningElementNode = Node + JsxClosingElementNode = Node + JsxOpeningFragmentNode = Node + JsxClosingFragmentNode = Node + SourceFileNode = Node + PropertyAccessExpressionNode = Node + TypeLiteral = Node + ObjectLiteralExpressionNode = Node + ConstructorDeclarationNode = Node + NamedExportsNode = Node + UnionType = Node + LiteralType = Node + JSDocNode = Node + BindingPatternNode = Node +) + +type ( + StatementList = NodeList // NodeList[*Statement] + CaseClausesList = NodeList // NodeList[*CaseOrDefaultClause] + VariableDeclarationNodeList = NodeList // NodeList[*VariableDeclaration] + BindingElementList = NodeList // NodeList[*BindingElement] + TypeParameterList = NodeList // NodeList[*TypeParameterDeclaration] + ParameterList = NodeList // NodeList[*ParameterDeclaration] + HeritageClauseList = NodeList // NodeList[*HeritageClause] + ClassElementList = NodeList // NodeList[*ClassElement] + TypeElementList = NodeList // NodeList[*TypeElement] + ExpressionWithTypeArgumentsList = NodeList // NodeList[*ExpressionWithTypeArguments] + EnumMemberList = NodeList // NodeList[*EnumMember] + ImportSpecifierList = NodeList // NodeList[*ImportSpecifier] + ExportSpecifierList = NodeList // NodeList[*ExportSpecifier] + TypeArgumentList = NodeList // NodeList[*TypeNode] + ArgumentList = NodeList // NodeList[*Expression] + TemplateSpanList = NodeList // NodeList[*TemplateSpan] + ElementList = NodeList // NodeList[*Expression] + PropertyDefinitionList = NodeList // NodeList[*ObjectLiteralElement] + TypeList = NodeList // NodeList[*TypeNode] + ImportAttributeList = NodeList // NodeList[*ImportAttributeNode] + TemplateLiteralTypeSpanList = NodeList // NodeList[*TemplateLiteralTypeSpan] + JsxChildList = NodeList // NodeList[*JsxChild] + JsxAttributeList = NodeList // NodeList[*JsxAttributeLike] +) + +func IsWriteOnlyAccess(node *Node) bool { + return accessKind(node) == AccessKindWrite +} + +func IsWriteAccess(node *Node) bool { + return accessKind(node) != AccessKindRead +} + +func IsWriteAccessForReference(node *Node) bool { + decl := getDeclarationFromName(node) + return (decl != nil && declarationIsWriteAccess(decl)) || node.Kind == KindDefaultKeyword || IsWriteAccess(node) +} + +func getDeclarationFromName(name *Node) *Declaration { + if name == nil || name.Parent == nil { + return nil + } + parent := name.Parent + switch name.Kind { + case KindStringLiteral, KindNoSubstitutionTemplateLiteral, KindNumericLiteral: + if IsComputedPropertyName(parent) { + return parent.Parent + } + fallthrough + case KindIdentifier: + if IsDeclaration(parent) { + if parent.Name() == name { + return parent + } + return nil + } + if IsQualifiedName(parent) { + tag := parent.Parent + if IsJSDocParameterTag(tag) && tag.Name() == parent { + return tag + } + return nil + } + binExp := parent.Parent + if IsBinaryExpression(binExp) && GetAssignmentDeclarationKind(binExp.AsBinaryExpression()) != JSDeclarationKindNone { + // (binExp.left as BindableStaticNameExpression).symbol || binExp.symbol + leftHasSymbol := false + if binExp.AsBinaryExpression().Left != nil && binExp.AsBinaryExpression().Left.Symbol() != nil { + leftHasSymbol = true + } + if leftHasSymbol || binExp.Symbol() != nil { + if GetNameOfDeclaration(binExp.AsNode()) == name { + return binExp.AsNode() + } + } + } + case KindPrivateIdentifier: + if IsDeclaration(parent) && parent.Name() == name { + return parent + } + } + return nil +} + +func declarationIsWriteAccess(decl *Node) bool { + if decl == nil { + return false + } + // Consider anything in an ambient declaration to be a write access since it may be coming from JS. + if decl.Flags&NodeFlagsAmbient != 0 { + return true + } + + switch decl.Kind { + case KindBinaryExpression, + KindBindingElement, + KindClassDeclaration, + KindClassExpression, + KindDefaultKeyword, + KindEnumDeclaration, + KindEnumMember, + KindExportSpecifier, + KindImportClause, // default import + KindImportEqualsDeclaration, + KindImportSpecifier, + KindInterfaceDeclaration, + KindJSDocCallbackTag, + KindJSDocTypedefTag, + KindJsxAttribute, + KindModuleDeclaration, + KindNamespaceExportDeclaration, + KindNamespaceImport, + KindNamespaceExport, + KindParameter, + KindShorthandPropertyAssignment, + KindTypeAliasDeclaration, + KindTypeParameter: + return true + + case KindPropertyAssignment: + // In `({ x: y } = 0);`, `x` is not a write access. + return !IsArrayLiteralOrObjectLiteralDestructuringPattern(decl.Parent) + + case KindFunctionDeclaration, KindFunctionExpression, KindConstructor, KindMethodDeclaration, KindGetAccessor, KindSetAccessor: + // functions considered write if they provide a value (have a body) + switch decl.Kind { + case KindFunctionDeclaration: + return decl.AsFunctionDeclaration().Body != nil + case KindFunctionExpression: + return decl.AsFunctionExpression().Body != nil + case KindConstructor: + // constructor node stores body on the parent? treat same as others + return decl.AsConstructorDeclaration().Body != nil + case KindMethodDeclaration: + return decl.AsMethodDeclaration().Body != nil + case KindGetAccessor: + return decl.AsGetAccessorDeclaration().Body != nil + case KindSetAccessor: + return decl.AsSetAccessorDeclaration().Body != nil + } + return false + + case KindVariableDeclaration, KindPropertyDeclaration: + // variable/property write if initializer present or is in catch clause + var hasInit bool + switch decl.Kind { + case KindVariableDeclaration: + hasInit = decl.AsVariableDeclaration().Initializer != nil + case KindPropertyDeclaration: + hasInit = decl.AsPropertyDeclaration().Initializer != nil + } + return hasInit || IsCatchClause(decl.Parent) + + case KindMethodSignature, KindPropertySignature, KindJSDocPropertyTag, KindJSDocParameterTag: + return false + + default: + // preserve TS behavior: crash on unexpected kinds + panic("Unhandled case in declarationIsWriteAccess") + } +} + +func IsArrayLiteralOrObjectLiteralDestructuringPattern(node *Node) bool { + if !(IsArrayLiteralExpression(node) || IsObjectLiteralExpression(node)) { + return false + } + parent := node.Parent + // [a,b,c] from: + // [a, b, c] = someExpression; + if IsBinaryExpression(parent) && parent.AsBinaryExpression().Left == node && parent.AsBinaryExpression().OperatorToken.Kind == KindEqualsToken { + return true + } + // [a, b, c] from: + // for([a, b, c] of expression) + if IsForOfStatement(parent) && parent.Initializer() == node { + return true + } + // {x, a: {a, b, c} } = someExpression + if IsPropertyAssignment(parent) { + return IsArrayLiteralOrObjectLiteralDestructuringPattern(parent.Parent) + } + // [a, b, c] of + // [x, [a, b, c] ] = someExpression + return IsArrayLiteralOrObjectLiteralDestructuringPattern(parent) +} + +func accessKind(node *Node) AccessKind { + parent := node.Parent + switch parent.Kind { + case KindParenthesizedExpression: + return accessKind(parent) + case KindPrefixUnaryExpression: + operator := parent.AsPrefixUnaryExpression().Operator + if operator == KindPlusPlusToken || operator == KindMinusMinusToken { + return AccessKindReadWrite + } + return AccessKindRead + case KindPostfixUnaryExpression: + operator := parent.AsPostfixUnaryExpression().Operator + if operator == KindPlusPlusToken || operator == KindMinusMinusToken { + return AccessKindReadWrite + } + return AccessKindRead + case KindBinaryExpression: + if parent.AsBinaryExpression().Left == node { + operator := parent.AsBinaryExpression().OperatorToken + if IsAssignmentOperator(operator.Kind) { + if operator.Kind == KindEqualsToken { + return AccessKindWrite + } + return AccessKindReadWrite + } + } + return AccessKindRead + case KindPropertyAccessExpression: + if parent.AsPropertyAccessExpression().Name() != node { + return AccessKindRead + } + return accessKind(parent) + case KindPropertyAssignment: + parentAccess := accessKind(parent.Parent) + // In `({ x: varname }) = { x: 1 }`, the left `x` is a read, the right `x` is a write. + if node == parent.AsPropertyAssignment().Name() { + return reverseAccessKind(parentAccess) + } + return parentAccess + case KindShorthandPropertyAssignment: + // Assume it's the local variable being accessed, since we don't check public properties for --noUnusedLocals. + if node == parent.AsShorthandPropertyAssignment().ObjectAssignmentInitializer { + return AccessKindRead + } + return accessKind(parent.Parent) + case KindArrayLiteralExpression: + return accessKind(parent) + case KindForInStatement, KindForOfStatement: + if node == parent.AsForInOrOfStatement().Initializer { + return AccessKindWrite + } + return AccessKindRead + } + return AccessKindRead +} + +func reverseAccessKind(a AccessKind) AccessKind { + switch a { + case AccessKindRead: + return AccessKindWrite + case AccessKindWrite: + return AccessKindRead + case AccessKindReadWrite: + return AccessKindReadWrite + } + panic("Unhandled case in reverseAccessKind") +} + +type AccessKind int32 + +const ( + AccessKindRead AccessKind = iota // Only reads from a variable + AccessKindWrite // Only writes to a variable without ever reading it. E.g.: `x=1;`. + AccessKindReadWrite // Reads from and writes to a variable. E.g.: `f(x++);`, `x/=1`. +) + +// DeclarationBase + +type DeclarationBase struct { + Symbol *Symbol // Symbol declared by node (initialized by binding) +} + +func (node *DeclarationBase) DeclarationData() *DeclarationBase { return node } + +func IsDeclarationNode(node *Node) bool { + return node.DeclarationData() != nil +} + +// ExportableBase + +type ExportableBase struct { + LocalSymbol *Symbol // Local symbol declared by node (initialized by binding only for exported nodes) +} + +func (node *ExportableBase) ExportableData() *ExportableBase { return node } + +// ModifiersBase + +type ModifiersBase struct { + modifiers *ModifierList +} + +func (node *ModifiersBase) Modifiers() *ModifierList { return node.modifiers } + +// LocalsContainerBase + +type LocalsContainerBase struct { + Locals SymbolTable // Locals associated with node (initialized by binding) + NextContainer *Node // Next container in declaration order (initialized by binding) +} + +func (node *LocalsContainerBase) LocalsContainerData() *LocalsContainerBase { return node } + +func IsLocalsContainer(node *Node) bool { + return node.LocalsContainerData() != nil +} + +// FunctionLikeBase + +type FunctionLikeBase struct { + LocalsContainerBase + TypeParameters *NodeList // NodeList[*TypeParameterDeclarationNode]. Optional + Parameters *NodeList // NodeList[*ParameterDeclarationNode] + Type *TypeNode // Optional + FullSignature *TypeNode // Type that applies to the whole function; should not be set if Type is set or if Parameters have types set. +} + +func (node *FunctionLikeBase) LocalsContainerData() *LocalsContainerBase { + return &node.LocalsContainerBase +} +func (node *FunctionLikeBase) FunctionLikeData() *FunctionLikeBase { return node } + +// BodyBase + +type BodyBase struct { + AsteriskToken *TokenNode + Body *BlockOrExpression // Optional, can be Expression only in arrow functions + EndFlowNode *FlowNode +} + +func (node *BodyBase) BodyData() *BodyBase { return node } + +// FunctionLikeWithBodyBase + +type FunctionLikeWithBodyBase struct { + FunctionLikeBase + BodyBase +} + +func (node *FunctionLikeWithBodyBase) LocalsContainerData() *LocalsContainerBase { + return &node.LocalsContainerBase +} + +func (node *FunctionLikeWithBodyBase) FunctionLikeData() *FunctionLikeBase { + return &node.FunctionLikeBase +} +func (node *FunctionLikeWithBodyBase) BodyData() *BodyBase { return &node.BodyBase } + +// FlowNodeBase + +type FlowNodeBase struct { + FlowNode *FlowNode +} + +func (node *FlowNodeBase) FlowNodeData() *FlowNodeBase { return node } + +// if you provide nil for file, this code will walk to the root of the tree to find the file +func (node *Node) JSDoc(file *SourceFile) []*Node { + if node.Flags&NodeFlagsHasJSDoc == 0 { + return nil + } + if file == nil { + file = GetSourceFileOfNode(node) + if file == nil { + return nil + } + } + if jsdocs, ok := file.jsdocCache[node]; ok { + return jsdocs + } + return nil +} + +// compositeNodeBase + +// A composite node is a node that contains a complex subtree. This struct is intended to be +// embedded in a node that requires caching for its subtree facts. +type compositeNodeBase struct { + facts atomic.Uint32 // caches the SubtreeFacts for this node and its subtree +} + +func (node *compositeNodeBase) subtreeFactsWorker(self nodeData) SubtreeFacts { + // computeSubtreeFacts() is expected to be idempotent, so races will only impact time, not correctness. + facts := SubtreeFacts(node.facts.Load()) + if facts&SubtreeFactsComputed == 0 { + facts |= self.computeSubtreeFacts() | SubtreeFactsComputed + node.facts.Store(uint32(facts)) + } + return facts &^ SubtreeFactsComputed +} + +func (node *compositeNodeBase) computeSubtreeFacts() SubtreeFacts { + // This method must be implemented by the concrete node type. + panic("not implemented") +} + +// typeSyntaxBase + +// A "type-syntax" node is a node whose subtree may only consist of TypeScript syntax. This struct is intended to be +// embedded in a node that only ever returns `SubtreeContainsTypeScript` for its subtree facts. +type typeSyntaxBase struct{} + +func (node *typeSyntaxBase) computeSubtreeFacts() SubtreeFacts { return SubtreeContainsTypeScript } +func (node *typeSyntaxBase) propagateSubtreeFacts() SubtreeFacts { return SubtreeContainsTypeScript } + +// Token + +type Token struct { + NodeBase +} + +func (f *NodeFactory) NewToken(kind Kind) *Node { + return f.newNode(kind, f.tokenPool.New()) +} + +func (node *Token) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewToken(node.Kind), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *Token) computeSubtreeFacts() SubtreeFacts { + switch node.Kind { + case KindUsingKeyword: + return SubtreeContainsUsing + case KindPublicKeyword, + KindPrivateKeyword, + KindProtectedKeyword, + KindReadonlyKeyword, + KindAbstractKeyword, + KindDeclareKeyword, + KindConstKeyword, + KindAnyKeyword, + KindNumberKeyword, + KindBigIntKeyword, + KindNeverKeyword, + KindObjectKeyword, + KindInKeyword, + KindOutKeyword, + KindOverrideKeyword, + KindStringKeyword, + KindBooleanKeyword, + KindSymbolKeyword, + KindVoidKeyword, + KindUnknownKeyword, + KindUndefinedKeyword, // `undefined` is an Identifier in the expression case. + KindExportKeyword: // `export` is TypeScript syntax in a namespace + return SubtreeContainsTypeScript + case KindAccessorKeyword: + return SubtreeContainsClassFields + case KindAsteriskAsteriskToken, KindAsteriskAsteriskEqualsToken: + return SubtreeContainsExponentiationOperator + case KindQuestionQuestionToken: + return SubtreeContainsNullishCoalescing + case KindQuestionDotToken: + return SubtreeContainsOptionalChaining + case KindQuestionQuestionEqualsToken, KindBarBarEqualsToken, KindAmpersandAmpersandEqualsToken: + return SubtreeContainsLogicalAssignments + } + return SubtreeFactsNone +} + +// Identifier + +type Identifier struct { + ExpressionBase + FlowNodeBase + Text string +} + +func (f *NodeFactory) NewIdentifier(text string) *Node { + data := f.identifierPool.New() + data.Text = text + f.textCount++ + return f.newNode(KindIdentifier, data) +} + +func (node *Identifier) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewIdentifier(node.Text), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *Identifier) SubtreeFacts() SubtreeFacts { + return SubtreeContainsIdentifier +} + +func IsIdentifier(node *Node) bool { + return node.Kind == KindIdentifier +} + +// PrivateIdentifier + +type PrivateIdentifier struct { + ExpressionBase + Text string +} + +func (f *NodeFactory) NewPrivateIdentifier(text string) *Node { + data := &PrivateIdentifier{} + data.Text = text + f.textCount++ + return f.newNode(KindPrivateIdentifier, data) +} + +func (node *PrivateIdentifier) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewPrivateIdentifier(node.Text), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *PrivateIdentifier) computeSubtreeFacts() SubtreeFacts { + return SubtreeContainsClassFields +} + +func IsPrivateIdentifier(node *Node) bool { + return node.Kind == KindPrivateIdentifier +} + +// QualifiedName + +type QualifiedName struct { + NodeBase + FlowNodeBase + compositeNodeBase + Left *EntityName // EntityName + Right *IdentifierNode // IdentifierNode +} + +func (f *NodeFactory) NewQualifiedName(left *EntityName, right *IdentifierNode) *Node { + data := &QualifiedName{} + data.Left = left + data.Right = right + return f.newNode(KindQualifiedName, data) +} + +func (f *NodeFactory) UpdateQualifiedName(node *QualifiedName, left *EntityName, right *IdentifierNode) *Node { + if left != node.Left || right != node.Right { + return updateNode(f.NewQualifiedName(left, right), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *QualifiedName) ForEachChild(v Visitor) bool { + return visit(v, node.Left) || visit(v, node.Right) +} + +func (node *QualifiedName) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateQualifiedName(node, v.visitNode(node.Left), v.visitNode(node.Right)) +} + +func (node *QualifiedName) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewQualifiedName(node.Left, node.Right), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsQualifiedName(node *Node) bool { + return node.Kind == KindQualifiedName +} + +func (node *QualifiedName) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Left) | + propagateSubtreeFacts(node.Right) +} + +// TypeParameterDeclaration + +type TypeParameterDeclaration struct { + NodeBase + DeclarationBase + ModifiersBase + typeSyntaxBase + name *IdentifierNode // IdentifierNode + Constraint *TypeNode // TypeNode. Optional + Expression *Expression // Expression. Optional, for error recovery purposes + DefaultType *TypeNode // TypeNode. Optional +} + +func (f *NodeFactory) NewTypeParameterDeclaration(modifiers *ModifierList, name *IdentifierNode, constraint *TypeNode, defaultType *TypeNode) *Node { + data := f.typeParameterDeclarationPool.New() + data.modifiers = modifiers + data.name = name + data.Constraint = constraint + data.DefaultType = defaultType + return f.newNode(KindTypeParameter, data) +} + +func (f *NodeFactory) UpdateTypeParameterDeclaration(node *TypeParameterDeclaration, modifiers *ModifierList, name *IdentifierNode, constraint *TypeNode, defaultType *TypeNode) *Node { + if modifiers != node.modifiers || name != node.name || constraint != node.Constraint || defaultType != node.DefaultType { + return updateNode(f.NewTypeParameterDeclaration(modifiers, name, constraint, defaultType), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *TypeParameterDeclaration) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.name) || visit(v, node.Constraint) || visit(v, node.Expression) || visit(v, node.DefaultType) +} + +func (node *TypeParameterDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateTypeParameterDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNode(node.Constraint), v.visitNode(node.DefaultType)) +} + +func (node *TypeParameterDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewTypeParameterDeclaration(node.Modifiers(), node.Name(), node.Constraint, node.DefaultType), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *TypeParameterDeclaration) Name() *DeclarationName { + return node.name +} + +func IsTypeParameterDeclaration(node *Node) bool { + return node.Kind == KindTypeParameter +} + +// ComputedPropertyName + +type ComputedPropertyName struct { + NodeBase + compositeNodeBase + Expression *Expression // Expression +} + +func (f *NodeFactory) NewComputedPropertyName(expression *Expression) *Node { + data := &ComputedPropertyName{} + data.Expression = expression + return f.newNode(KindComputedPropertyName, data) +} + +func (f *NodeFactory) UpdateComputedPropertyName(node *ComputedPropertyName, expression *Expression) *Node { + if expression != node.Expression { + return updateNode(f.NewComputedPropertyName(expression), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ComputedPropertyName) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) +} + +func (node *ComputedPropertyName) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateComputedPropertyName(node, v.visitNode(node.Expression)) +} + +func (node *ComputedPropertyName) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewComputedPropertyName(node.Expression), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ComputedPropertyName) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) +} + +func IsComputedPropertyName(node *Node) bool { + return node.Kind == KindComputedPropertyName +} + +// Modifier + +func (f *NodeFactory) NewModifier(kind Kind) *Node { + return f.NewToken(kind) +} + +// Decorator + +type Decorator struct { + NodeBase + compositeNodeBase + Expression *LeftHandSideExpression // LeftHandSideExpression +} + +func (f *NodeFactory) NewDecorator(expression *LeftHandSideExpression) *Node { + data := &Decorator{} + data.Expression = expression + return f.newNode(KindDecorator, data) +} + +func (f *NodeFactory) UpdateDecorator(node *Decorator, expression *Expression) *Node { + if expression != node.Expression { + return updateNode(f.NewDecorator(expression), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *Decorator) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) +} + +func (node *Decorator) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateDecorator(node, v.visitNode(node.Expression)) +} + +func (node *Decorator) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewDecorator(node.Expression), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *Decorator) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | + SubtreeContainsTypeScript | // Decorator metadata + SubtreeContainsDecorators // legacy or ES decorators +} + +func IsDecorator(node *Node) bool { + return node.Kind == KindDecorator +} + +// StatementBase + +type StatementBase struct { + NodeBase + FlowNodeBase +} + +// EmptyStatement + +type EmptyStatement struct { + StatementBase +} + +func (f *NodeFactory) NewEmptyStatement() *Node { + return f.newNode(KindEmptyStatement, &EmptyStatement{}) +} + +func (node *EmptyStatement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewEmptyStatement(), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsEmptyStatement(node *Node) bool { + return node.Kind == KindEmptyStatement +} + +// IfStatement + +type IfStatement struct { + StatementBase + compositeNodeBase + Expression *Expression // Expression + ThenStatement *Statement // Statement + ElseStatement *Statement // Statement. Optional +} + +func (f *NodeFactory) NewIfStatement(expression *Expression, thenStatement *Statement, elseStatement *Statement) *Node { + data := f.ifStatementPool.New() + data.Expression = expression + data.ThenStatement = thenStatement + data.ElseStatement = elseStatement + return f.newNode(KindIfStatement, data) +} + +func (f *NodeFactory) UpdateIfStatement(node *IfStatement, expression *Expression, thenStatement *Statement, elseStatement *Statement) *Node { + if expression != node.Expression || thenStatement != node.ThenStatement || elseStatement != node.ElseStatement { + return updateNode(f.NewIfStatement(expression, thenStatement, elseStatement), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *IfStatement) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) || visit(v, node.ThenStatement) || visit(v, node.ElseStatement) +} + +func (node *IfStatement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateIfStatement(node, v.visitNode(node.Expression), v.visitEmbeddedStatement(node.ThenStatement), v.visitEmbeddedStatement(node.ElseStatement)) +} + +func (node *IfStatement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewIfStatement(node.Expression, node.ThenStatement, node.ElseStatement), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *IfStatement) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | + propagateSubtreeFacts(node.ThenStatement) | + propagateSubtreeFacts(node.ElseStatement) +} + +func IsIfStatement(node *Node) bool { + return node.Kind == KindIfStatement +} + +// DoStatement + +type DoStatement struct { + StatementBase + compositeNodeBase + Statement *Statement // Statement + Expression *Expression // Expression +} + +func (f *NodeFactory) NewDoStatement(statement *Statement, expression *Expression) *Node { + data := &DoStatement{} + data.Statement = statement + data.Expression = expression + return f.newNode(KindDoStatement, data) +} + +func (f *NodeFactory) UpdateDoStatement(node *DoStatement, statement *Statement, expression *Expression) *Node { + if statement != node.Statement || expression != node.Expression { + return updateNode(f.NewDoStatement(statement, expression), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *DoStatement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateDoStatement(node, v.visitIterationBody(node.Statement), v.visitNode(node.Expression)) +} + +func (node *DoStatement) ForEachChild(v Visitor) bool { + return visit(v, node.Statement) || visit(v, node.Expression) +} + +func (node *DoStatement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewDoStatement(node.Statement, node.Expression), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *DoStatement) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Statement) | + propagateSubtreeFacts(node.Expression) +} + +// WhileStatement + +type WhileStatement struct { + StatementBase + compositeNodeBase + Expression *Expression // Expression + Statement *Statement // Statement +} + +func (f *NodeFactory) NewWhileStatement(expression *Expression, statement *Statement) *Node { + data := &WhileStatement{} + data.Expression = expression + data.Statement = statement + return f.newNode(KindWhileStatement, data) +} + +func (f *NodeFactory) UpdateWhileStatement(node *WhileStatement, expression *Expression, statement *Statement) *Node { + if expression != node.Expression || statement != node.Statement { + return updateNode(f.NewWhileStatement(expression, statement), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *WhileStatement) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) || visit(v, node.Statement) +} + +func (node *WhileStatement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateWhileStatement(node, v.visitNode(node.Expression), v.visitIterationBody(node.Statement)) +} + +func (node *WhileStatement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewWhileStatement(node.Expression, node.Statement), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *WhileStatement) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | propagateSubtreeFacts(node.Statement) +} + +// ForStatement + +type ForStatement struct { + StatementBase + LocalsContainerBase + compositeNodeBase + Initializer *ForInitializer // ForInitializer. Optional + Condition *Expression // Expression. Optional + Incrementor *Expression // Expression. Optional + Statement *Statement // Statement +} + +func (f *NodeFactory) NewForStatement(initializer *ForInitializer, condition *Expression, incrementor *Expression, statement *Statement) *Node { + data := &ForStatement{} + data.Initializer = initializer + data.Condition = condition + data.Incrementor = incrementor + data.Statement = statement + return f.newNode(KindForStatement, data) +} + +func (f *NodeFactory) UpdateForStatement(node *ForStatement, initializer *ForInitializer, condition *Expression, incrementor *Expression, statement *Statement) *Node { + if initializer != node.Initializer || condition != node.Condition || incrementor != node.Incrementor || statement != node.Statement { + return updateNode(f.NewForStatement(initializer, condition, incrementor, statement), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ForStatement) ForEachChild(v Visitor) bool { + return visit(v, node.Initializer) || visit(v, node.Condition) || visit(v, node.Incrementor) || visit(v, node.Statement) +} + +func (node *ForStatement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateForStatement(node, v.visitNode(node.Initializer), v.visitNode(node.Condition), v.visitNode(node.Incrementor), v.visitIterationBody(node.Statement)) +} + +func (node *ForStatement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewForStatement(node.Initializer, node.Expression(), node.Incrementor, node.Statement), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ForStatement) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Initializer) | + propagateSubtreeFacts(node.Condition) | + propagateSubtreeFacts(node.Incrementor) | + propagateSubtreeFacts(node.Statement) +} + +func IsForStatement(node *Node) bool { + return node.Kind == KindForStatement +} + +// ForInOrOfStatement + +type ForInOrOfStatement struct { + StatementBase + LocalsContainerBase + compositeNodeBase + AwaitModifier *TokenNode // TokenNode. Optional + Initializer *ForInitializer // ForInitializer + Expression *Expression // Expression + Statement *Statement // Statement +} + +func (f *NodeFactory) NewForInOrOfStatement(kind Kind, awaitModifier *TokenNode, initializer *ForInitializer, expression *Expression, statement *Statement) *Node { + data := &ForInOrOfStatement{} + data.AwaitModifier = awaitModifier + data.Initializer = initializer + data.Expression = expression + data.Statement = statement + return f.newNode(kind, data) +} + +func (f *NodeFactory) UpdateForInOrOfStatement(node *ForInOrOfStatement, awaitModifier *TokenNode, initializer *ForInitializer, expression *Expression, statement *Statement) *Node { + if awaitModifier != node.AwaitModifier || initializer != node.Initializer || expression != node.Expression || statement != node.Statement { + return updateNode(f.NewForInOrOfStatement(node.AsNode().Kind, awaitModifier, initializer, expression, statement), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ForInOrOfStatement) ForEachChild(v Visitor) bool { + return visit(v, node.AwaitModifier) || visit(v, node.Initializer) || visit(v, node.Expression) || visit(v, node.Statement) +} + +func (node *ForInOrOfStatement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateForInOrOfStatement(node, v.visitToken(node.AwaitModifier), v.visitNode(node.Initializer), v.visitNode(node.Expression), v.visitIterationBody(node.Statement)) +} + +func (node *ForInOrOfStatement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewForInOrOfStatement(node.Kind, node.AwaitModifier, node.Initializer, node.Expression, node.Statement), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ForInOrOfStatement) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Initializer) | + propagateSubtreeFacts(node.Expression) | + propagateSubtreeFacts(node.Statement) | + core.IfElse(node.AwaitModifier != nil, SubtreeContainsForAwaitOrAsyncGenerator, SubtreeFactsNone) +} + +func IsForInStatement(node *Node) bool { + return node.Kind == KindForInStatement +} + +func IsForOfStatement(node *Node) bool { + return node.Kind == KindForOfStatement +} + +func IsForInOrOfStatement(node *Node) bool { + return IsForInStatement(node) || IsForOfStatement(node) +} + +// BreakStatement + +type BreakStatement struct { + StatementBase + Label *IdentifierNode // IdentifierNode. Optional +} + +func (f *NodeFactory) NewBreakStatement(label *IdentifierNode) *Node { + data := &BreakStatement{} + data.Label = label + return f.newNode(KindBreakStatement, data) +} + +func (f *NodeFactory) UpdateBreakStatement(node *BreakStatement, label *IdentifierNode) *Node { + if label != node.Label { + return updateNode(f.NewBreakStatement(label), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *BreakStatement) ForEachChild(v Visitor) bool { + return visit(v, node.Label) +} + +func (node *BreakStatement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateBreakStatement(node, v.visitNode(node.Label)) +} + +func (node *BreakStatement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewBreakStatement(node.Label), node.AsNode(), f.AsNodeFactory().hooks) +} + +// ContinueStatement + +type ContinueStatement struct { + StatementBase + Label *IdentifierNode // IdentifierNode. Optional +} + +func (f *NodeFactory) NewContinueStatement(label *IdentifierNode) *Node { + data := &ContinueStatement{} + data.Label = label + return f.newNode(KindContinueStatement, data) +} + +func (f *NodeFactory) UpdateContinueStatement(node *ContinueStatement, label *IdentifierNode) *Node { + if label != node.Label { + return updateNode(f.NewContinueStatement(label), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ContinueStatement) ForEachChild(v Visitor) bool { + return visit(v, node.Label) +} + +func (node *ContinueStatement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateContinueStatement(node, v.visitNode(node.Label)) +} + +func (node *ContinueStatement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewContinueStatement(node.Label), node.AsNode(), f.AsNodeFactory().hooks) +} + +// ReturnStatement + +type ReturnStatement struct { + StatementBase + compositeNodeBase + Expression *Expression // Expression. Optional +} + +func (f *NodeFactory) NewReturnStatement(expression *Expression) *Node { + data := f.returnStatementPool.New() + data.Expression = expression + return f.newNode(KindReturnStatement, data) +} + +func (f *NodeFactory) UpdateReturnStatement(node *ReturnStatement, expression *Expression) *Node { + if expression != node.Expression { + return updateNode(f.NewReturnStatement(expression), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ReturnStatement) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) +} + +func (node *ReturnStatement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateReturnStatement(node, v.visitNode(node.Expression)) +} + +func (node *ReturnStatement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewReturnStatement(node.Expression), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ReturnStatement) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) +} + +func IsReturnStatement(node *Node) bool { + return node.Kind == KindReturnStatement +} + +// WithStatement + +type WithStatement struct { + StatementBase + compositeNodeBase + Expression *Expression // Expression + Statement *Statement // Statement +} + +func (f *NodeFactory) NewWithStatement(expression *Expression, statement *Statement) *Node { + data := &WithStatement{} + data.Expression = expression + data.Statement = statement + return f.newNode(KindWithStatement, data) +} + +func (f *NodeFactory) UpdateWithStatement(node *WithStatement, expression *Expression, statement *Statement) *Node { + if expression != node.Expression || statement != node.Statement { + return updateNode(f.NewWithStatement(expression, statement), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *WithStatement) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) || visit(v, node.Statement) +} + +func (node *WithStatement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateWithStatement(node, v.visitNode(node.Expression), v.visitEmbeddedStatement(node.Statement)) +} + +func (node *WithStatement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewWithStatement(node.Expression, node.Statement), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *WithStatement) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | propagateSubtreeFacts(node.Statement) +} + +// SwitchStatement + +type SwitchStatement struct { + StatementBase + compositeNodeBase + Expression *Expression // Expression + CaseBlock *CaseBlockNode // CaseBlockNode +} + +func (f *NodeFactory) NewSwitchStatement(expression *Expression, caseBlock *CaseBlockNode) *Node { + data := &SwitchStatement{} + data.Expression = expression + data.CaseBlock = caseBlock + return f.newNode(KindSwitchStatement, data) +} + +func (f *NodeFactory) UpdateSwitchStatement(node *SwitchStatement, expression *Expression, caseBlock *CaseBlockNode) *Node { + if expression != node.Expression || caseBlock != node.CaseBlock { + return updateNode(f.NewSwitchStatement(expression, caseBlock), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *SwitchStatement) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) || visit(v, node.CaseBlock) +} + +func (node *SwitchStatement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateSwitchStatement(node, v.visitNode(node.Expression), v.visitNode(node.CaseBlock)) +} + +func (node *SwitchStatement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewSwitchStatement(node.Expression, node.CaseBlock), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *SwitchStatement) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | + propagateSubtreeFacts(node.CaseBlock) +} + +func IsSwitchStatement(node *Node) bool { + return node.Kind == KindSwitchStatement +} + +// CaseBlock + +type CaseBlock struct { + NodeBase + LocalsContainerBase + compositeNodeBase + Clauses *NodeList // NodeList[*CaseOrDefaultClauseNode] +} + +func (f *NodeFactory) NewCaseBlock(clauses *NodeList) *Node { + data := &CaseBlock{} + data.Clauses = clauses + return f.newNode(KindCaseBlock, data) +} + +func (f *NodeFactory) UpdateCaseBlock(node *CaseBlock, clauses *CaseClausesList) *Node { + if clauses != node.Clauses { + return updateNode(f.NewCaseBlock(clauses), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *CaseBlock) ForEachChild(v Visitor) bool { + return visitNodeList(v, node.Clauses) +} + +func (node *CaseBlock) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateCaseBlock(node, v.visitNodes(node.Clauses)) +} + +func (node *CaseBlock) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewCaseBlock(node.Clauses), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *CaseBlock) computeSubtreeFacts() SubtreeFacts { + return propagateNodeListSubtreeFacts(node.Clauses, propagateSubtreeFacts) +} + +// CaseOrDefaultClause + +type CaseOrDefaultClause struct { + NodeBase + compositeNodeBase + Expression *Expression // Expression. nil in default clause + Statements *NodeList // NodeList[*Statement] + FallthroughFlowNode *FlowNode +} + +func (f *NodeFactory) NewCaseOrDefaultClause(kind Kind, expression *Expression, statements *NodeList) *Node { + data := &CaseOrDefaultClause{} + data.Expression = expression + data.Statements = statements + return f.newNode(kind, data) +} + +func (f *NodeFactory) UpdateCaseOrDefaultClause(node *CaseOrDefaultClause, expression *Expression, statements *StatementList) *Node { + if expression != node.Expression || statements != node.Statements { + return updateNode(f.NewCaseOrDefaultClause(node.Kind, expression, statements), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *CaseOrDefaultClause) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) || visitNodeList(v, node.Statements) +} + +func (node *CaseOrDefaultClause) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateCaseOrDefaultClause(node, v.visitNode(node.Expression), v.visitNodes(node.Statements)) +} + +func (node *CaseOrDefaultClause) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewCaseOrDefaultClause(node.Kind, node.Expression, node.Statements), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *CaseOrDefaultClause) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | propagateNodeListSubtreeFacts(node.Statements, propagateSubtreeFacts) +} + +func IsCaseClause(node *Node) bool { + return node.Kind == KindCaseClause +} + +func IsDefaultClause(node *Node) bool { + return node.Kind == KindDefaultClause +} + +// ThrowStatement + +type ThrowStatement struct { + StatementBase + compositeNodeBase + Expression *Expression // Expression +} + +func (f *NodeFactory) NewThrowStatement(expression *Expression) *Node { + data := &ThrowStatement{} + data.Expression = expression + return f.newNode(KindThrowStatement, data) +} + +func (f *NodeFactory) UpdateThrowStatement(node *ThrowStatement, expression *Expression) *Node { + if expression != node.Expression { + return updateNode(f.NewThrowStatement(expression), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ThrowStatement) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) +} + +func (node *ThrowStatement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateThrowStatement(node, v.visitNode(node.Expression)) +} + +func (node *ThrowStatement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewThrowStatement(node.Expression), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ThrowStatement) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) +} + +func IsThrowStatement(node *Node) bool { + return node.Kind == KindThrowStatement +} + +// TryStatement + +type TryStatement struct { + StatementBase + compositeNodeBase + TryBlock *BlockNode // BlockNode + CatchClause *CatchClauseNode // CatchClauseNode. Optional + FinallyBlock *BlockNode // BlockNode. Optional +} + +func (f *NodeFactory) NewTryStatement(tryBlock *BlockNode, catchClause *CatchClauseNode, finallyBlock *BlockNode) *Node { + data := &TryStatement{} + data.TryBlock = tryBlock + data.CatchClause = catchClause + data.FinallyBlock = finallyBlock + return f.newNode(KindTryStatement, data) +} + +func (f *NodeFactory) UpdateTryStatement(node *TryStatement, tryBlock *BlockNode, catchClause *CatchClauseNode, finallyBlock *BlockNode) *Node { + if tryBlock != node.TryBlock || catchClause != node.CatchClause || finallyBlock != node.FinallyBlock { + return updateNode(f.NewTryStatement(tryBlock, catchClause, finallyBlock), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *TryStatement) ForEachChild(v Visitor) bool { + return visit(v, node.TryBlock) || visit(v, node.CatchClause) || visit(v, node.FinallyBlock) +} + +func (node *TryStatement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateTryStatement(node, v.visitNode(node.TryBlock), v.visitNode(node.CatchClause), v.visitNode(node.FinallyBlock)) +} + +func (node *TryStatement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewTryStatement(node.TryBlock, node.CatchClause, node.FinallyBlock), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *TryStatement) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.TryBlock) | + propagateSubtreeFacts(node.CatchClause) | + propagateSubtreeFacts(node.FinallyBlock) +} + +func IsTryStatement(node *Node) bool { + return node.Kind == KindTryStatement +} + +// CatchClause + +type CatchClause struct { + NodeBase + LocalsContainerBase + compositeNodeBase + VariableDeclaration *VariableDeclarationNode // VariableDeclarationNode. Optional + Block *BlockNode // BlockNode +} + +func (f *NodeFactory) NewCatchClause(variableDeclaration *VariableDeclarationNode, block *BlockNode) *Node { + data := &CatchClause{} + data.VariableDeclaration = variableDeclaration + data.Block = block + return f.newNode(KindCatchClause, data) +} + +func (f *NodeFactory) UpdateCatchClause(node *CatchClause, variableDeclaration *VariableDeclarationNode, block *BlockNode) *Node { + if variableDeclaration != node.VariableDeclaration || block != node.Block { + return updateNode(f.NewCatchClause(variableDeclaration, block), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *CatchClause) ForEachChild(v Visitor) bool { + return visit(v, node.VariableDeclaration) || visit(v, node.Block) +} + +func (node *CatchClause) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateCatchClause(node, v.visitNode(node.VariableDeclaration), v.visitNode(node.Block)) +} + +func (node *CatchClause) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewCatchClause(node.VariableDeclaration, node.Block), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *CatchClause) computeSubtreeFacts() SubtreeFacts { + res := propagateSubtreeFacts(node.VariableDeclaration) | + propagateSubtreeFacts(node.Block) + if node.VariableDeclaration == nil { + res |= SubtreeContainsMissingCatchClauseVariable + } + return res +} + +func (node *CatchClause) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsCatchClause +} + +func IsCatchClause(node *Node) bool { + return node.Kind == KindCatchClause +} + +// DebuggerStatement + +type DebuggerStatement struct { + StatementBase +} + +func (f *NodeFactory) NewDebuggerStatement() *Node { + return f.newNode(KindDebuggerStatement, &DebuggerStatement{}) +} + +func (node *DebuggerStatement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewDebuggerStatement(), node.AsNode(), f.AsNodeFactory().hooks) +} + +// LabeledStatement + +type LabeledStatement struct { + StatementBase + Label *IdentifierNode // IdentifierNode + Statement *Statement // Statement +} + +func (f *NodeFactory) NewLabeledStatement(label *IdentifierNode, statement *Statement) *Node { + data := &LabeledStatement{} + data.Label = label + data.Statement = statement + return f.newNode(KindLabeledStatement, data) +} + +func (f *NodeFactory) UpdateLabeledStatement(node *LabeledStatement, label *IdentifierNode, statement *Statement) *Node { + if label != node.Label || statement != node.Statement { + return updateNode(f.NewLabeledStatement(label, statement), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *LabeledStatement) ForEachChild(v Visitor) bool { + return visit(v, node.Label) || visit(v, node.Statement) +} + +func (node *LabeledStatement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateLabeledStatement(node, v.visitNode(node.Label), v.visitEmbeddedStatement(node.Statement)) +} + +func (node *LabeledStatement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewLabeledStatement(node.Label, node.Statement), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *LabeledStatement) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Statement) +} + +func IsLabeledStatement(node *Node) bool { + return node.Kind == KindLabeledStatement +} + +// ExpressionStatement + +type ExpressionStatement struct { + StatementBase + Expression *Expression // Expression +} + +func (f *NodeFactory) NewExpressionStatement(expression *Expression) *Node { + data := f.expressionStatementPool.New() + data.Expression = expression + return f.newNode(KindExpressionStatement, data) +} + +func (f *NodeFactory) UpdateExpressionStatement(node *ExpressionStatement, expression *Expression) *Node { + if expression != node.Expression { + return updateNode(f.NewExpressionStatement(expression), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ExpressionStatement) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) +} + +func (node *ExpressionStatement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateExpressionStatement(node, v.visitNode(node.Expression)) +} + +func (node *ExpressionStatement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewExpressionStatement(node.Expression), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ExpressionStatement) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) +} + +func IsExpressionStatement(node *Node) bool { + return node.Kind == KindExpressionStatement +} + +// Block + +type Block struct { + StatementBase + LocalsContainerBase + compositeNodeBase + Statements *NodeList // NodeList[*Statement] + Multiline bool +} + +func (f *NodeFactory) NewBlock(statements *NodeList, multiline bool) *Node { + data := f.blockPool.New() + data.Statements = statements + data.Multiline = multiline + return f.newNode(KindBlock, data) +} + +func (f *NodeFactory) UpdateBlock(node *Block, statements *StatementList) *Node { + if statements != node.Statements { + return updateNode(f.NewBlock(statements, node.Multiline), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *Block) ForEachChild(v Visitor) bool { + return visitNodeList(v, node.Statements) +} + +func (node *Block) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateBlock(node, v.visitNodes(node.Statements)) +} + +func (node *Block) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewBlock(node.Statements, node.Multiline), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *Block) computeSubtreeFacts() SubtreeFacts { + return propagateNodeListSubtreeFacts(node.Statements, propagateSubtreeFacts) +} + +func IsBlock(node *Node) bool { + return node.Kind == KindBlock +} + +// VariableStatement + +type VariableStatement struct { + StatementBase + ModifiersBase + compositeNodeBase + DeclarationList *VariableDeclarationListNode // VariableDeclarationListNode +} + +func (f *NodeFactory) NewVariableStatement(modifiers *ModifierList, declarationList *VariableDeclarationListNode) *Node { + data := f.variableStatementPool.New() + data.modifiers = modifiers + data.DeclarationList = declarationList + return f.newNode(KindVariableStatement, data) +} + +func (f *NodeFactory) UpdateVariableStatement(node *VariableStatement, modifiers *ModifierList, declarationList *VariableDeclarationListNode) *Node { + if modifiers != node.modifiers || declarationList != node.DeclarationList { + return updateNode(f.NewVariableStatement(modifiers, declarationList), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *VariableStatement) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.DeclarationList) +} + +func (node *VariableStatement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateVariableStatement(node, v.visitModifiers(node.modifiers), v.visitNode(node.DeclarationList)) +} + +func (node *VariableStatement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewVariableStatement(node.Modifiers(), node.DeclarationList), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *VariableStatement) computeSubtreeFacts() SubtreeFacts { + if node.modifiers != nil && node.modifiers.ModifierFlags&ModifierFlagsAmbient != 0 { + return SubtreeContainsTypeScript + } else { + return propagateModifierListSubtreeFacts(node.modifiers) | + propagateSubtreeFacts(node.DeclarationList) + } +} + +func IsVariableStatement(node *Node) bool { + return node.Kind == KindVariableStatement +} + +// VariableDeclaration + +type VariableDeclaration struct { + NodeBase + DeclarationBase + ExportableBase + compositeNodeBase + name *BindingName // BindingName + ExclamationToken *TokenNode // TokenNode. Optional + Type *TypeNode // TypeNode. Optional + Initializer *Expression // Expression. Optional +} + +func (f *NodeFactory) NewVariableDeclaration(name *BindingName, exclamationToken *TokenNode, typeNode *TypeNode, initializer *Expression) *Node { + data := f.variableDeclarationPool.New() + data.name = name + data.ExclamationToken = exclamationToken + data.Type = typeNode + data.Initializer = initializer + return f.newNode(KindVariableDeclaration, data) +} + +func (f *NodeFactory) UpdateVariableDeclaration(node *VariableDeclaration, name *BindingName, exclamationToken *TokenNode, typeNode *TypeNode, initializer *Expression) *Node { + if name != node.name || exclamationToken != node.ExclamationToken || typeNode != node.Type || initializer != node.Initializer { + return updateNode(f.NewVariableDeclaration(name, exclamationToken, typeNode, initializer), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *VariableDeclaration) ForEachChild(v Visitor) bool { + return visit(v, node.name) || visit(v, node.ExclamationToken) || visit(v, node.Type) || visit(v, node.Initializer) +} + +func (node *VariableDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateVariableDeclaration(node, v.visitNode(node.name), v.visitToken(node.ExclamationToken), v.visitNode(node.Type), v.visitNode(node.Initializer)) +} + +func (node *VariableDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewVariableDeclaration(node.Name(), node.ExclamationToken, node.Type, node.Initializer), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *VariableDeclaration) Name() *DeclarationName { + return node.name +} + +func (node *VariableDeclaration) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.name) | + propagateEraseableSyntaxSubtreeFacts(node.ExclamationToken) | + propagateEraseableSyntaxSubtreeFacts(node.Type) | + propagateSubtreeFacts(node.Initializer) +} + +func IsVariableDeclaration(node *Node) bool { + return node.Kind == KindVariableDeclaration +} + +// VariableDeclarationList + +type VariableDeclarationList struct { + NodeBase + compositeNodeBase + Declarations *NodeList // NodeList[*VariableDeclarationNode] +} + +func (f *NodeFactory) NewVariableDeclarationList(flags NodeFlags, declarations *NodeList) *Node { + data := f.variableDeclarationListPool.New() + data.Declarations = declarations + node := f.newNode(KindVariableDeclarationList, data) + node.Flags = flags + return node +} + +func (f *NodeFactory) UpdateVariableDeclarationList(node *VariableDeclarationList, declarations *VariableDeclarationNodeList) *Node { + if declarations != node.Declarations { + return updateNode(f.NewVariableDeclarationList(node.Flags, declarations), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *VariableDeclarationList) ForEachChild(v Visitor) bool { + return visitNodeList(v, node.Declarations) +} + +func (node *VariableDeclarationList) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateVariableDeclarationList(node, v.visitNodes(node.Declarations)) +} + +func (node *VariableDeclarationList) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewVariableDeclarationList(node.Flags, node.Declarations), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *VariableDeclarationList) computeSubtreeFacts() SubtreeFacts { + return propagateNodeListSubtreeFacts(node.Declarations, propagateSubtreeFacts) | + core.IfElse(node.Flags&NodeFlagsUsing != 0, SubtreeContainsUsing, SubtreeFactsNone) +} + +func (node *VariableDeclarationList) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsVariableDeclarationList +} + +func IsVariableDeclarationList(node *Node) bool { + return node.Kind == KindVariableDeclarationList +} + +// BindingPattern (SyntaxBindObjectBindingPattern | KindArrayBindingPattern) + +type BindingPattern struct { + NodeBase + compositeNodeBase + Elements *NodeList // NodeList[*BindingElementNode] +} + +func (f *NodeFactory) NewBindingPattern(kind Kind, elements *NodeList) *Node { + data := &BindingPattern{} + data.Elements = elements + return f.newNode(kind, data) +} + +func (f *NodeFactory) UpdateBindingPattern(node *BindingPattern, elements *BindingElementList) *Node { + if elements != node.Elements { + return updateNode(f.NewBindingPattern(node.Kind, elements), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *BindingPattern) ForEachChild(v Visitor) bool { + return visitNodeList(v, node.Elements) +} + +func (node *BindingPattern) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateBindingPattern(node, v.visitNodes(node.Elements)) +} + +func (node *BindingPattern) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewBindingPattern(node.Kind, node.Elements), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *BindingPattern) computeSubtreeFacts() SubtreeFacts { + switch node.Kind { + case KindObjectBindingPattern: + return propagateNodeListSubtreeFacts(node.Elements, propagateObjectBindingElementSubtreeFacts) + case KindArrayBindingPattern: + return propagateNodeListSubtreeFacts(node.Elements, propagateBindingElementSubtreeFacts) + default: + return SubtreeFactsNone + } +} + +func (node *BindingPattern) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsBindingPattern +} + +func IsObjectBindingPattern(node *Node) bool { + return node.Kind == KindObjectBindingPattern +} + +func IsArrayBindingPattern(node *Node) bool { + return node.Kind == KindArrayBindingPattern +} + +func IsBindingPattern(node *Node) bool { + return node.Kind == KindArrayBindingPattern || node.Kind == KindObjectBindingPattern +} + +// ParameterDeclaration + +type ParameterDeclaration struct { + NodeBase + DeclarationBase + ModifiersBase + compositeNodeBase + DotDotDotToken *TokenNode // TokenNode. Present on rest parameter + name *BindingName // BindingName. Declared parameter name + QuestionToken *TokenNode // TokenNode. Present on optional parameter + Type *TypeNode // TypeNode. Optional + Initializer *Expression // Expression. Optional +} + +func (f *NodeFactory) NewParameterDeclaration(modifiers *ModifierList, dotDotDotToken *TokenNode, name *BindingName, questionToken *TokenNode, typeNode *TypeNode, initializer *Expression) *Node { + data := f.parameterDeclarationPool.New() + data.modifiers = modifiers + data.DotDotDotToken = dotDotDotToken + data.name = name + data.QuestionToken = questionToken + data.Type = typeNode + data.Initializer = initializer + return f.newNode(KindParameter, data) +} + +func (f *NodeFactory) UpdateParameterDeclaration(node *ParameterDeclaration, modifiers *ModifierList, dotDotDotToken *TokenNode, name *BindingName, questionToken *TokenNode, typeNode *TypeNode, initializer *Expression) *Node { + if modifiers != node.modifiers || dotDotDotToken != node.DotDotDotToken || name != node.name || questionToken != node.QuestionToken || typeNode != node.Type || initializer != node.Initializer { + return updateNode(f.NewParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, typeNode, initializer), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ParameterDeclaration) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.DotDotDotToken) || visit(v, node.name) || + visit(v, node.QuestionToken) || visit(v, node.Type) || visit(v, node.Initializer) +} + +func (node *ParameterDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateParameterDeclaration(node, v.visitModifiers(node.modifiers), v.visitToken(node.DotDotDotToken), v.visitNode(node.name), v.visitToken(node.QuestionToken), v.visitNode(node.Type), v.visitNode(node.Initializer)) +} + +func (node *ParameterDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewParameterDeclaration(node.Modifiers(), node.DotDotDotToken, node.Name(), node.QuestionToken, node.Type, node.Initializer), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ParameterDeclaration) computeSubtreeFacts() SubtreeFacts { + if node.name != nil && IsThisIdentifier(node.name) { + return SubtreeContainsTypeScript + } else { + return propagateModifierListSubtreeFacts(node.modifiers) | + propagateSubtreeFacts(node.name) | + propagateEraseableSyntaxSubtreeFacts(node.QuestionToken) | + propagateEraseableSyntaxSubtreeFacts(node.Type) | + propagateSubtreeFacts(node.Initializer) + } +} + +func (node *ParameterDeclaration) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsParameter +} + +func (node *ParameterDeclaration) Name() *DeclarationName { + return node.name +} + +func IsParameter(node *Node) bool { + return node.Kind == KindParameter +} + +// BindingElement + +type BindingElement struct { + NodeBase + DeclarationBase + ExportableBase + FlowNodeBase + compositeNodeBase + DotDotDotToken *TokenNode // TokenNode. Present on rest element (in object binding pattern) + PropertyName *PropertyName // PropertyName. Optional binding property name in object binding pattern + name *BindingName // BindingName. Optional (nil for missing element) + Initializer *Expression // Expression. Optional +} + +func (f *NodeFactory) NewBindingElement(dotDotDotToken *TokenNode, propertyName *PropertyName, name *BindingName, initializer *Expression) *Node { + data := &BindingElement{} + data.DotDotDotToken = dotDotDotToken + data.PropertyName = propertyName + data.name = name + data.Initializer = initializer + return f.newNode(KindBindingElement, data) +} + +func (f *NodeFactory) UpdateBindingElement(node *BindingElement, dotDotDotToken *TokenNode, propertyName *PropertyName, name *BindingName, initializer *Expression) *Node { + if dotDotDotToken != node.DotDotDotToken || propertyName != node.PropertyName || name != node.name || initializer != node.Initializer { + return updateNode(f.NewBindingElement(dotDotDotToken, propertyName, name, initializer), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *BindingElement) ForEachChild(v Visitor) bool { + return visit(v, node.DotDotDotToken) || visit(v, node.PropertyName) || visit(v, node.name) || visit(v, node.Initializer) +} + +func (node *BindingElement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateBindingElement(node, v.visitToken(node.DotDotDotToken), v.visitNode(node.PropertyName), v.visitNode(node.name), v.visitNode(node.Initializer)) +} + +func (node *BindingElement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewBindingElement(node.DotDotDotToken, node.PropertyName, node.Name(), node.Initializer), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *BindingElement) Name() *DeclarationName { + return node.name +} + +func (node *BindingElement) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.PropertyName) | + propagateSubtreeFacts(node.name) | + propagateSubtreeFacts(node.Initializer) | + core.IfElse(node.DotDotDotToken != nil, SubtreeContainsRestOrSpread, SubtreeFactsNone) +} + +func IsBindingElement(node *Node) bool { + return node.Kind == KindBindingElement +} + +// MissingDeclaration + +type MissingDeclaration struct { + StatementBase + DeclarationBase + ModifiersBase +} + +func (f *NodeFactory) NewMissingDeclaration(modifiers *ModifierList) *Node { + data := &MissingDeclaration{} + data.modifiers = modifiers + return f.newNode(KindMissingDeclaration, data) +} + +func (f *NodeFactory) UpdateMissingDeclaration(node *MissingDeclaration, modifiers *ModifierList) *Node { + if modifiers != node.modifiers { + return updateNode(f.NewMissingDeclaration(modifiers), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *MissingDeclaration) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) +} + +func (node *MissingDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateMissingDeclaration(node, v.visitModifiers(node.modifiers)) +} + +func (node *MissingDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewMissingDeclaration(node.Modifiers()), node.AsNode(), f.AsNodeFactory().hooks) +} + +// FunctionDeclaration + +type FunctionDeclaration struct { + StatementBase + DeclarationBase + ExportableBase + ModifiersBase + FunctionLikeWithBodyBase + compositeNodeBase + name *IdentifierNode // IdentifierNode + ReturnFlowNode *FlowNode +} + +func (f *NodeFactory) NewFunctionDeclaration(modifiers *ModifierList, asteriskToken *TokenNode, name *IdentifierNode, typeParameters *NodeList, parameters *NodeList, returnType *TypeNode, fullSignature *TypeNode, body *BlockNode) *Node { + data := f.functionDeclarationPool.New() + data.modifiers = modifiers + data.AsteriskToken = asteriskToken + data.name = name + data.TypeParameters = typeParameters + data.Parameters = parameters + data.Type = returnType + data.FullSignature = fullSignature + data.Body = body + return f.newNode(KindFunctionDeclaration, data) +} + +func (f *NodeFactory) UpdateFunctionDeclaration(node *FunctionDeclaration, modifiers *ModifierList, asteriskToken *TokenNode, name *IdentifierNode, typeParameters *TypeParameterList, parameters *ParameterList, returnType *TypeNode, fullSignature *TypeNode, body *BlockNode) *Node { + if modifiers != node.modifiers || asteriskToken != node.AsteriskToken || name != node.name || typeParameters != node.TypeParameters || parameters != node.Parameters || returnType != node.Type || fullSignature != node.FullSignature || body != node.Body { + return updateNode(f.NewFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, returnType, fullSignature, body), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *FunctionDeclaration) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.AsteriskToken) || visit(v, node.name) || visitNodeList(v, node.TypeParameters) || + visitNodeList(v, node.Parameters) || visit(v, node.Type) || visit(v, node.FullSignature) || visit(v, node.Body) +} + +func (node *FunctionDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateFunctionDeclaration(node, v.visitModifiers(node.modifiers), v.visitToken(node.AsteriskToken), v.visitNode(node.name), v.visitNodes(node.TypeParameters), v.visitParameters(node.Parameters), v.visitNode(node.Type), v.visitNode(node.FullSignature), v.visitFunctionBody(node.Body)) +} + +func (node *FunctionDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewFunctionDeclaration(node.Modifiers(), node.AsteriskToken, node.Name(), node.TypeParameters, node.Parameters, node.Type, node.FullSignature, node.Body), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *FunctionDeclaration) Name() *DeclarationName { + return node.name +} + +func (node *FunctionDeclaration) computeSubtreeFacts() SubtreeFacts { + if node.Body == nil || node.ModifierFlags()&ModifierFlagsAmbient != 0 { + return SubtreeContainsTypeScript + } else { + isAsync := node.ModifierFlags()&ModifierFlagsAsync != 0 + isGenerator := node.AsteriskToken != nil + return propagateModifierListSubtreeFacts(node.modifiers) | + propagateSubtreeFacts(node.AsteriskToken) | + propagateSubtreeFacts(node.name) | + propagateEraseableSyntaxListSubtreeFacts(node.TypeParameters) | + propagateNodeListSubtreeFacts(node.Parameters, propagateSubtreeFacts) | + propagateEraseableSyntaxSubtreeFacts(node.Type) | + propagateEraseableSyntaxSubtreeFacts(node.FullSignature) | + propagateSubtreeFacts(node.Body) | + core.IfElse(isAsync && isGenerator, SubtreeContainsForAwaitOrAsyncGenerator, SubtreeFactsNone) | + core.IfElse(isAsync && !isGenerator, SubtreeContainsAnyAwait, SubtreeFactsNone) + } +} + +func (node *FunctionDeclaration) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsFunction +} + +func IsFunctionDeclaration(node *Node) bool { + return node.Kind == KindFunctionDeclaration +} + +// ClassLikeDeclarationBase + +type ClassLikeBase struct { + DeclarationBase + ExportableBase + ModifiersBase + LocalsContainerBase + compositeNodeBase + name *IdentifierNode // IdentifierNode + TypeParameters *NodeList // NodeList[*TypeParameterDeclarationNode]. Optional + HeritageClauses *NodeList // NodeList[*HeritageClauseNode]. Optional + Members *NodeList // NodeList[*ClassElement] +} + +func (node *ClassLikeBase) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.name) || visitNodeList(v, node.TypeParameters) || + visitNodeList(v, node.HeritageClauses) || visitNodeList(v, node.Members) +} + +func (node *ClassLikeBase) Name() *DeclarationName { return node.name } +func (node *ClassLikeBase) ClassLikeData() *ClassLikeBase { return node } + +func (node *ClassLikeBase) computeSubtreeFacts() SubtreeFacts { + if node.modifiers != nil && node.modifiers.ModifierFlags&ModifierFlagsAmbient != 0 { + return SubtreeContainsTypeScript + } else { + return propagateModifierListSubtreeFacts(node.modifiers) | + propagateSubtreeFacts(node.name) | + propagateEraseableSyntaxListSubtreeFacts(node.TypeParameters) | + propagateNodeListSubtreeFacts(node.HeritageClauses, propagateSubtreeFacts) | + propagateNodeListSubtreeFacts(node.Members, propagateSubtreeFacts) + } +} + +// ClassDeclaration + +type ClassDeclaration struct { + StatementBase + ClassLikeBase +} + +func (f *NodeFactory) NewClassDeclaration(modifiers *ModifierList, name *IdentifierNode, typeParameters *NodeList, heritageClauses *NodeList, members *NodeList) *Node { + data := &ClassDeclaration{} + data.modifiers = modifiers + data.name = name + data.TypeParameters = typeParameters + data.HeritageClauses = heritageClauses + data.Members = members + return f.newNode(KindClassDeclaration, data) +} + +func (f *NodeFactory) UpdateClassDeclaration(node *ClassDeclaration, modifiers *ModifierList, name *IdentifierNode, typeParameters *TypeParameterList, heritageClauses *HeritageClauseList, members *ClassElementList) *Node { + if modifiers != node.modifiers || name != node.name || typeParameters != node.TypeParameters || heritageClauses != node.HeritageClauses || members != node.Members { + return updateNode(f.NewClassDeclaration(modifiers, name, typeParameters, heritageClauses, members), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ClassDeclaration) VisitEachChild(v *NodeVisitor) *Node { + modifiers := v.visitModifiers(node.modifiers) + name := v.visitNode(node.name) + typeParameters := v.visitNodes(node.TypeParameters) + heritageClauses := v.visitNodes(node.HeritageClauses) + if heritageClauses != nil && len(heritageClauses.Nodes) == 0 { + heritageClauses = nil + } + members := v.visitNodes(node.Members) + return v.Factory.UpdateClassDeclaration(node, modifiers, name, typeParameters, heritageClauses, members) +} + +func (node *ClassDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewClassDeclaration(node.Modifiers(), node.Name(), node.TypeParameters, node.HeritageClauses, node.Members), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ClassDeclaration) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsClass +} + +func IsClassDeclaration(node *Node) bool { + return node.Kind == KindClassDeclaration +} + +// ClassExpression + +type ClassExpression struct { + ExpressionBase + ClassLikeBase +} + +func (f *NodeFactory) NewClassExpression(modifiers *ModifierList, name *IdentifierNode, typeParameters *NodeList, heritageClauses *NodeList, members *NodeList) *Node { + data := &ClassExpression{} + data.modifiers = modifiers + data.name = name + data.TypeParameters = typeParameters + data.HeritageClauses = heritageClauses + data.Members = members + return f.newNode(KindClassExpression, data) +} + +func (f *NodeFactory) UpdateClassExpression(node *ClassExpression, modifiers *ModifierList, name *IdentifierNode, typeParameters *TypeParameterList, heritageClauses *HeritageClauseList, members *ClassElementList) *Node { + if modifiers != node.modifiers || name != node.name || typeParameters != node.TypeParameters || heritageClauses != node.HeritageClauses || members != node.Members { + return updateNode(f.NewClassExpression(modifiers, name, typeParameters, heritageClauses, members), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ClassExpression) VisitEachChild(v *NodeVisitor) *Node { + modifiers := v.visitModifiers(node.modifiers) + name := v.visitNode(node.name) + typeParameters := v.visitNodes(node.TypeParameters) + heritageClauses := v.visitNodes(node.HeritageClauses) + if heritageClauses != nil && len(heritageClauses.Nodes) == 0 { + heritageClauses = nil + } + members := v.visitNodes(node.Members) + return v.Factory.UpdateClassExpression(node, modifiers, name, typeParameters, heritageClauses, members) +} + +func (node *ClassExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewClassExpression(node.Modifiers(), node.Name(), node.TypeParameters, node.HeritageClauses, node.Members), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ClassExpression) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsClass +} + +func IsClassExpression(node *Node) bool { + return node.Kind == KindClassExpression +} + +// HeritageClause + +type HeritageClause struct { + NodeBase + compositeNodeBase + Token Kind + Types *NodeList // NodeList[*ExpressionWithTypeArgumentsNode] +} + +func (f *NodeFactory) NewHeritageClause(token Kind, types *NodeList) *Node { + data := f.heritageClausePool.New() + data.Token = token + data.Types = types + return f.newNode(KindHeritageClause, data) +} + +func (f *NodeFactory) UpdateHeritageClause(node *HeritageClause, types *ExpressionWithTypeArgumentsList) *Node { + if types != node.Types { + return updateNode(f.NewHeritageClause(node.Token, types), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *HeritageClause) ForEachChild(v Visitor) bool { + return visitNodeList(v, node.Types) +} + +func (node *HeritageClause) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateHeritageClause(node, v.visitNodes(node.Types)) +} + +func (node *HeritageClause) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewHeritageClause(node.Kind, node.Types), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *HeritageClause) computeSubtreeFacts() SubtreeFacts { + switch node.Token { + case KindExtendsKeyword: + return propagateNodeListSubtreeFacts(node.Types, propagateSubtreeFacts) + case KindImplementsKeyword: + return SubtreeContainsTypeScript + default: + return SubtreeFactsNone + } +} + +func IsHeritageClause(node *Node) bool { + return node.Kind == KindHeritageClause +} + +// InterfaceDeclaration + +type InterfaceDeclaration struct { + StatementBase + DeclarationBase + ExportableBase + ModifiersBase + typeSyntaxBase + name *IdentifierNode + TypeParameters *NodeList // NodeList[*TypeParameterDeclarationNode]. Optional + HeritageClauses *NodeList // NodeList[*HeritageClauseNode]. Optional + Members *NodeList // NodeList[*TypeElement] +} + +func (f *NodeFactory) NewInterfaceDeclaration(modifiers *ModifierList, name *IdentifierNode, typeParameters *NodeList, heritageClauses *NodeList, members *NodeList) *Node { + data := f.interfaceDeclarationPool.New() + data.modifiers = modifiers + data.name = name + data.TypeParameters = typeParameters + data.HeritageClauses = heritageClauses + data.Members = members + return f.newNode(KindInterfaceDeclaration, data) +} + +func (f *NodeFactory) UpdateInterfaceDeclaration(node *InterfaceDeclaration, modifiers *ModifierList, name *IdentifierNode, typeParameters *TypeParameterList, heritageClauses *HeritageClauseList, members *TypeElementList) *Node { + if modifiers != node.modifiers || name != node.name || typeParameters != node.TypeParameters || heritageClauses != node.HeritageClauses || members != node.Members { + return updateNode(f.NewInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *InterfaceDeclaration) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.name) || visitNodeList(v, node.TypeParameters) || + visitNodeList(v, node.HeritageClauses) || visitNodeList(v, node.Members) +} + +func (node *InterfaceDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateInterfaceDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNodes(node.TypeParameters), v.visitNodes(node.HeritageClauses), v.visitNodes(node.Members)) +} + +func (node *InterfaceDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewInterfaceDeclaration(node.Modifiers(), node.Name(), node.TypeParameters, node.HeritageClauses, node.Members), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *InterfaceDeclaration) Name() *DeclarationName { return node.name } + +func IsInterfaceDeclaration(node *Node) bool { + return node.Kind == KindInterfaceDeclaration +} + +// TypeAliasDeclaration + +type TypeAliasDeclaration struct { + StatementBase + DeclarationBase + ExportableBase + ModifiersBase + LocalsContainerBase + typeSyntaxBase + name *IdentifierNode // IdentifierNode + TypeParameters *NodeList // NodeList[*TypeParameterDeclarationNode]. Optional + Type *TypeNode // TypeNode +} + +func (f *NodeFactory) newTypeAliasOrJSTypeAliasDeclaration(kind Kind, modifiers *ModifierList, name *IdentifierNode, typeParameters *NodeList, typeNode *TypeNode) *Node { + data := f.typeAliasDeclarationPool.New() + data.modifiers = modifiers + data.name = name + data.TypeParameters = typeParameters + data.Type = typeNode + return f.newNode(kind, data) +} + +func (f *NodeFactory) NewTypeAliasDeclaration(modifiers *ModifierList, name *IdentifierNode, typeParameters *NodeList, typeNode *TypeNode) *Node { + return f.newTypeAliasOrJSTypeAliasDeclaration(KindTypeAliasDeclaration, modifiers, name, typeParameters, typeNode) +} + +func (f *NodeFactory) UpdateTypeAliasDeclaration(node *TypeAliasDeclaration, modifiers *ModifierList, name *IdentifierNode, typeParameters *TypeParameterList, typeNode *TypeNode) *Node { + if modifiers != node.modifiers || name != node.name || typeParameters != node.TypeParameters || typeNode != node.Type { + return updateNode(f.newTypeAliasOrJSTypeAliasDeclaration(node.Kind, modifiers, name, typeParameters, typeNode), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *TypeAliasDeclaration) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.name) || visitNodeList(v, node.TypeParameters) || visit(v, node.Type) +} + +func (node *TypeAliasDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateTypeAliasDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNodes(node.TypeParameters), v.visitNode(node.Type)) +} + +func (node *TypeAliasDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().newTypeAliasOrJSTypeAliasDeclaration(node.Kind, node.Modifiers(), node.Name(), node.TypeParameters, node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *TypeAliasDeclaration) Name() *DeclarationName { return node.name } + +func IsTypeAliasDeclaration(node *Node) bool { + return node.Kind == KindTypeAliasDeclaration +} + +func IsTypeOrJSTypeAliasDeclaration(node *Node) bool { + return node.Kind == KindTypeAliasDeclaration || node.Kind == KindJSTypeAliasDeclaration +} + +func (f *NodeFactory) NewJSTypeAliasDeclaration(modifiers *ModifierList, name *IdentifierNode, typeParameters *NodeList, typeNode *TypeNode) *Node { + return f.newTypeAliasOrJSTypeAliasDeclaration(KindJSTypeAliasDeclaration, modifiers, name, typeParameters, typeNode) +} + +func IsJSTypeAliasDeclaration(node *Node) bool { + return node.Kind == KindJSTypeAliasDeclaration +} + +// EnumMember + +type EnumMember struct { + NodeBase + NamedMemberBase + compositeNodeBase + Initializer *Expression // Expression. Optional +} + +func (f *NodeFactory) NewEnumMember(name *PropertyName, initializer *Expression) *Node { + data := &EnumMember{} + data.name = name + data.Initializer = initializer + return f.newNode(KindEnumMember, data) +} + +func (f *NodeFactory) UpdateEnumMember(node *EnumMember, name *PropertyName, initializer *Expression) *Node { + if name != node.name || initializer != node.Initializer { + return updateNode(f.NewEnumMember(name, initializer), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *EnumMember) ForEachChild(v Visitor) bool { + return visit(v, node.name) || visit(v, node.Initializer) +} + +func (node *EnumMember) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateEnumMember(node, v.visitNode(node.name), v.visitNode(node.Initializer)) +} + +func (node *EnumMember) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewEnumMember(node.Name(), node.Initializer), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *EnumMember) Name() *DeclarationName { + return node.name +} + +func (node *EnumMember) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.name) | + propagateSubtreeFacts(node.Initializer) | + SubtreeContainsTypeScript +} + +func IsEnumMember(node *Node) bool { + return node.Kind == KindEnumMember +} + +// EnumDeclaration + +type EnumDeclaration struct { + StatementBase + DeclarationBase + ExportableBase + ModifiersBase + compositeNodeBase + name *IdentifierNode // IdentifierNode + Members *NodeList // NodeList[*EnumMemberNode] +} + +func (f *NodeFactory) NewEnumDeclaration(modifiers *ModifierList, name *IdentifierNode, members *NodeList) *Node { + data := &EnumDeclaration{} + data.modifiers = modifiers + data.name = name + data.Members = members + return f.newNode(KindEnumDeclaration, data) +} + +func (f *NodeFactory) UpdateEnumDeclaration(node *EnumDeclaration, modifiers *ModifierList, name *IdentifierNode, members *EnumMemberList) *Node { + if modifiers != node.modifiers || name != node.name || members != node.Members { + return updateNode(f.NewEnumDeclaration(modifiers, name, members), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *EnumDeclaration) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.name) || visitNodeList(v, node.Members) +} + +func (node *EnumDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateEnumDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNodes(node.Members)) +} + +func (node *EnumDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewEnumDeclaration(node.Modifiers(), node.Name(), node.Members), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *EnumDeclaration) Name() *DeclarationName { + return node.name +} + +func (node *EnumDeclaration) computeSubtreeFacts() SubtreeFacts { + if node.modifiers != nil && node.modifiers.ModifierFlags&ModifierFlagsAmbient != 0 { + return SubtreeContainsTypeScript + } else { + return propagateModifierListSubtreeFacts(node.modifiers) | + propagateSubtreeFacts(node.name) | + propagateNodeListSubtreeFacts(node.Members, propagateSubtreeFacts) | + SubtreeContainsTypeScript + } +} + +func IsEnumDeclaration(node *Node) bool { + return node.Kind == KindEnumDeclaration +} + +// ModuleBlock + +type ModuleBlock struct { + StatementBase + compositeNodeBase + Statements *NodeList // NodeList[*Statement] +} + +func (f *NodeFactory) NewModuleBlock(statements *NodeList) *Node { + data := &ModuleBlock{} + data.Statements = statements + return f.newNode(KindModuleBlock, data) +} + +func (f *NodeFactory) UpdateModuleBlock(node *ModuleBlock, statements *StatementList) *Node { + if statements != node.Statements { + return updateNode(f.NewModuleBlock(statements), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ModuleBlock) ForEachChild(v Visitor) bool { + return visitNodeList(v, node.Statements) +} + +func (node *ModuleBlock) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateModuleBlock(node, v.visitNodes(node.Statements)) +} + +func (node *ModuleBlock) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewModuleBlock(node.Statements), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ModuleBlock) computeSubtreeFacts() SubtreeFacts { + return propagateNodeListSubtreeFacts(node.Statements, propagateSubtreeFacts) +} + +func IsModuleBlock(node *Node) bool { + return node.Kind == KindModuleBlock +} + +// ModuleDeclaration + +type ModuleDeclaration struct { + StatementBase + DeclarationBase + ExportableBase + ModifiersBase + LocalsContainerBase + BodyBase + compositeNodeBase + name *ModuleName // ModuleName + Keyword Kind // KindModuleKeyword, KindNamespaceKeyword, KindGlobalKeyword (global augmentation) +} + +func (f *NodeFactory) NewModuleDeclaration(modifiers *ModifierList, keyword Kind, name *ModuleName, body *ModuleBody) *Node { + data := &ModuleDeclaration{} + data.modifiers = modifiers + data.Keyword = keyword + data.name = name + data.Body = body + node := f.newNode(KindModuleDeclaration, data) + return node +} + +func (f *NodeFactory) UpdateModuleDeclaration(node *ModuleDeclaration, modifiers *ModifierList, keyword Kind, name *ModuleName, body *ModuleBody) *Node { + if modifiers != node.modifiers || keyword != node.Keyword || name != node.name || body != node.Body { + return updateNode(f.NewModuleDeclaration(modifiers, keyword, name, body), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ModuleDeclaration) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.name) || visit(v, node.Body) +} + +func (node *ModuleDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateModuleDeclaration(node, v.visitModifiers(node.modifiers), node.Keyword, v.visitNode(node.name), v.visitNode(node.Body)) +} + +func (node *ModuleDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewModuleDeclaration(node.Modifiers(), node.Keyword, node.Name(), node.Body), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ModuleDeclaration) Name() *DeclarationName { + return node.name +} + +func (node *ModuleDeclaration) computeSubtreeFacts() SubtreeFacts { + if node.ModifierFlags()&ModifierFlagsAmbient != 0 { + return SubtreeContainsTypeScript + } else { + return propagateModifierListSubtreeFacts(node.modifiers) | + propagateSubtreeFacts(node.name) | + propagateSubtreeFacts(node.Body) | + SubtreeContainsTypeScript + } +} + +func (node *ModuleDeclaration) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsModule +} + +func IsModuleDeclaration(node *Node) bool { + return node.Kind == KindModuleDeclaration +} + +// NotEmittedStatement + +// Represents a statement that is elided as part of a transformation to emit comments on a +// not-emitted node. +type NotEmittedStatement struct { + StatementBase +} + +func (f *NodeFactory) NewNotEmittedStatement() *Node { + data := &NotEmittedStatement{} + return newNode(KindNotEmittedStatement, data, f.hooks) +} + +func (node *NotEmittedStatement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewNotEmittedStatement(), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsNotEmittedStatement(node *Node) bool { + return node.Kind == KindNotEmittedStatement +} + +// NotEmittedTypeElement + +// Represents a type element that is elided as part of a transformation to emit comments on a +// not-emitted node. +type NotEmittedTypeElement struct { + NodeBase + TypeElementBase +} + +func (f *NodeFactory) NewNotEmittedTypeElement() *Node { + data := &NotEmittedTypeElement{} + return newNode(KindNotEmittedTypeElement, data, f.hooks) +} + +func (node *NotEmittedTypeElement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewNotEmittedTypeElement(), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsNotEmittedTypeElement(node *Node) bool { + return node.Kind == KindNotEmittedTypeElement +} + +// SyntheticReferenceExpression +// Used by optional chaining transform to shuffle a `this` arg expression between steps of a chain. +// While this does implement the full expected interface of a node, and is used in place of a node in transforms, +// it generally shouldn't be treated or visited like a normal node. + +type SyntheticReferenceExpression struct { + ExpressionBase + Expression *Expression + ThisArg *Expression +} + +func (f *NodeFactory) NewSyntheticReferenceExpression(expr *Expression, thisArg *Expression) *Node { + data := &SyntheticReferenceExpression{Expression: expr, ThisArg: thisArg} + return newNode(KindSyntheticReferenceExpression, data, f.hooks) +} + +func (f *NodeFactory) UpdateSyntheticReferenceExpression(node *SyntheticReferenceExpression, expr *Expression, thisArg *Expression) *Node { + if expr != node.Expression || thisArg != node.ThisArg { + return updateNode(f.NewSyntheticReferenceExpression(expr, thisArg), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *SyntheticReferenceExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) +} + +func (node *SyntheticReferenceExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateSyntheticReferenceExpression(node, v.visitNode(node.Expression), node.ThisArg) +} + +func (node *SyntheticReferenceExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewSyntheticReferenceExpression(node.Expression, node.ThisArg), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *SyntheticReferenceExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) +} + +func (node *SyntheticReferenceExpression) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() +} + +func IsSyntheticReferenceExpression(node *Node) bool { + return node.Kind == KindSyntheticReferenceExpression +} + +// ImportEqualsDeclaration + +type ImportEqualsDeclaration struct { + StatementBase + DeclarationBase + ExportableBase + ModifiersBase + compositeNodeBase + IsTypeOnly bool + name *IdentifierNode // IdentifierNode + // 'EntityName' for an internal module reference, 'ExternalModuleReference' for an external + // module reference. + ModuleReference *ModuleReference // ModuleReference +} + +func (f *NodeFactory) NewImportEqualsDeclaration(modifiers *ModifierList, isTypeOnly bool, name *IdentifierNode, moduleReference *ModuleReference) *Node { + data := &ImportEqualsDeclaration{} + data.modifiers = modifiers + data.IsTypeOnly = isTypeOnly + data.name = name + data.ModuleReference = moduleReference + return f.newNode(KindImportEqualsDeclaration, data) +} + +func (f *NodeFactory) UpdateImportEqualsDeclaration(node *ImportEqualsDeclaration, modifiers *ModifierList, isTypeOnly bool, name *IdentifierNode, moduleReference *ModuleReference) *Node { + if modifiers != node.modifiers || isTypeOnly != node.IsTypeOnly || name != node.name || moduleReference != node.ModuleReference { + return updateNode(f.NewImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ImportEqualsDeclaration) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.name) || visit(v, node.ModuleReference) +} + +func (node *ImportEqualsDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateImportEqualsDeclaration(node, v.visitModifiers(node.modifiers), node.IsTypeOnly, v.visitNode(node.name), v.visitNode(node.ModuleReference)) +} + +func (node *ImportEqualsDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewImportEqualsDeclaration(node.Modifiers(), node.IsTypeOnly, node.Name(), node.ModuleReference), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ImportEqualsDeclaration) Name() *DeclarationName { + return node.name +} + +func (node *ImportEqualsDeclaration) computeSubtreeFacts() SubtreeFacts { + if node.IsTypeOnly || !IsExternalModuleReference(node.ModuleReference) { + return SubtreeContainsTypeScript + } else { + return propagateModifierListSubtreeFacts(node.modifiers) | + propagateSubtreeFacts(node.name) | + propagateSubtreeFacts(node.ModuleReference) + } +} + +func IsImportEqualsDeclaration(node *Node) bool { + return node.Kind == KindImportEqualsDeclaration +} + +// ImportDeclaration + +type ImportDeclaration struct { + StatementBase + ModifiersBase + compositeNodeBase + ImportClause *ImportClauseNode // ImportClauseNode. Optional + ModuleSpecifier *Expression // Expression + Attributes *ImportAttributesNode // ImportAttributesNode. Optional +} + +func (f *NodeFactory) newImportOrJSImportDeclaration(kind Kind, modifiers *ModifierList, importClause *ImportClauseNode, moduleSpecifier *Expression, attributes *ImportAttributesNode) *Node { + data := &ImportDeclaration{} + data.modifiers = modifiers + data.ImportClause = importClause + data.ModuleSpecifier = moduleSpecifier + data.Attributes = attributes + return f.newNode(kind, data) +} + +func (f *NodeFactory) NewImportDeclaration(modifiers *ModifierList, importClause *ImportClauseNode, moduleSpecifier *Expression, attributes *ImportAttributesNode) *Node { + return f.newImportOrJSImportDeclaration(KindImportDeclaration, modifiers, importClause, moduleSpecifier, attributes) +} + +func (f *NodeFactory) NewJSImportDeclaration(modifiers *ModifierList, importClause *ImportClauseNode, moduleSpecifier *Expression, attributes *ImportAttributesNode) *Node { + return f.newImportOrJSImportDeclaration(KindJSImportDeclaration, modifiers, importClause, moduleSpecifier, attributes) +} + +func (f *NodeFactory) UpdateImportDeclaration(node *ImportDeclaration, modifiers *ModifierList, importClause *ImportClauseNode, moduleSpecifier *Expression, attributes *ImportAttributesNode) *Node { + if modifiers != node.modifiers || importClause != node.ImportClause || moduleSpecifier != node.ModuleSpecifier || attributes != node.Attributes { + return updateNode(f.newImportOrJSImportDeclaration(node.Kind, modifiers, importClause, moduleSpecifier, attributes), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ImportDeclaration) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.ImportClause) || visit(v, node.ModuleSpecifier) || visit(v, node.Attributes) +} + +func (node *ImportDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateImportDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.ImportClause), v.visitNode(node.ModuleSpecifier), v.visitNode(node.Attributes)) +} + +func (node *ImportDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().newImportOrJSImportDeclaration(node.Kind, node.Modifiers(), node.ImportClause, node.ModuleSpecifier, node.Attributes), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ImportDeclaration) computeSubtreeFacts() SubtreeFacts { + return propagateModifierListSubtreeFacts(node.modifiers) | + propagateSubtreeFacts(node.ImportClause) | + propagateSubtreeFacts(node.ModuleSpecifier) | + propagateSubtreeFacts(node.Attributes) +} + +func IsImportDeclaration(node *Node) bool { + return node.Kind == KindImportDeclaration +} + +func IsImportDeclarationOrJSImportDeclaration(node *Node) bool { + return node.Kind == KindImportDeclaration || node.Kind == KindJSImportDeclaration +} + +// ImportSpecifier + +type ImportSpecifier struct { + NodeBase + DeclarationBase + ExportableBase + compositeNodeBase + IsTypeOnly bool + PropertyName *ModuleExportName // ModuleExportName. Optional + name *IdentifierNode // IdentifierNode +} + +func (f *NodeFactory) NewImportSpecifier(isTypeOnly bool, propertyName *ModuleExportName, name *IdentifierNode) *Node { + data := f.importSpecifierPool.New() + data.IsTypeOnly = isTypeOnly + data.PropertyName = propertyName + data.name = name + return f.newNode(KindImportSpecifier, data) +} + +func (f *NodeFactory) UpdateImportSpecifier(node *ImportSpecifier, isTypeOnly bool, propertyName *ModuleExportName, name *IdentifierNode) *Node { + if isTypeOnly != node.IsTypeOnly || propertyName != node.PropertyName || name != node.name { + return updateNode(f.NewImportSpecifier(isTypeOnly, propertyName, name), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ImportSpecifier) ForEachChild(v Visitor) bool { + return visit(v, node.PropertyName) || visit(v, node.name) +} + +func (node *ImportSpecifier) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateImportSpecifier(node, node.IsTypeOnly, v.visitNode(node.PropertyName), v.visitNode(node.name)) +} + +func (node *ImportSpecifier) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewImportSpecifier(node.IsTypeOnly, node.PropertyName, node.Name()), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ImportSpecifier) Name() *DeclarationName { + return node.name +} + +func (node *ImportSpecifier) computeSubtreeFacts() SubtreeFacts { + if node.IsTypeOnly { + return SubtreeContainsTypeScript + } else { + return propagateSubtreeFacts(node.PropertyName) | + propagateSubtreeFacts(node.name) + } +} + +func IsImportSpecifier(node *Node) bool { + return node.Kind == KindImportSpecifier +} + +// ExternalModuleReference + +type ExternalModuleReference struct { + NodeBase + Expression *Expression // Expression +} + +func (f *NodeFactory) NewExternalModuleReference(expression *Expression) *Node { + data := &ExternalModuleReference{} + data.Expression = expression + return f.newNode(KindExternalModuleReference, data) +} + +func (f *NodeFactory) UpdateExternalModuleReference(node *ExternalModuleReference, expression *Expression) *Node { + if expression != node.Expression { + return updateNode(f.NewExternalModuleReference(expression), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ExternalModuleReference) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) +} + +func (node *ExternalModuleReference) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateExternalModuleReference(node, v.visitNode(node.Expression)) +} + +func (node *ExternalModuleReference) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewExternalModuleReference(node.Expression), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ExternalModuleReference) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) +} + +func IsExternalModuleReference(node *Node) bool { + return node.Kind == KindExternalModuleReference +} + +// ImportClause + +type ImportClause struct { + NodeBase + DeclarationBase + ExportableBase + compositeNodeBase + PhaseModifier Kind // KindTypeKeyword | KindDeferKeyword + NamedBindings *NamedImportBindings // NamedImportBindings. Optional, named bindings + name *IdentifierNode // IdentifierNode. Optional, default binding +} + +func (f *NodeFactory) NewImportClause(phaseModifier Kind, name *IdentifierNode, namedBindings *NamedImportBindings) *Node { + data := &ImportClause{} + data.PhaseModifier = phaseModifier + data.name = name + data.NamedBindings = namedBindings + return f.newNode(KindImportClause, data) +} + +func (f *NodeFactory) UpdateImportClause(node *ImportClause, phaseModifier Kind, name *IdentifierNode, namedBindings *NamedImportBindings) *Node { + if phaseModifier != node.PhaseModifier || name != node.name || namedBindings != node.NamedBindings { + return updateNode(f.NewImportClause(phaseModifier, name, namedBindings), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ImportClause) ForEachChild(v Visitor) bool { + return visit(v, node.name) || visit(v, node.NamedBindings) +} + +func (node *ImportClause) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateImportClause(node, node.PhaseModifier, v.visitNode(node.name), v.visitNode(node.NamedBindings)) +} + +func (node *ImportClause) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewImportClause(node.PhaseModifier, node.Name(), node.NamedBindings), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ImportClause) Name() *DeclarationName { + return node.name +} + +func (node *ImportClause) computeSubtreeFacts() SubtreeFacts { + if node.PhaseModifier == KindTypeKeyword { + return SubtreeContainsTypeScript + } else { + return propagateSubtreeFacts(node.name) | + propagateSubtreeFacts(node.NamedBindings) + } +} + +func IsImportClause(node *Node) bool { + return node.Kind == KindImportClause +} + +// NamespaceImport + +type NamespaceImport struct { + NodeBase + DeclarationBase + ExportableBase + name *IdentifierNode // IdentifierNode +} + +func (f *NodeFactory) NewNamespaceImport(name *IdentifierNode) *Node { + data := &NamespaceImport{} + data.name = name + return f.newNode(KindNamespaceImport, data) +} + +func (f *NodeFactory) UpdateNamespaceImport(node *NamespaceImport, name *IdentifierNode) *Node { + if name != node.name { + return updateNode(f.NewNamespaceImport(name), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *NamespaceImport) ForEachChild(v Visitor) bool { + return visit(v, node.name) +} + +func (node *NamespaceImport) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateNamespaceImport(node, v.visitNode(node.name)) +} + +func (node *NamespaceImport) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewNamespaceImport(node.Name()), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *NamespaceImport) Name() *DeclarationName { + return node.name +} + +func (node *NamespaceImport) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.name) +} + +func IsNamespaceImport(node *Node) bool { + return node.Kind == KindNamespaceImport +} + +// NamedImports + +type NamedImports struct { + NodeBase + compositeNodeBase + Elements *ImportSpecifierList // NodeList[*ImportSpecifierNode] +} + +func (f *NodeFactory) NewNamedImports(elements *ImportSpecifierList) *Node { + data := &NamedImports{} + data.Elements = elements + return f.newNode(KindNamedImports, data) +} + +func (f *NodeFactory) UpdateNamedImports(node *NamedImports, elements *ImportSpecifierList) *Node { + if elements != node.Elements { + return updateNode(f.NewNamedImports(elements), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *NamedImports) ForEachChild(v Visitor) bool { + return visitNodeList(v, node.Elements) +} + +func (node *NamedImports) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateNamedImports(node, v.visitNodes(node.Elements)) +} + +func (node *NamedImports) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewNamedImports(node.Elements), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *NamedImports) computeSubtreeFacts() SubtreeFacts { + return propagateNodeListSubtreeFacts(node.Elements, propagateSubtreeFacts) +} + +func IsNamedImports(node *Node) bool { + return node.Kind == KindNamedImports +} + +// ExportAssignment + +// This is either an `export =` or an `export default` declaration. +// Unless `isExportEquals` is set, this node was parsed as an `export default`. +// If Kind is KindJSExportAssignment, it is a synthetic declaration for `module.exports =`. +type ExportAssignment struct { + StatementBase + DeclarationBase + ModifiersBase + compositeNodeBase + IsExportEquals bool + Type *TypeNode // TypeNode. Only set by JSDoc @type tags. + Expression *Expression // Expression +} + +func (f *NodeFactory) newExportOrJSExportAssignment(kind Kind, modifiers *ModifierList, isExportEquals bool, typeNode *TypeNode, expression *Expression) *Node { + data := &ExportAssignment{} + data.modifiers = modifiers + data.IsExportEquals = isExportEquals + data.Type = typeNode + data.Expression = expression + return f.newNode(kind, data) +} + +func (f *NodeFactory) NewExportAssignment(modifiers *ModifierList, isExportEquals bool, typeNode *TypeNode, expression *Expression) *Node { + return f.newExportOrJSExportAssignment(KindExportAssignment, modifiers, isExportEquals, typeNode, expression) +} + +func (f *NodeFactory) NewJSExportAssignment(t *TypeNode, expression *Expression) *Node { + return f.newExportOrJSExportAssignment(KindJSExportAssignment, nil /*modifiers*/, true, t, expression) +} + +func (f *NodeFactory) UpdateExportAssignment(node *ExportAssignment, modifiers *ModifierList, typeNode *TypeNode, expression *Expression) *Node { + if modifiers != node.modifiers || typeNode != node.Type || expression != node.Expression { + return updateNode(f.newExportOrJSExportAssignment(node.Kind, modifiers, node.IsExportEquals, typeNode, expression), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ExportAssignment) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.Type) || visit(v, node.Expression) +} + +func (node *ExportAssignment) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateExportAssignment(node, v.visitModifiers(node.modifiers), v.visitNode(node.Type), v.visitNode(node.Expression)) +} + +func (node *ExportAssignment) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().newExportOrJSExportAssignment(node.Kind, node.Modifiers(), node.IsExportEquals, node.Type, node.Expression), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ExportAssignment) computeSubtreeFacts() SubtreeFacts { + return propagateModifierListSubtreeFacts(node.modifiers) | propagateSubtreeFacts(node.Type) | propagateSubtreeFacts(node.Expression) +} + +func IsExportAssignment(node *Node) bool { + return node.Kind == KindExportAssignment +} + +func IsJSExportAssignment(node *Node) bool { + return node.Kind == KindJSExportAssignment +} + +func IsAnyExportAssignment(node *Node) bool { + return node.Kind == KindExportAssignment || node.Kind == KindJSExportAssignment +} + +// CommonJSExport + +type CommonJSExport struct { + StatementBase + DeclarationBase + ExportableBase + ModifiersBase + name *IdentifierNode + Type *TypeNode + Initializer *Expression +} + +func (f *NodeFactory) NewCommonJSExport(modifiers *ModifierList, name *IdentifierNode, typeNode *TypeNode, initializer *Expression) *Node { + data := &CommonJSExport{} + data.modifiers = modifiers + data.name = name + data.Type = typeNode + data.Initializer = initializer + return newNode(KindCommonJSExport, data, f.hooks) +} + +func (f *NodeFactory) UpdateCommonJSExport(node *CommonJSExport, modifiers *ModifierList, name *IdentifierNode, typeNode *TypeNode, initializer *Expression) *Node { + if modifiers != node.modifiers || initializer != node.Initializer || name != node.name || typeNode != node.Type { + return updateNode(f.NewCommonJSExport(node.modifiers, name, typeNode, initializer), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *CommonJSExport) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.name) || visit(v, node.Type) || visit(v, node.Initializer) +} + +func (node *CommonJSExport) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateCommonJSExport(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNode(node.Type), v.visitNode(node.Initializer)) +} + +func (node *CommonJSExport) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewCommonJSExport(node.Modifiers(), node.name, node.Type, node.Initializer), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsCommonJSExport(node *Node) bool { + return node.Kind == KindCommonJSExport +} + +func (node *CommonJSExport) Name() *DeclarationName { + return node.name +} + +// NamespaceExportDeclaration + +type NamespaceExportDeclaration struct { + StatementBase + DeclarationBase + ModifiersBase + typeSyntaxBase + name *IdentifierNode // IdentifierNode +} + +func (f *NodeFactory) NewNamespaceExportDeclaration(modifiers *ModifierList, name *IdentifierNode) *Node { + data := &NamespaceExportDeclaration{} + data.modifiers = modifiers + data.name = name + return f.newNode(KindNamespaceExportDeclaration, data) +} + +func (f *NodeFactory) UpdateNamespaceExportDeclaration(node *NamespaceExportDeclaration, modifiers *ModifierList, name *IdentifierNode) *Node { + if modifiers != node.modifiers || name != node.name { + return updateNode(f.NewNamespaceExportDeclaration(modifiers, name), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *NamespaceExportDeclaration) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.name) +} + +func (node *NamespaceExportDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateNamespaceExportDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name)) +} + +func (node *NamespaceExportDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewNamespaceExportDeclaration(node.Modifiers(), node.Name()), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *NamespaceExportDeclaration) Name() *DeclarationName { + return node.name +} + +func IsNamespaceExportDeclaration(node *Node) bool { + return node.Kind == KindNamespaceExportDeclaration +} + +// ExportDeclaration + +type ExportDeclaration struct { + StatementBase + DeclarationBase + ModifiersBase + compositeNodeBase + IsTypeOnly bool + ExportClause *NamedExportBindings // NamedExportBindings. Optional + ModuleSpecifier *Expression // Expression. Optional + Attributes *ImportAttributesNode // ImportAttributesNode. Optional +} + +func (f *NodeFactory) NewExportDeclaration(modifiers *ModifierList, isTypeOnly bool, exportClause *NamedExportBindings, moduleSpecifier *Expression, attributes *ImportAttributesNode) *Node { + data := &ExportDeclaration{} + data.modifiers = modifiers + data.IsTypeOnly = isTypeOnly + data.ExportClause = exportClause + data.ModuleSpecifier = moduleSpecifier + data.Attributes = attributes + return f.newNode(KindExportDeclaration, data) +} + +func (f *NodeFactory) UpdateExportDeclaration(node *ExportDeclaration, modifiers *ModifierList, isTypeOnly bool, exportClause *NamedExportBindings, moduleSpecifier *Expression, attributes *ImportAttributesNode) *Node { + if modifiers != node.modifiers || exportClause != node.ExportClause || moduleSpecifier != node.ModuleSpecifier || attributes != node.Attributes { + return updateNode(f.NewExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, attributes), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ExportDeclaration) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.ExportClause) || visit(v, node.ModuleSpecifier) || visit(v, node.Attributes) +} + +func (node *ExportDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateExportDeclaration(node, v.visitModifiers(node.modifiers), node.IsTypeOnly, v.visitNode(node.ExportClause), v.visitNode(node.ModuleSpecifier), v.visitNode(node.Attributes)) +} + +func (node *ExportDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewExportDeclaration(node.Modifiers(), node.IsTypeOnly, node.ExportClause, node.ModuleSpecifier, node.Attributes), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ExportDeclaration) computeSubtreeFacts() SubtreeFacts { + return propagateModifierListSubtreeFacts(node.modifiers) | + propagateSubtreeFacts(node.ExportClause) | + propagateSubtreeFacts(node.ModuleSpecifier) | + propagateSubtreeFacts(node.Attributes) | + core.IfElse(node.IsTypeOnly, SubtreeContainsTypeScript, SubtreeFactsNone) +} + +func IsExportDeclaration(node *Node) bool { + return node.Kind == KindExportDeclaration +} + +// NamespaceExport + +type NamespaceExport struct { + NodeBase + DeclarationBase + name *ModuleExportName // ModuleExportName +} + +func (f *NodeFactory) NewNamespaceExport(name *ModuleExportName) *Node { + data := &NamespaceExport{} + data.name = name + return f.newNode(KindNamespaceExport, data) +} + +func (f *NodeFactory) UpdateNamespaceExport(node *NamespaceExport, name *ModuleExportName) *Node { + if name != node.name { + return updateNode(f.NewNamespaceExport(name), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *NamespaceExport) ForEachChild(v Visitor) bool { + return visit(v, node.name) +} + +func (node *NamespaceExport) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateNamespaceExport(node, v.visitNode(node.name)) +} + +func (node *NamespaceExport) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewNamespaceExport(node.Name()), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *NamespaceExport) Name() *DeclarationName { + return node.name +} + +func (node *NamespaceExport) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.name) +} + +func IsNamespaceExport(node *Node) bool { + return node.Kind == KindNamespaceExport +} + +// NamedExports + +type NamedExports struct { + NodeBase + compositeNodeBase + Elements *ExportSpecifierList // NodeList[*ExportSpecifierNode] +} + +func (f *NodeFactory) NewNamedExports(elements *NodeList) *Node { + data := &NamedExports{} + data.Elements = elements + return f.newNode(KindNamedExports, data) +} + +func (f *NodeFactory) UpdateNamedExports(node *NamedExports, elements *ExportSpecifierList) *Node { + if elements != node.Elements { + return updateNode(f.NewNamedExports(elements), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *NamedExports) ForEachChild(v Visitor) bool { + return visitNodeList(v, node.Elements) +} + +func (node *NamedExports) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateNamedExports(node, v.visitNodes(node.Elements)) +} + +func (node *NamedExports) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewNamedExports(node.Elements), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *NamedExports) computeSubtreeFacts() SubtreeFacts { + return propagateNodeListSubtreeFacts(node.Elements, propagateSubtreeFacts) +} + +func IsNamedExports(node *Node) bool { + return node.Kind == KindNamedExports +} + +// ExportSpecifier + +type ExportSpecifier struct { + NodeBase + DeclarationBase + ExportableBase + compositeNodeBase + IsTypeOnly bool + PropertyName *ModuleExportName // ModuleExportName. Optional, name preceding 'as' keyword + name *ModuleExportName // ModuleExportName +} + +func (f *NodeFactory) NewExportSpecifier(isTypeOnly bool, propertyName *ModuleExportName, name *ModuleExportName) *Node { + data := &ExportSpecifier{} + data.IsTypeOnly = isTypeOnly + data.PropertyName = propertyName + data.name = name + return f.newNode(KindExportSpecifier, data) +} + +func (f *NodeFactory) UpdateExportSpecifier(node *ExportSpecifier, isTypeOnly bool, propertyName *ModuleExportName, name *ModuleExportName) *Node { + if isTypeOnly != node.IsTypeOnly || propertyName != node.PropertyName || name != node.name { + return updateNode(f.NewExportSpecifier(isTypeOnly, propertyName, name), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ExportSpecifier) ForEachChild(v Visitor) bool { + return visit(v, node.PropertyName) || visit(v, node.name) +} + +func (node *ExportSpecifier) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateExportSpecifier(node, node.IsTypeOnly, v.visitNode(node.PropertyName), v.visitNode(node.name)) +} + +func (node *ExportSpecifier) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewExportSpecifier(node.IsTypeOnly, node.PropertyName, node.Name()), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ExportSpecifier) Name() *DeclarationName { + return node.name +} + +func (node *ExportSpecifier) computeSubtreeFacts() SubtreeFacts { + if node.IsTypeOnly { + return SubtreeContainsTypeScript + } else { + return propagateSubtreeFacts(node.PropertyName) | + propagateSubtreeFacts(node.name) + } +} + +func IsExportSpecifier(node *Node) bool { + return node.Kind == KindExportSpecifier +} + +// TypeElementBase + +type TypeElementBase struct{} + +// ClassElementBase + +type ClassElementBase struct{} + +// NamedMemberBase + +type NamedMemberBase struct { + DeclarationBase + ModifiersBase + name *PropertyName // PropertyName + PostfixToken *TokenNode // TokenNode. Optional +} + +func (node *NamedMemberBase) DeclarationData() *DeclarationBase { return &node.DeclarationBase } +func (node *NamedMemberBase) Modifiers() *ModifierList { return node.modifiers } +func (node *NamedMemberBase) setModifiers(modifiers *ModifierList) { node.modifiers = modifiers } +func (node *NamedMemberBase) Name() *DeclarationName { return node.name } + +// CallSignatureDeclaration + +type CallSignatureDeclaration struct { + NodeBase + DeclarationBase + FunctionLikeBase + TypeElementBase + typeSyntaxBase +} + +func (f *NodeFactory) NewCallSignatureDeclaration(typeParameters *NodeList, parameters *NodeList, returnType *TypeNode) *Node { + data := &CallSignatureDeclaration{} + data.TypeParameters = typeParameters + data.Parameters = parameters + data.Type = returnType + return f.newNode(KindCallSignature, data) +} + +func (f *NodeFactory) UpdateCallSignatureDeclaration(node *CallSignatureDeclaration, typeParameters *TypeParameterList, parameters *ParameterList, returnType *TypeNode) *Node { + if typeParameters != node.TypeParameters || parameters != node.Parameters || returnType != node.Type { + return updateNode(f.NewCallSignatureDeclaration(typeParameters, parameters, returnType), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *CallSignatureDeclaration) ForEachChild(v Visitor) bool { + return visitNodeList(v, node.TypeParameters) || visitNodeList(v, node.Parameters) || visit(v, node.Type) +} + +func (node *CallSignatureDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateCallSignatureDeclaration(node, v.visitNodes(node.TypeParameters), v.visitNodes(node.Parameters), v.visitNode(node.Type)) +} + +func (node *CallSignatureDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewCallSignatureDeclaration(node.TypeParameters, node.Parameters, node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsCallSignatureDeclaration(node *Node) bool { + return node.Kind == KindCallSignature +} + +// ConstructSignatureDeclaration + +type ConstructSignatureDeclaration struct { + NodeBase + DeclarationBase + FunctionLikeBase + TypeElementBase + typeSyntaxBase +} + +func (f *NodeFactory) NewConstructSignatureDeclaration(typeParameters *NodeList, parameters *NodeList, returnType *TypeNode) *Node { + data := f.constructSignatureDeclarationPool.New() + data.TypeParameters = typeParameters + data.Parameters = parameters + data.Type = returnType + return f.newNode(KindConstructSignature, data) +} + +func (f *NodeFactory) UpdateConstructSignatureDeclaration(node *ConstructSignatureDeclaration, typeParameters *TypeParameterList, parameters *ParameterList, returnType *TypeNode) *Node { + if typeParameters != node.TypeParameters || parameters != node.Parameters || returnType != node.Type { + return updateNode(f.NewConstructSignatureDeclaration(typeParameters, parameters, returnType), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ConstructSignatureDeclaration) ForEachChild(v Visitor) bool { + return visitNodeList(v, node.TypeParameters) || visitNodeList(v, node.Parameters) || visit(v, node.Type) +} + +func (node *ConstructSignatureDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateConstructSignatureDeclaration(node, v.visitNodes(node.TypeParameters), v.visitNodes(node.Parameters), v.visitNode(node.Type)) +} + +func (node *ConstructSignatureDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewConstructSignatureDeclaration(node.TypeParameters, node.Parameters, node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsConstructSignatureDeclaration(node *Node) bool { + return node.Kind == KindConstructSignature +} + +// ConstructorDeclaration + +type ConstructorDeclaration struct { + NodeBase + DeclarationBase + ModifiersBase + FunctionLikeWithBodyBase + ClassElementBase + compositeNodeBase + ReturnFlowNode *FlowNode +} + +func (f *NodeFactory) NewConstructorDeclaration(modifiers *ModifierList, typeParameters *NodeList, parameters *NodeList, returnType *TypeNode, fullSignature *TypeNode, body *BlockNode) *Node { + data := &ConstructorDeclaration{} + data.modifiers = modifiers + data.TypeParameters = typeParameters + data.Parameters = parameters + data.Type = returnType + data.FullSignature = fullSignature + data.Body = body + return f.newNode(KindConstructor, data) +} + +func (f *NodeFactory) UpdateConstructorDeclaration(node *ConstructorDeclaration, modifiers *ModifierList, typeParameters *TypeParameterList, parameters *ParameterList, returnType *TypeNode, fullSignature *TypeNode, body *BlockNode) *Node { + if modifiers != node.modifiers || typeParameters != node.TypeParameters || parameters != node.Parameters || returnType != node.Type || fullSignature != node.FullSignature || body != node.Body { + return updateNode(f.NewConstructorDeclaration(modifiers, typeParameters, parameters, returnType, fullSignature, body), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ConstructorDeclaration) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visitNodeList(v, node.TypeParameters) || visitNodeList(v, node.Parameters) || visit(v, node.Type) || visit(v, node.FullSignature) || visit(v, node.Body) +} + +func (node *ConstructorDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateConstructorDeclaration(node, v.visitModifiers(node.modifiers), v.visitNodes(node.TypeParameters), v.visitParameters(node.Parameters), v.visitNode(node.Type), v.visitNode(node.FullSignature), v.visitFunctionBody(node.Body)) +} + +func (node *ConstructorDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewConstructorDeclaration(node.Modifiers(), node.TypeParameters, node.Parameters, node.Type, node.FullSignature, node.Body), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ConstructorDeclaration) computeSubtreeFacts() SubtreeFacts { + if node.Body == nil { + return SubtreeContainsTypeScript + } else { + return propagateModifierListSubtreeFacts(node.modifiers) | + propagateEraseableSyntaxListSubtreeFacts(node.TypeParameters) | + propagateNodeListSubtreeFacts(node.Parameters, propagateSubtreeFacts) | + propagateEraseableSyntaxSubtreeFacts(node.Type) | + propagateEraseableSyntaxSubtreeFacts(node.FullSignature) | + propagateSubtreeFacts(node.Body) + } +} + +func (node *ConstructorDeclaration) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsConstructor +} + +func IsConstructorDeclaration(node *Node) bool { + return node.Kind == KindConstructor +} + +// AccessorDeclarationBase + +type AccessorDeclarationBase struct { + NodeBase + NamedMemberBase + FunctionLikeWithBodyBase + FlowNodeBase + TypeElementBase + ClassElementBase + ObjectLiteralElementBase + compositeNodeBase +} + +func (node *AccessorDeclarationBase) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.name) || visitNodeList(v, node.TypeParameters) || visitNodeList(v, node.Parameters) || + visit(v, node.Type) || visit(v, node.FullSignature) || visit(v, node.Body) +} + +func (node *AccessorDeclarationBase) IsAccessorDeclaration() {} + +func (node *AccessorDeclarationBase) computeSubtreeFacts() SubtreeFacts { + if node.Body == nil { + return SubtreeContainsTypeScript + } else { + return propagateModifierListSubtreeFacts(node.modifiers) | + propagateSubtreeFacts(node.name) | + propagateEraseableSyntaxListSubtreeFacts(node.TypeParameters) | + propagateNodeListSubtreeFacts(node.Parameters, propagateSubtreeFacts) | + propagateEraseableSyntaxSubtreeFacts(node.Type) | + propagateEraseableSyntaxSubtreeFacts(node.FullSignature) | + propagateSubtreeFacts(node.Body) + } +} + +func (node *AccessorDeclarationBase) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsAccessor | + propagateSubtreeFacts(node.name) +} + +// GetAccessorDeclaration + +type GetAccessorDeclaration struct { + AccessorDeclarationBase +} + +func (f *NodeFactory) NewGetAccessorDeclaration(modifiers *ModifierList, name *PropertyName, typeParameters *NodeList, parameters *NodeList, returnType *TypeNode, fullSignature *TypeNode, body *BlockNode) *Node { + data := &GetAccessorDeclaration{} + data.modifiers = modifiers + data.name = name + data.TypeParameters = typeParameters + data.Parameters = parameters + data.Type = returnType + data.FullSignature = fullSignature + data.Body = body + return f.newNode(KindGetAccessor, data) +} + +func (f *NodeFactory) UpdateGetAccessorDeclaration(node *GetAccessorDeclaration, modifiers *ModifierList, name *PropertyName, typeParameters *TypeParameterList, parameters *ParameterList, returnType *TypeNode, fullSignature *TypeNode, body *BlockNode) *Node { + if modifiers != node.modifiers || name != node.name || typeParameters != node.TypeParameters || parameters != node.Parameters || returnType != node.Type || fullSignature != node.FullSignature || body != node.Body { + return updateNode(f.NewGetAccessorDeclaration(modifiers, name, typeParameters, parameters, returnType, fullSignature, body), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *GetAccessorDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateGetAccessorDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNodes(node.TypeParameters), v.visitParameters(node.Parameters), v.visitNode(node.Type), v.visitNode(node.FullSignature), v.visitFunctionBody(node.Body)) +} + +func (node *GetAccessorDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewGetAccessorDeclaration(node.modifiers, node.Name(), node.TypeParameters, node.Parameters, node.Type, node.FullSignature, node.Body), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsGetAccessorDeclaration(node *Node) bool { + return node.Kind == KindGetAccessor +} + +// SetAccessorDeclaration + +type SetAccessorDeclaration struct { + AccessorDeclarationBase +} + +func (f *NodeFactory) NewSetAccessorDeclaration(modifiers *ModifierList, name *PropertyName, typeParameters *NodeList, parameters *NodeList, returnType *TypeNode, fullSignature *TypeNode, body *BlockNode) *Node { + data := &SetAccessorDeclaration{} + data.modifiers = modifiers + data.name = name + data.TypeParameters = typeParameters + data.Parameters = parameters + data.Type = returnType + data.FullSignature = fullSignature + data.Body = body + return f.newNode(KindSetAccessor, data) +} + +func (f *NodeFactory) UpdateSetAccessorDeclaration(node *SetAccessorDeclaration, modifiers *ModifierList, name *PropertyName, typeParameters *TypeParameterList, parameters *ParameterList, returnType *TypeNode, fullSignature *TypeNode, body *BlockNode) *Node { + if modifiers != node.modifiers || name != node.name || typeParameters != node.TypeParameters || parameters != node.Parameters || returnType != node.Type || fullSignature != node.FullSignature || body != node.Body { + return updateNode(f.NewSetAccessorDeclaration(modifiers, name, typeParameters, parameters, returnType, fullSignature, body), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *SetAccessorDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateSetAccessorDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNodes(node.TypeParameters), v.visitParameters(node.Parameters), v.visitNode(node.Type), v.visitNode(node.FullSignature), v.visitFunctionBody(node.Body)) +} + +func (node *SetAccessorDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewSetAccessorDeclaration(node.Modifiers(), node.Name(), node.TypeParameters, node.Parameters, node.Type, node.FullSignature, node.Body), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsSetAccessorDeclaration(node *Node) bool { + return node.Kind == KindSetAccessor +} + +// IndexSignatureDeclaration + +type IndexSignatureDeclaration struct { + NodeBase + DeclarationBase + ModifiersBase + FunctionLikeBase + TypeElementBase + ClassElementBase + typeSyntaxBase +} + +func (f *NodeFactory) NewIndexSignatureDeclaration(modifiers *ModifierList, parameters *NodeList, returnType *TypeNode) *Node { + data := &IndexSignatureDeclaration{} + data.modifiers = modifiers + data.Parameters = parameters + data.Type = returnType + return f.newNode(KindIndexSignature, data) +} + +func (f *NodeFactory) UpdateIndexSignatureDeclaration(node *IndexSignatureDeclaration, modifiers *ModifierList, parameters *ParameterList, returnType *TypeNode) *Node { + if modifiers != node.modifiers || parameters != node.Parameters || returnType != node.Type { + return updateNode(f.NewIndexSignatureDeclaration(modifiers, parameters, returnType), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *IndexSignatureDeclaration) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visitNodeList(v, node.Parameters) || visit(v, node.Type) +} + +func (node *IndexSignatureDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateIndexSignatureDeclaration(node, v.visitModifiers(node.modifiers), v.visitNodes(node.Parameters), v.visitNode(node.Type)) +} + +func (node *IndexSignatureDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewIndexSignatureDeclaration(node.Modifiers(), node.Parameters, node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsIndexSignatureDeclaration(node *Node) bool { + return node.Kind == KindIndexSignature +} + +// MethodSignatureDeclaration + +type MethodSignatureDeclaration struct { + NodeBase + NamedMemberBase + FunctionLikeBase + TypeElementBase + typeSyntaxBase +} + +func (f *NodeFactory) NewMethodSignatureDeclaration(modifiers *ModifierList, name *PropertyName, postfixToken *TokenNode, typeParameters *NodeList, parameters *NodeList, returnType *TypeNode) *Node { + data := f.methodSignatureDeclarationPool.New() + data.modifiers = modifiers + data.name = name + data.PostfixToken = postfixToken + data.TypeParameters = typeParameters + data.Parameters = parameters + data.Type = returnType + return f.newNode(KindMethodSignature, data) +} + +func (f *NodeFactory) UpdateMethodSignatureDeclaration(node *MethodSignatureDeclaration, modifiers *ModifierList, name *PropertyName, postfixToken *TokenNode, typeParameters *TypeParameterList, parameters *ParameterList, returnType *TypeNode) *Node { + if modifiers != node.modifiers || name != node.name || postfixToken != node.PostfixToken || typeParameters != node.TypeParameters || parameters != node.Parameters || returnType != node.Type { + return updateNode(f.NewMethodSignatureDeclaration(modifiers, name, postfixToken, typeParameters, parameters, returnType), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *MethodSignatureDeclaration) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.name) || visit(v, node.PostfixToken) || visitNodeList(v, node.TypeParameters) || + visitNodeList(v, node.Parameters) || visit(v, node.Type) +} + +func (node *MethodSignatureDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateMethodSignatureDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitToken(node.PostfixToken), v.visitNodes(node.TypeParameters), v.visitNodes(node.Parameters), v.visitNode(node.Type)) +} + +func (node *MethodSignatureDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewMethodSignatureDeclaration(node.Modifiers(), node.Name(), node.PostfixToken, node.TypeParameters, node.Parameters, node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsMethodSignatureDeclaration(node *Node) bool { + return node.Kind == KindMethodSignature +} + +// MethodSignatureDeclaration + +type MethodDeclaration struct { + NodeBase + NamedMemberBase + FunctionLikeWithBodyBase + FlowNodeBase + ClassElementBase + ObjectLiteralElementBase + compositeNodeBase +} + +func (f *NodeFactory) NewMethodDeclaration(modifiers *ModifierList, asteriskToken *TokenNode, name *PropertyName, postfixToken *TokenNode, typeParameters *NodeList, parameters *NodeList, returnType *TypeNode, fullSignature *TypeNode, body *BlockNode) *Node { + data := &MethodDeclaration{} + data.modifiers = modifiers + data.AsteriskToken = asteriskToken + data.name = name + data.PostfixToken = postfixToken + data.TypeParameters = typeParameters + data.Parameters = parameters + data.Type = returnType + data.FullSignature = fullSignature + data.Body = body + return f.newNode(KindMethodDeclaration, data) +} + +func (f *NodeFactory) UpdateMethodDeclaration(node *MethodDeclaration, modifiers *ModifierList, asteriskToken *TokenNode, name *PropertyName, postfixToken *TokenNode, typeParameters *TypeParameterList, parameters *ParameterList, returnType *TypeNode, fullSignature *TypeNode, body *BlockNode) *Node { + if modifiers != node.modifiers || asteriskToken != node.AsteriskToken || name != node.name || postfixToken != node.PostfixToken || typeParameters != node.TypeParameters || parameters != node.Parameters || returnType != node.Type || fullSignature != node.FullSignature || body != node.Body { + return updateNode(f.NewMethodDeclaration(modifiers, asteriskToken, name, postfixToken, typeParameters, parameters, returnType, fullSignature, body), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *MethodDeclaration) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.AsteriskToken) || visit(v, node.name) || visit(v, node.PostfixToken) || + visitNodeList(v, node.TypeParameters) || visitNodeList(v, node.Parameters) || visit(v, node.Type) || visit(v, node.FullSignature) || visit(v, node.Body) +} + +func (node *MethodDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateMethodDeclaration(node, v.visitModifiers(node.modifiers), v.visitToken(node.AsteriskToken), v.visitNode(node.name), v.visitToken(node.PostfixToken), v.visitNodes(node.TypeParameters), v.visitParameters(node.Parameters), v.visitNode(node.Type), v.visitNode(node.FullSignature), v.visitFunctionBody(node.Body)) +} + +func (node *MethodDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewMethodDeclaration(node.Modifiers(), node.AsteriskToken, node.Name(), node.PostfixToken, node.TypeParameters, node.Parameters, node.Type, node.FullSignature, node.Body), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *MethodDeclaration) computeSubtreeFacts() SubtreeFacts { + if node.Body == nil { + return SubtreeContainsTypeScript + } else { + isAsync := node.modifiers != nil && node.modifiers.ModifierFlags&ModifierFlagsAsync != 0 + isGenerator := node.AsteriskToken != nil + return propagateModifierListSubtreeFacts(node.modifiers) | + propagateSubtreeFacts(node.AsteriskToken) | + propagateSubtreeFacts(node.name) | + propagateEraseableSyntaxSubtreeFacts(node.PostfixToken) | + propagateEraseableSyntaxListSubtreeFacts(node.TypeParameters) | + propagateNodeListSubtreeFacts(node.Parameters, propagateSubtreeFacts) | + propagateSubtreeFacts(node.Body) | + propagateEraseableSyntaxSubtreeFacts(node.Type) | + propagateEraseableSyntaxSubtreeFacts(node.FullSignature) | + core.IfElse(isAsync && isGenerator, SubtreeContainsForAwaitOrAsyncGenerator, SubtreeFactsNone) | + core.IfElse(isAsync && !isGenerator, SubtreeContainsAnyAwait, SubtreeFactsNone) + } +} + +func (node *MethodDeclaration) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsMethod | + propagateSubtreeFacts(node.name) +} + +func IsMethodDeclaration(node *Node) bool { + return node.Kind == KindMethodDeclaration +} + +// PropertySignatureDeclaration + +type PropertySignatureDeclaration struct { + NodeBase + NamedMemberBase + TypeElementBase + typeSyntaxBase + Type *TypeNode // TypeNode + Initializer *Expression // Expression. For error reporting purposes +} + +func (f *NodeFactory) NewPropertySignatureDeclaration(modifiers *ModifierList, name *PropertyName, postfixToken *TokenNode, typeNode *TypeNode, initializer *Expression) *Node { + data := f.propertySignatureDeclarationPool.New() + data.modifiers = modifiers + data.name = name + data.PostfixToken = postfixToken + data.Type = typeNode + data.Initializer = initializer + return f.newNode(KindPropertySignature, data) +} + +func (f *NodeFactory) UpdatePropertySignatureDeclaration(node *PropertySignatureDeclaration, modifiers *ModifierList, name *PropertyName, postfixToken *TokenNode, typeNode *TypeNode, initializer *Expression) *Node { + if modifiers != node.modifiers || name != node.name || postfixToken != node.PostfixToken || typeNode != node.Type || initializer != node.Initializer { + return updateNode(f.NewPropertySignatureDeclaration(modifiers, name, postfixToken, typeNode, initializer), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *PropertySignatureDeclaration) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.name) || visit(v, node.PostfixToken) || visit(v, node.Type) || visit(v, node.Initializer) +} + +func (node *PropertySignatureDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdatePropertySignatureDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitToken(node.PostfixToken), v.visitNode(node.Type), v.visitNode(node.Initializer)) +} + +func (node *PropertySignatureDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewPropertySignatureDeclaration(node.Modifiers(), node.Name(), node.PostfixToken, node.Type, node.Initializer), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsPropertySignatureDeclaration(node *Node) bool { + return node.Kind == KindPropertySignature +} + +// PropertyDeclaration + +type PropertyDeclaration struct { + NodeBase + NamedMemberBase + ClassElementBase + compositeNodeBase + Type *TypeNode // TypeNode. Optional + Initializer *Expression // Expression. Optional +} + +func (f *NodeFactory) NewPropertyDeclaration(modifiers *ModifierList, name *PropertyName, postfixToken *TokenNode, typeNode *TypeNode, initializer *Expression) *Node { + data := &PropertyDeclaration{} + data.modifiers = modifiers + data.name = name + data.PostfixToken = postfixToken + data.Type = typeNode + data.Initializer = initializer + return f.newNode(KindPropertyDeclaration, data) +} + +func (f *NodeFactory) UpdatePropertyDeclaration(node *PropertyDeclaration, modifiers *ModifierList, name *PropertyName, postfixToken *TokenNode, typeNode *TypeNode, initializer *Expression) *Node { + if modifiers != node.modifiers || name != node.name || postfixToken != node.PostfixToken || typeNode != node.Type || initializer != node.Initializer { + return updateNode(f.NewPropertyDeclaration(modifiers, name, postfixToken, typeNode, initializer), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *PropertyDeclaration) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.name) || visit(v, node.PostfixToken) || visit(v, node.Type) || visit(v, node.Initializer) +} + +func (node *PropertyDeclaration) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdatePropertyDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitToken(node.PostfixToken), v.visitNode(node.Type), v.visitNode(node.Initializer)) +} + +func (node *PropertyDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewPropertyDeclaration(node.Modifiers(), node.Name(), node.PostfixToken, node.Type, node.Initializer), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *PropertyDeclaration) computeSubtreeFacts() SubtreeFacts { + return propagateModifierListSubtreeFacts(node.modifiers) | + propagateSubtreeFacts(node.name) | + propagateEraseableSyntaxSubtreeFacts(node.PostfixToken) | + propagateEraseableSyntaxSubtreeFacts(node.Type) | + propagateSubtreeFacts(node.Initializer) | + SubtreeContainsClassFields +} + +func (node *PropertyDeclaration) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsProperty | + propagateSubtreeFacts(node.name) +} + +func IsPropertyDeclaration(node *Node) bool { + return node.Kind == KindPropertyDeclaration +} + +// SemicolonClassElement + +type SemicolonClassElement struct { + NodeBase + DeclarationBase + ClassElementBase +} + +func (f *NodeFactory) NewSemicolonClassElement() *Node { + return f.newNode(KindSemicolonClassElement, &SemicolonClassElement{}) +} + +func (node *SemicolonClassElement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewSemicolonClassElement(), node.AsNode(), f.AsNodeFactory().hooks) +} + +// ClassStaticBlockDeclaration + +type ClassStaticBlockDeclaration struct { + NodeBase + DeclarationBase + ModifiersBase + LocalsContainerBase + ClassElementBase + compositeNodeBase + Body *BlockNode // BlockNode + ReturnFlowNode *FlowNode +} + +func (f *NodeFactory) NewClassStaticBlockDeclaration(modifiers *ModifierList, body *BlockNode) *Node { + data := &ClassStaticBlockDeclaration{} + data.modifiers = modifiers + data.Body = body + return f.newNode(KindClassStaticBlockDeclaration, data) +} + +func (f *NodeFactory) UpdateClassStaticBlockDeclaration(node *ClassStaticBlockDeclaration, modifiers *ModifierList, body *BlockNode) *Node { + if modifiers != node.modifiers || body != node.Body { + return updateNode(f.NewClassStaticBlockDeclaration(modifiers, body), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ClassStaticBlockDeclaration) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.Body) +} + +func (node *ClassStaticBlockDeclaration) VisitEachChild(v *NodeVisitor) *Node { + // A `static {}` Block does not have parameters, but we must still ensure we enter the lexical scope + modifiers := v.visitModifiers(node.modifiers) + body := v.visitNode(node.Body) + return v.Factory.UpdateClassStaticBlockDeclaration(node, modifiers, body) +} + +func (node *ClassStaticBlockDeclaration) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewClassStaticBlockDeclaration(node.Modifiers(), node.Body), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ClassStaticBlockDeclaration) computeSubtreeFacts() SubtreeFacts { + return propagateModifierListSubtreeFacts(node.modifiers) | + propagateSubtreeFacts(node.Body) | + SubtreeContainsClassFields +} + +func IsClassStaticBlockDeclaration(node *Node) bool { + return node.Kind == KindClassStaticBlockDeclaration +} + +// ExpressionBase + +type ExpressionBase struct { + NodeBase +} + +// OmittedExpression + +type OmittedExpression struct { + ExpressionBase +} + +func (f *NodeFactory) NewOmittedExpression() *Node { + return f.newNode(KindOmittedExpression, &OmittedExpression{}) +} + +func (node *OmittedExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewOmittedExpression(), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsOmittedExpression(node *Node) bool { + return node.Kind == KindOmittedExpression +} + +// KeywordExpression + +type KeywordExpression struct { + ExpressionBase + FlowNodeBase // For 'this' and 'super' expressions +} + +func (f *NodeFactory) NewKeywordExpression(kind Kind) *Node { + return f.newNode(kind, f.keywordExpressionPool.New()) +} + +func (node *KeywordExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewKeywordExpression(node.Kind), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *KeywordExpression) computeSubtreeFacts() SubtreeFacts { + switch node.Kind { + case KindThisKeyword: + return SubtreeContainsLexicalThis + case KindSuperKeyword: + return SubtreeContainsLexicalSuper + } + return SubtreeFactsNone +} + +// LiteralLikeBase + +type LiteralLikeBase struct { + Text string + TokenFlags TokenFlags +} + +func (node *LiteralLikeBase) LiteralLikeData() *LiteralLikeBase { return node } + +// StringLiteral + +type StringLiteral struct { + ExpressionBase + LiteralLikeBase +} + +func (f *NodeFactory) NewStringLiteral(text string) *Node { + data := f.stringLiteralPool.New() + data.Text = text + f.textCount++ + return f.newNode(KindStringLiteral, data) +} + +func (node *StringLiteral) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewStringLiteral(node.Text), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsStringLiteral(node *Node) bool { + return node.Kind == KindStringLiteral +} + +// NumericLiteral + +type NumericLiteral struct { + ExpressionBase + LiteralLikeBase +} + +func (f *NodeFactory) NewNumericLiteral(text string) *Node { + data := f.numericLiteralPool.New() + data.Text = text + f.textCount++ + return f.newNode(KindNumericLiteral, data) +} + +func (node *NumericLiteral) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewNumericLiteral(node.Text), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsNumericLiteral(node *Node) bool { + return node.Kind == KindNumericLiteral +} + +// BigIntLiteral + +type BigIntLiteral struct { + ExpressionBase + LiteralLikeBase +} + +func (f *NodeFactory) NewBigIntLiteral(text string) *Node { + data := &BigIntLiteral{} + data.Text = text + f.textCount++ + return f.newNode(KindBigIntLiteral, data) +} + +func (node *BigIntLiteral) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewBigIntLiteral(node.Text), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *BigIntLiteral) computeSubtreeFacts() SubtreeFacts { + return SubtreeFactsNone // `bigint` is not downleveled in any way +} + +func IsBigIntLiteral(node *Node) bool { + return node.Kind == KindBigIntLiteral +} + +// RegularExpressionLiteral + +type RegularExpressionLiteral struct { + ExpressionBase + LiteralLikeBase +} + +func (f *NodeFactory) NewRegularExpressionLiteral(text string) *Node { + data := &RegularExpressionLiteral{} + data.Text = text + f.textCount++ + return f.newNode(KindRegularExpressionLiteral, data) +} + +func (node *RegularExpressionLiteral) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewRegularExpressionLiteral(node.Text), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsRegularExpressionLiteral(node *Node) bool { + return node.Kind == KindRegularExpressionLiteral +} + +// NoSubstitutionTemplateLiteral + +type NoSubstitutionTemplateLiteral struct { + ExpressionBase + TemplateLiteralLikeBase +} + +func (f *NodeFactory) NewNoSubstitutionTemplateLiteral(text string) *Node { + data := &NoSubstitutionTemplateLiteral{} + data.Text = text + f.textCount++ + return f.newNode(KindNoSubstitutionTemplateLiteral, data) +} + +func (node *NoSubstitutionTemplateLiteral) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewNoSubstitutionTemplateLiteral(node.Text), node.AsNode(), f.AsNodeFactory().hooks) +} + +// BinaryExpression + +type BinaryExpression struct { + ExpressionBase + DeclarationBase + ModifiersBase + compositeNodeBase + Left *Expression // Expression + Type *TypeNode // TypeNode. Only set by JSDoc @type tags. + OperatorToken *TokenNode // TokenNode + Right *Expression // Expression +} + +func (f *NodeFactory) NewBinaryExpression(modifiers *ModifierList, left *Expression, typeNode *TypeNode, operatorToken *TokenNode, right *Expression) *Node { + if operatorToken == nil { + panic("operatorToken is required") + } + data := f.binaryExpressionPool.New() + data.modifiers = modifiers + data.Left = left + data.Type = typeNode + data.OperatorToken = operatorToken + data.Right = right + return f.newNode(KindBinaryExpression, data) +} + +func (f *NodeFactory) UpdateBinaryExpression(node *BinaryExpression, modifiers *ModifierList, left *Expression, typeNode *TypeNode, operatorToken *TokenNode, right *Expression) *Node { + if left != node.Left || typeNode != node.Type || operatorToken != node.OperatorToken || right != node.Right { + return updateNode(f.NewBinaryExpression(modifiers, left, typeNode, operatorToken, right), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *BinaryExpression) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.Left) || visit(v, node.Type) || visit(v, node.OperatorToken) || visit(v, node.Right) +} + +func (node *BinaryExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateBinaryExpression(node, v.visitModifiers(node.modifiers), v.visitNode(node.Left), v.visitNode(node.Type), v.visitToken(node.OperatorToken), v.visitNode(node.Right)) +} + +func (node *BinaryExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewBinaryExpression(node.modifiers, node.Left, node.Type, node.OperatorToken, node.Right), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *BinaryExpression) computeSubtreeFacts() SubtreeFacts { + return propagateModifierListSubtreeFacts(node.modifiers) | + propagateSubtreeFacts(node.Left) | + propagateSubtreeFacts(node.Type) | + propagateSubtreeFacts(node.OperatorToken) | + propagateSubtreeFacts(node.Right) | + core.IfElse(node.OperatorToken.Kind == KindInKeyword && IsPrivateIdentifier(node.Left), SubtreeContainsClassFields, SubtreeFactsNone) +} + +func (node *BinaryExpression) setModifiers(modifiers *ModifierList) { node.modifiers = modifiers } + +func IsBinaryExpression(node *Node) bool { + return node.Kind == KindBinaryExpression +} + +// PrefixUnaryExpression + +type PrefixUnaryExpression struct { + ExpressionBase + Operator Kind + Operand *Expression // Expression +} + +func (f *NodeFactory) NewPrefixUnaryExpression(operator Kind, operand *Expression) *Node { + data := f.prefixUnaryExpressionPool.New() + data.Operator = operator + data.Operand = operand + return f.newNode(KindPrefixUnaryExpression, data) +} + +func (f *NodeFactory) UpdatePrefixUnaryExpression(node *PrefixUnaryExpression, operand *Expression) *Node { + if operand != node.Operand { + return updateNode(f.NewPrefixUnaryExpression(node.Operator, operand), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *PrefixUnaryExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Operand) +} + +func (node *PrefixUnaryExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdatePrefixUnaryExpression(node, v.visitNode(node.Operand)) +} + +func (node *PrefixUnaryExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewPrefixUnaryExpression(node.Operator, node.Operand), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *PrefixUnaryExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Operand) +} + +func IsPrefixUnaryExpression(node *Node) bool { + return node.Kind == KindPrefixUnaryExpression +} + +// PostfixUnaryExpression + +type PostfixUnaryExpression struct { + ExpressionBase + Operand *Expression // Expression + Operator Kind +} + +func (f *NodeFactory) NewPostfixUnaryExpression(operand *Expression, operator Kind) *Node { + data := &PostfixUnaryExpression{} + data.Operand = operand + data.Operator = operator + return f.newNode(KindPostfixUnaryExpression, data) +} + +func (f *NodeFactory) UpdatePostfixUnaryExpression(node *PostfixUnaryExpression, operand *Expression) *Node { + if operand != node.Operand { + return updateNode(f.NewPostfixUnaryExpression(operand, node.Operator), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *PostfixUnaryExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Operand) +} + +func (node *PostfixUnaryExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdatePostfixUnaryExpression(node, v.visitNode(node.Operand)) +} + +func (node *PostfixUnaryExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewPostfixUnaryExpression(node.Operand, node.Operator), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *PostfixUnaryExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Operand) +} + +// YieldExpression + +type YieldExpression struct { + ExpressionBase + AsteriskToken *TokenNode // TokenNode + Expression *Expression // Expression. Optional +} + +func (f *NodeFactory) NewYieldExpression(asteriskToken *TokenNode, expression *Expression) *Node { + data := &YieldExpression{} + data.AsteriskToken = asteriskToken + data.Expression = expression + return f.newNode(KindYieldExpression, data) +} + +func (f *NodeFactory) UpdateYieldExpression(node *YieldExpression, asteriskToken *TokenNode, expression *Expression) *Node { + if asteriskToken != node.AsteriskToken || expression != node.Expression { + return updateNode(f.NewYieldExpression(asteriskToken, expression), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *YieldExpression) ForEachChild(v Visitor) bool { + return visit(v, node.AsteriskToken) || visit(v, node.Expression) +} + +func (node *YieldExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateYieldExpression(node, v.visitToken(node.AsteriskToken), v.visitNode(node.Expression)) +} + +func (node *YieldExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewYieldExpression(node.AsteriskToken, node.Expression), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *YieldExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | SubtreeContainsForAwaitOrAsyncGenerator +} + +func IsYieldExpression(node *Node) bool { + return node.Kind == KindYieldExpression +} + +// ArrowFunction + +type ArrowFunction struct { + ExpressionBase + DeclarationBase + ModifiersBase + FunctionLikeWithBodyBase + FlowNodeBase + compositeNodeBase + EqualsGreaterThanToken *TokenNode // TokenNode +} + +func (f *NodeFactory) NewArrowFunction(modifiers *ModifierList, typeParameters *NodeList, parameters *NodeList, returnType *TypeNode, fullSignature *TypeNode, equalsGreaterThanToken *TokenNode, body *BlockOrExpression) *Node { + data := &ArrowFunction{} + data.modifiers = modifiers + data.TypeParameters = typeParameters + data.Parameters = parameters + data.Type = returnType + data.FullSignature = fullSignature + data.EqualsGreaterThanToken = equalsGreaterThanToken + data.Body = body + return f.newNode(KindArrowFunction, data) +} + +func (f *NodeFactory) UpdateArrowFunction(node *ArrowFunction, modifiers *ModifierList, typeParameters *TypeParameterList, parameters *ParameterList, returnType *TypeNode, fullSignature *TypeNode, equalsGreaterThanToken *TokenNode, body *BlockOrExpression) *Node { + if modifiers != node.modifiers || typeParameters != node.TypeParameters || parameters != node.Parameters || returnType != node.Type || fullSignature != node.FullSignature || equalsGreaterThanToken != node.EqualsGreaterThanToken || body != node.Body { + return updateNode(f.NewArrowFunction(modifiers, typeParameters, parameters, returnType, fullSignature, equalsGreaterThanToken, body), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ArrowFunction) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visitNodeList(v, node.TypeParameters) || visitNodeList(v, node.Parameters) || + visit(v, node.Type) || visit(v, node.FullSignature) || visit(v, node.EqualsGreaterThanToken) || visit(v, node.Body) +} + +func (node *ArrowFunction) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateArrowFunction(node, v.visitModifiers(node.modifiers), v.visitNodes(node.TypeParameters), v.visitParameters(node.Parameters), v.visitNode(node.Type), v.visitNode(node.FullSignature), v.visitToken(node.EqualsGreaterThanToken), v.visitFunctionBody(node.Body)) +} + +func (node *ArrowFunction) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewArrowFunction(node.Modifiers(), node.TypeParameters, node.Parameters, node.Type, node.FullSignature, node.EqualsGreaterThanToken, node.Body), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ArrowFunction) Name() *DeclarationName { + return nil +} + +func (node *ArrowFunction) computeSubtreeFacts() SubtreeFacts { + return propagateModifierListSubtreeFacts(node.modifiers) | + propagateEraseableSyntaxListSubtreeFacts(node.TypeParameters) | + propagateNodeListSubtreeFacts(node.Parameters, propagateSubtreeFacts) | + propagateEraseableSyntaxSubtreeFacts(node.Type) | + propagateEraseableSyntaxSubtreeFacts(node.FullSignature) | + propagateSubtreeFacts(node.Body) | + core.IfElse(node.ModifierFlags()&ModifierFlagsAsync != 0, SubtreeContainsAnyAwait, SubtreeFactsNone) +} + +func (node *ArrowFunction) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsArrowFunction +} + +func IsArrowFunction(node *Node) bool { + return node.Kind == KindArrowFunction +} + +// FunctionExpression + +type FunctionExpression struct { + ExpressionBase + DeclarationBase + ModifiersBase + FunctionLikeWithBodyBase + FlowNodeBase + compositeNodeBase + name *IdentifierNode // IdentifierNode. Optional + ReturnFlowNode *FlowNode +} + +func (f *NodeFactory) NewFunctionExpression(modifiers *ModifierList, asteriskToken *TokenNode, name *IdentifierNode, typeParameters *NodeList, parameters *NodeList, returnType *TypeNode, fullSignature *TypeNode, body *BlockNode) *Node { + data := &FunctionExpression{} + data.modifiers = modifiers + data.AsteriskToken = asteriskToken + data.name = name + data.TypeParameters = typeParameters + data.Parameters = parameters + data.Type = returnType + data.FullSignature = fullSignature + data.Body = body + return f.newNode(KindFunctionExpression, data) +} + +func (f *NodeFactory) UpdateFunctionExpression(node *FunctionExpression, modifiers *ModifierList, asteriskToken *TokenNode, name *IdentifierNode, typeParameters *TypeParameterList, parameters *ParameterList, returnType *TypeNode, fullSignature *TypeNode, body *BlockNode) *Node { + if modifiers != node.modifiers || asteriskToken != node.AsteriskToken || name != node.name || typeParameters != node.TypeParameters || parameters != node.Parameters || returnType != node.Type || fullSignature != node.FullSignature || body != node.Body { + return updateNode(f.NewFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, returnType, fullSignature, body), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *FunctionExpression) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.AsteriskToken) || visit(v, node.name) || visitNodeList(v, node.TypeParameters) || + visitNodeList(v, node.Parameters) || visit(v, node.Type) || visit(v, node.FullSignature) || visit(v, node.Body) +} + +func (node *FunctionExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateFunctionExpression(node, v.visitModifiers(node.modifiers), v.visitToken(node.AsteriskToken), v.visitNode(node.name), v.visitNodes(node.TypeParameters), v.visitParameters(node.Parameters), v.visitNode(node.Type), v.visitNode(node.FullSignature), v.visitFunctionBody(node.Body)) +} + +func (node *FunctionExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewFunctionExpression(node.Modifiers(), node.AsteriskToken, node.Name(), node.TypeParameters, node.Parameters, node.Type, node.FullSignature, node.Body), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *FunctionExpression) Name() *DeclarationName { + return node.name +} + +func (node *FunctionExpression) computeSubtreeFacts() SubtreeFacts { + isAsync := node.modifiers != nil && node.modifiers.ModifierFlags&ModifierFlagsAsync != 0 + isGenerator := node.AsteriskToken != nil + return propagateModifierListSubtreeFacts(node.modifiers) | + propagateSubtreeFacts(node.AsteriskToken) | + propagateSubtreeFacts(node.name) | + propagateEraseableSyntaxListSubtreeFacts(node.TypeParameters) | + propagateNodeListSubtreeFacts(node.Parameters, propagateSubtreeFacts) | + propagateEraseableSyntaxSubtreeFacts(node.Type) | + propagateEraseableSyntaxSubtreeFacts(node.FullSignature) | + propagateSubtreeFacts(node.Body) | + core.IfElse(isAsync && isGenerator, SubtreeContainsForAwaitOrAsyncGenerator, SubtreeFactsNone) | + core.IfElse(isAsync && !isGenerator, SubtreeContainsAnyAwait, SubtreeFactsNone) +} + +func (node *FunctionExpression) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsFunction +} + +func IsFunctionExpression(node *Node) bool { + return node.Kind == KindFunctionExpression +} + +// AsExpression + +type AsExpression struct { + ExpressionBase + Expression *Expression // Expression + Type *TypeNode // TypeNode +} + +func (f *NodeFactory) NewAsExpression(expression *Expression, typeNode *TypeNode) *Node { + data := &AsExpression{} + data.Expression = expression + data.Type = typeNode + return f.newNode(KindAsExpression, data) +} + +func (f *NodeFactory) UpdateAsExpression(node *AsExpression, expression *Expression, typeNode *TypeNode) *Node { + if expression != node.Expression || typeNode != node.Type { + return updateNode(f.NewAsExpression(expression, typeNode), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *AsExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) || visit(v, node.Type) +} + +func (node *AsExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateAsExpression(node, v.visitNode(node.Expression), v.visitNode(node.Type)) +} + +func (node *AsExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewAsExpression(node.Expression, node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *AsExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | SubtreeContainsTypeScript +} + +func (node *AsExpression) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsOuterExpression +} + +// SatisfiesExpression + +type SatisfiesExpression struct { + ExpressionBase + Expression *Expression // Expression + Type *TypeNode // TypeNode +} + +func (f *NodeFactory) NewSatisfiesExpression(expression *Expression, typeNode *TypeNode) *Node { + data := &SatisfiesExpression{} + data.Expression = expression + data.Type = typeNode + return f.newNode(KindSatisfiesExpression, data) +} + +func (f *NodeFactory) UpdateSatisfiesExpression(node *SatisfiesExpression, expression *Expression, typeNode *TypeNode) *Node { + if expression != node.Expression || typeNode != node.Type { + return updateNode(f.NewSatisfiesExpression(expression, typeNode), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *SatisfiesExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) || visit(v, node.Type) +} + +func (node *SatisfiesExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateSatisfiesExpression(node, v.visitNode(node.Expression), v.visitNode(node.Type)) +} + +func (node *SatisfiesExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewSatisfiesExpression(node.Expression, node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *SatisfiesExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | SubtreeContainsTypeScript +} + +func (node *SatisfiesExpression) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsOuterExpression +} + +func IsSatisfiesExpression(node *Node) bool { + return node.Kind == KindSatisfiesExpression +} + +// ConditionalExpression + +type ConditionalExpression struct { + ExpressionBase + compositeNodeBase + Condition *Expression + QuestionToken *TokenNode + WhenTrue *Expression + ColonToken *TokenNode + WhenFalse *Expression +} + +func (f *NodeFactory) NewConditionalExpression(condition *Expression, questionToken *TokenNode, whenTrue *Expression, colonToken *TokenNode, whenFalse *Expression) *Node { + data := f.conditionalExpressionPool.New() + data.Condition = condition + data.QuestionToken = questionToken + data.WhenTrue = whenTrue + data.ColonToken = colonToken + data.WhenFalse = whenFalse + return f.newNode(KindConditionalExpression, data) +} + +func (f *NodeFactory) UpdateConditionalExpression(node *ConditionalExpression, condition *Expression, questionToken *TokenNode, whenTrue *Expression, colonToken *TokenNode, whenFalse *Expression) *Node { + if condition != node.Condition || questionToken != node.QuestionToken || whenTrue != node.WhenTrue || colonToken != node.ColonToken || whenFalse != node.WhenFalse { + return updateNode(f.NewConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ConditionalExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Condition) || visit(v, node.QuestionToken) || visit(v, node.WhenTrue) || + visit(v, node.ColonToken) || visit(v, node.WhenFalse) +} + +func (node *ConditionalExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateConditionalExpression(node, v.visitNode(node.Condition), v.visitToken(node.QuestionToken), v.visitNode(node.WhenTrue), v.visitToken(node.ColonToken), v.visitNode(node.WhenFalse)) +} + +func (node *ConditionalExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewConditionalExpression(node.Condition, node.QuestionToken, node.WhenTrue, node.ColonToken, node.WhenFalse), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ConditionalExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Condition) | + propagateSubtreeFacts(node.WhenTrue) | + propagateSubtreeFacts(node.WhenFalse) +} + +func IsConditionalExpression(node *Node) bool { + return node.Kind == KindConditionalExpression +} + +// PropertyAccessExpression + +type PropertyAccessExpression struct { + ExpressionBase + FlowNodeBase + compositeNodeBase + Expression *Expression // Expression + QuestionDotToken *TokenNode // TokenNode + name *MemberName // MemberName +} + +func (f *NodeFactory) NewPropertyAccessExpression(expression *Expression, questionDotToken *TokenNode, name *MemberName, flags NodeFlags) *Node { + data := f.propertyAccessExpressionPool.New() + data.Expression = expression + data.QuestionDotToken = questionDotToken + data.name = name + node := f.newNode(KindPropertyAccessExpression, data) + node.Flags |= flags & NodeFlagsOptionalChain + return node +} + +func (f *NodeFactory) UpdatePropertyAccessExpression(node *PropertyAccessExpression, expression *Expression, questionDotToken *TokenNode, name *MemberName) *Node { + if expression != node.Expression || questionDotToken != node.QuestionDotToken || name != node.name { + return updateNode(f.NewPropertyAccessExpression(expression, questionDotToken, name, node.Flags), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *PropertyAccessExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) || visit(v, node.QuestionDotToken) || visit(v, node.name) +} + +func (node *PropertyAccessExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdatePropertyAccessExpression(node, v.visitNode(node.Expression), v.visitToken(node.QuestionDotToken), v.visitNode(node.name)) +} + +func (node *PropertyAccessExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewPropertyAccessExpression(node.Expression, node.QuestionDotToken, node.Name(), node.Flags), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *PropertyAccessExpression) Name() *DeclarationName { return node.name } + +func (node *PropertyAccessExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | + propagateSubtreeFacts(node.QuestionDotToken) | + propagateSubtreeFacts(node.name) +} + +func (node *PropertyAccessExpression) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsPropertyAccess +} + +func IsPropertyAccessExpression(node *Node) bool { + return node.Kind == KindPropertyAccessExpression +} + +// ElementAccessExpression + +type ElementAccessExpression struct { + ExpressionBase + FlowNodeBase + compositeNodeBase + Expression *Expression // Expression + QuestionDotToken *TokenNode // TokenNode + ArgumentExpression *Expression // Expression +} + +func (f *NodeFactory) NewElementAccessExpression(expression *Expression, questionDotToken *TokenNode, argumentExpression *Expression, flags NodeFlags) *Node { + data := f.elementAccessExpressionPool.New() + data.Expression = expression + data.QuestionDotToken = questionDotToken + data.ArgumentExpression = argumentExpression + node := f.newNode(KindElementAccessExpression, data) + node.Flags |= flags & NodeFlagsOptionalChain + return node +} + +func (f *NodeFactory) UpdateElementAccessExpression(node *ElementAccessExpression, expression *Expression, questionDotToken *TokenNode, argumentExpression *Expression) *Node { + if expression != node.Expression || questionDotToken != node.QuestionDotToken || argumentExpression != node.ArgumentExpression { + return updateNode(f.NewElementAccessExpression(expression, questionDotToken, argumentExpression, node.Flags), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ElementAccessExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) || visit(v, node.QuestionDotToken) || visit(v, node.ArgumentExpression) +} + +func (node *ElementAccessExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateElementAccessExpression(node, v.visitNode(node.Expression), v.visitToken(node.QuestionDotToken), v.visitNode(node.ArgumentExpression)) +} + +func (node *ElementAccessExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewElementAccessExpression(node.Expression, node.QuestionDotToken, node.ArgumentExpression, node.Flags), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ElementAccessExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | + propagateSubtreeFacts(node.QuestionDotToken) | + propagateSubtreeFacts(node.ArgumentExpression) +} + +func (node *ElementAccessExpression) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsElementAccess +} + +func IsElementAccessExpression(node *Node) bool { + return node.Kind == KindElementAccessExpression +} + +// CallExpression + +type CallExpression struct { + ExpressionBase + compositeNodeBase + Expression *Expression // Expression + QuestionDotToken *TokenNode // TokenNode + TypeArguments *NodeList // NodeList[*TypeNode]. Optional + Arguments *NodeList // NodeList[*Expression] +} + +func (f *NodeFactory) NewCallExpression(expression *Expression, questionDotToken *TokenNode, typeArguments *NodeList, arguments *NodeList, flags NodeFlags) *Node { + data := f.callExpressionPool.New() + data.Expression = expression + data.QuestionDotToken = questionDotToken + data.TypeArguments = typeArguments + data.Arguments = arguments + node := f.newNode(KindCallExpression, data) + node.Flags |= flags & NodeFlagsOptionalChain + return node +} + +func (f *NodeFactory) UpdateCallExpression(node *CallExpression, expression *Expression, questionDotToken *TokenNode, typeArguments *TypeArgumentList, arguments *ArgumentList) *Node { + if expression != node.Expression || questionDotToken != node.QuestionDotToken || typeArguments != node.TypeArguments || arguments != node.Arguments { + return updateNode(f.NewCallExpression(expression, questionDotToken, typeArguments, arguments, node.Flags), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *CallExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) || visit(v, node.QuestionDotToken) || visitNodeList(v, node.TypeArguments) || visitNodeList(v, node.Arguments) +} + +func (node *CallExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateCallExpression(node, v.visitNode(node.Expression), v.visitToken(node.QuestionDotToken), v.visitNodes(node.TypeArguments), v.visitNodes(node.Arguments)) +} + +func (node *CallExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewCallExpression(node.Expression, node.QuestionDotToken, node.TypeArguments, node.Arguments, node.Flags), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *CallExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | + propagateSubtreeFacts(node.QuestionDotToken) | + propagateEraseableSyntaxListSubtreeFacts(node.TypeArguments) | + propagateNodeListSubtreeFacts(node.Arguments, propagateSubtreeFacts) | + core.IfElse(node.Expression.Kind == KindImportKeyword, SubtreeContainsDynamicImport, SubtreeFactsNone) +} + +func (node *CallExpression) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsCall +} + +func IsCallExpression(node *Node) bool { + return node.Kind == KindCallExpression +} + +// NewExpression + +type NewExpression struct { + ExpressionBase + compositeNodeBase + Expression *Expression // Expression + TypeArguments *NodeList // NodeList[*TypeNode]. Optional + Arguments *NodeList // NodeList[*Expression]. Optional +} + +func (f *NodeFactory) NewNewExpression(expression *Expression, typeArguments *NodeList, arguments *NodeList) *Node { + data := &NewExpression{} + data.Expression = expression + data.TypeArguments = typeArguments + data.Arguments = arguments + return f.newNode(KindNewExpression, data) +} + +func (f *NodeFactory) UpdateNewExpression(node *NewExpression, expression *Expression, typeArguments *TypeArgumentList, arguments *ArgumentList) *Node { + if expression != node.Expression || typeArguments != node.TypeArguments || arguments != node.Arguments { + return updateNode(f.NewNewExpression(expression, typeArguments, arguments), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *NewExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) || visitNodeList(v, node.TypeArguments) || visitNodeList(v, node.Arguments) +} + +func (node *NewExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateNewExpression(node, v.visitNode(node.Expression), v.visitNodes(node.TypeArguments), v.visitNodes(node.Arguments)) +} + +func (node *NewExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewNewExpression(node.Expression, node.TypeArguments, node.Arguments), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *NewExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | + propagateEraseableSyntaxListSubtreeFacts(node.TypeArguments) | + propagateNodeListSubtreeFacts(node.Arguments, propagateSubtreeFacts) +} + +func (node *NewExpression) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsNew +} + +func IsNewExpression(node *Node) bool { + return node.Kind == KindNewExpression +} + +// MetaProperty + +type MetaProperty struct { + ExpressionBase + FlowNodeBase + compositeNodeBase + KeywordToken Kind // NewKeyword | ImportKeyword + name *IdentifierNode // IdentifierNode +} + +func (f *NodeFactory) NewMetaProperty(keywordToken Kind, name *IdentifierNode) *Node { + data := &MetaProperty{} + data.KeywordToken = keywordToken + data.name = name + return f.newNode(KindMetaProperty, data) +} + +func (f *NodeFactory) UpdateMetaProperty(node *MetaProperty, name *IdentifierNode) *Node { + if name != node.name { + return updateNode(f.NewMetaProperty(node.KeywordToken, name), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *MetaProperty) ForEachChild(v Visitor) bool { + return visit(v, node.name) +} + +func (node *MetaProperty) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateMetaProperty(node, v.visitNode(node.name)) +} + +func (node *MetaProperty) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewMetaProperty(node.Kind, node.Name()), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *MetaProperty) Name() *DeclarationName { + return node.name +} + +func (node *MetaProperty) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.name) // `import.meta` is not downleveled in any way +} + +func IsMetaProperty(node *Node) bool { + return node.Kind == KindMetaProperty +} + +// NonNullExpression + +type NonNullExpression struct { + ExpressionBase + Expression *Expression // Expression +} + +func (f *NodeFactory) NewNonNullExpression(expression *Expression, flags NodeFlags) *Node { + data := &NonNullExpression{} + data.Expression = expression + data.Flags |= flags & NodeFlagsOptionalChain + return f.newNode(KindNonNullExpression, data) +} + +func (f *NodeFactory) UpdateNonNullExpression(node *NonNullExpression, expression *Expression) *Node { + if expression != node.Expression { + return updateNode(f.NewNonNullExpression(expression, node.AsNode().Flags), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *NonNullExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) +} + +func (node *NonNullExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateNonNullExpression(node, v.visitNode(node.Expression)) +} + +func (node *NonNullExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewNonNullExpression(node.Expression, node.Flags), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *NonNullExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | SubtreeContainsTypeScript +} + +func IsNonNullExpression(node *Node) bool { + return node.Kind == KindNonNullExpression +} + +// SpreadElement + +type SpreadElement struct { + ExpressionBase + Expression *Expression // Expression +} + +func (f *NodeFactory) NewSpreadElement(expression *Expression) *Node { + data := &SpreadElement{} + data.Expression = expression + return f.newNode(KindSpreadElement, data) +} + +func (f *NodeFactory) UpdateSpreadElement(node *SpreadElement, expression *Expression) *Node { + if expression != node.Expression { + return updateNode(f.NewSpreadElement(expression), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *SpreadElement) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) +} + +func (node *SpreadElement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateSpreadElement(node, v.visitNode(node.Expression)) +} + +func (node *SpreadElement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewSpreadElement(node.Expression), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *SpreadElement) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | SubtreeContainsRestOrSpread +} + +func IsSpreadElement(node *Node) bool { + return node.Kind == KindSpreadElement +} + +// TemplateExpression + +type TemplateExpression struct { + ExpressionBase + compositeNodeBase + Head *TemplateHeadNode // TemplateHeadNode + TemplateSpans *NodeList // NodeList[*TemplateSpanNode] +} + +func (f *NodeFactory) NewTemplateExpression(head *TemplateHeadNode, templateSpans *NodeList) *Node { + data := &TemplateExpression{} + data.Head = head + data.TemplateSpans = templateSpans + return f.newNode(KindTemplateExpression, data) +} + +func (f *NodeFactory) UpdateTemplateExpression(node *TemplateExpression, head *TemplateHeadNode, templateSpans *TemplateSpanList) *Node { + if head != node.Head || templateSpans != node.TemplateSpans { + return updateNode(f.NewTemplateExpression(head, templateSpans), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *TemplateExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Head) || visitNodeList(v, node.TemplateSpans) +} + +func (node *TemplateExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateTemplateExpression(node, v.visitNode(node.Head), v.visitNodes(node.TemplateSpans)) +} + +func (node *TemplateExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewTemplateExpression(node.Head, node.TemplateSpans), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *TemplateExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Head) | + propagateNodeListSubtreeFacts(node.TemplateSpans, propagateSubtreeFacts) +} + +func IsTemplateExpression(node *Node) bool { + return node.Kind == KindTemplateExpression +} + +// TemplateLiteralTypeSpan + +type TemplateSpan struct { + NodeBase + Expression *Expression // Expression + Literal *TemplateMiddleOrTail // TemplateMiddleOrTail +} + +func (f *NodeFactory) NewTemplateSpan(expression *Expression, literal *TemplateMiddleOrTail) *Node { + data := &TemplateSpan{} + data.Expression = expression + data.Literal = literal + return f.newNode(KindTemplateSpan, data) +} + +func (f *NodeFactory) UpdateTemplateSpan(node *TemplateSpan, expression *Expression, literal *TemplateMiddleOrTail) *Node { + if expression != node.Expression || literal != node.Literal { + return updateNode(f.NewTemplateSpan(expression, literal), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *TemplateSpan) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) || visit(v, node.Literal) +} + +func (node *TemplateSpan) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateTemplateSpan(node, v.visitNode(node.Expression), v.visitNode(node.Literal)) +} + +func (node *TemplateSpan) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewTemplateSpan(node.Expression, node.Literal), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *TemplateSpan) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) +} + +func IsTemplateSpan(node *Node) bool { + return node.Kind == KindTemplateSpan +} + +// TaggedTemplateExpression + +type TaggedTemplateExpression struct { + ExpressionBase + compositeNodeBase + Tag *Expression // Expression + QuestionDotToken *TokenNode // TokenNode. For error reporting purposes only + TypeArguments *NodeList // NodeList[*TypeNode]. Optional + Template *TemplateLiteral // TemplateLiteral +} + +func (f *NodeFactory) NewTaggedTemplateExpression(tag *Expression, questionDotToken *TokenNode, typeArguments *NodeList, template *TemplateLiteral, flags NodeFlags) *Node { + data := &TaggedTemplateExpression{} + data.Tag = tag + data.QuestionDotToken = questionDotToken + data.TypeArguments = typeArguments + data.Template = template + node := f.newNode(KindTaggedTemplateExpression, data) + node.Flags |= flags & NodeFlagsOptionalChain + return node +} + +func (f *NodeFactory) UpdateTaggedTemplateExpression(node *TaggedTemplateExpression, tag *Expression, questionDotToken *TokenNode, typeArguments *TypeArgumentList, template *TemplateLiteral) *Node { + if tag != node.Tag || questionDotToken != node.QuestionDotToken || typeArguments != node.TypeArguments || template != node.Template { + return updateNode(f.NewTaggedTemplateExpression(tag, questionDotToken, typeArguments, template, node.Flags), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *TaggedTemplateExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Tag) || visit(v, node.QuestionDotToken) || visitNodeList(v, node.TypeArguments) || visit(v, node.Template) +} + +func (node *TaggedTemplateExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateTaggedTemplateExpression(node, v.visitNode(node.Tag), v.visitToken(node.QuestionDotToken), v.visitNodes(node.TypeArguments), v.visitNode(node.Template)) +} + +func (node *TaggedTemplateExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewTaggedTemplateExpression(node.Tag, node.QuestionDotToken, node.TypeArguments, node.Template, node.Flags), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *TaggedTemplateExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Tag) | + propagateSubtreeFacts(node.QuestionDotToken) | + propagateEraseableSyntaxListSubtreeFacts(node.TypeArguments) | + propagateSubtreeFacts(node.Template) +} + +func IsTaggedTemplateExpression(node *Node) bool { + return node.Kind == KindTaggedTemplateExpression +} + +// ParenthesizedExpression + +type ParenthesizedExpression struct { + ExpressionBase + Expression *Expression // Expression +} + +func (f *NodeFactory) NewParenthesizedExpression(expression *Expression) *Node { + data := f.parenthesizedExpressionPool.New() + data.Expression = expression + return f.newNode(KindParenthesizedExpression, data) +} + +func (f *NodeFactory) UpdateParenthesizedExpression(node *ParenthesizedExpression, expression *Expression) *Node { + if expression != node.Expression { + return updateNode(f.NewParenthesizedExpression(expression), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ParenthesizedExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) +} + +func (node *ParenthesizedExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateParenthesizedExpression(node, v.visitNode(node.Expression)) +} + +func (node *ParenthesizedExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewParenthesizedExpression(node.Expression), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ParenthesizedExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) +} + +func (node *ParenthesizedExpression) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsOuterExpression +} + +func IsParenthesizedExpression(node *Node) bool { + return node.Kind == KindParenthesizedExpression +} + +// ArrayLiteralExpression + +type ArrayLiteralExpression struct { + ExpressionBase + compositeNodeBase + Elements *NodeList // NodeList[*Expression] + MultiLine bool +} + +func (f *NodeFactory) NewArrayLiteralExpression(elements *NodeList, multiLine bool) *Node { + data := &ArrayLiteralExpression{} + data.Elements = elements + data.MultiLine = multiLine + return f.newNode(KindArrayLiteralExpression, data) +} + +func (f *NodeFactory) UpdateArrayLiteralExpression(node *ArrayLiteralExpression, elements *ElementList) *Node { + if elements != node.Elements { + return updateNode(f.NewArrayLiteralExpression(elements, node.MultiLine), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ArrayLiteralExpression) ForEachChild(v Visitor) bool { + return visitNodeList(v, node.Elements) +} + +func (node *ArrayLiteralExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateArrayLiteralExpression(node, v.visitNodes(node.Elements)) +} + +func (node *ArrayLiteralExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewArrayLiteralExpression(node.Elements, node.MultiLine), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ArrayLiteralExpression) computeSubtreeFacts() SubtreeFacts { + return propagateNodeListSubtreeFacts(node.Elements, propagateSubtreeFacts) +} + +func (node *ArrayLiteralExpression) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsArrayLiteral +} + +func IsArrayLiteralExpression(node *Node) bool { + return node.Kind == KindArrayLiteralExpression +} + +// ObjectLiteralExpression + +type ObjectLiteralExpression struct { + ExpressionBase + DeclarationBase + compositeNodeBase + Properties *NodeList // NodeList[*ObjectLiteralElement] + MultiLine bool +} + +func (f *NodeFactory) NewObjectLiteralExpression(properties *NodeList, multiLine bool) *Node { + data := &ObjectLiteralExpression{} + data.Properties = properties + data.MultiLine = multiLine + return f.newNode(KindObjectLiteralExpression, data) +} + +func (f *NodeFactory) UpdateObjectLiteralExpression(node *ObjectLiteralExpression, properties *PropertyDefinitionList) *Node { + if properties != node.Properties { + return updateNode(f.NewObjectLiteralExpression(properties, node.MultiLine), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ObjectLiteralExpression) ForEachChild(v Visitor) bool { + return visitNodeList(v, node.Properties) +} + +func (node *ObjectLiteralExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateObjectLiteralExpression(node, v.visitNodes(node.Properties)) +} + +func (node *ObjectLiteralExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewObjectLiteralExpression(node.Properties, node.MultiLine), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ObjectLiteralExpression) computeSubtreeFacts() SubtreeFacts { + return propagateNodeListSubtreeFacts(node.Properties, propagateSubtreeFacts) +} + +func (node *ObjectLiteralExpression) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsObjectLiteral +} + +func IsObjectLiteralExpression(node *Node) bool { + return node.Kind == KindObjectLiteralExpression +} + +// ObjectLiteralElementBase + +type ObjectLiteralElementBase struct{} + +// SpreadAssignment + +type SpreadAssignment struct { + NodeBase + DeclarationBase + ObjectLiteralElementBase + Expression *Expression // Expression +} + +func (f *NodeFactory) NewSpreadAssignment(expression *Expression) *Node { + data := &SpreadAssignment{} + data.Expression = expression + return f.newNode(KindSpreadAssignment, data) +} + +func (f *NodeFactory) UpdateSpreadAssignment(node *SpreadAssignment, expression *Expression) *Node { + if expression != node.Expression { + return updateNode(f.NewSpreadAssignment(expression), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *SpreadAssignment) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) +} + +func (node *SpreadAssignment) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateSpreadAssignment(node, v.visitNode(node.Expression)) +} + +func (node *SpreadAssignment) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewSpreadAssignment(node.Expression), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *SpreadAssignment) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | SubtreeContainsESObjectRestOrSpread | SubtreeContainsObjectRestOrSpread +} + +func IsSpreadAssignment(node *Node) bool { + return node.Kind == KindSpreadAssignment +} + +// PropertyAssignment + +type PropertyAssignment struct { + NodeBase + NamedMemberBase + ObjectLiteralElementBase + compositeNodeBase + Type *TypeNode // TypeNode. Only set by JSDoc @type tags. + Initializer *Expression // Expression +} + +func (f *NodeFactory) NewPropertyAssignment(modifiers *ModifierList, name *PropertyName, postfixToken *TokenNode, typeNode *TypeNode, initializer *Expression) *Node { + data := f.propertyAssignmentPool.New() + data.modifiers = modifiers + data.name = name + data.PostfixToken = postfixToken + data.Type = typeNode + data.Initializer = initializer + return f.newNode(KindPropertyAssignment, data) +} + +func (f *NodeFactory) UpdatePropertyAssignment(node *PropertyAssignment, modifiers *ModifierList, name *PropertyName, postfixToken *TokenNode, typeNode *TypeNode, initializer *Expression) *Node { + if modifiers != node.modifiers || name != node.name || postfixToken != node.PostfixToken || typeNode != node.Type || initializer != node.Initializer { + return updateNode(f.NewPropertyAssignment(modifiers, name, postfixToken, typeNode, initializer), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *PropertyAssignment) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.name) || visit(v, node.PostfixToken) || visit(v, node.Type) || visit(v, node.Initializer) +} + +func (node *PropertyAssignment) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdatePropertyAssignment(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitToken(node.PostfixToken), v.visitNode(node.Type), v.visitNode(node.Initializer)) +} + +func (node *PropertyAssignment) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewPropertyAssignment(node.Modifiers(), node.Name(), node.PostfixToken, node.Type, node.Initializer), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *PropertyAssignment) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.name) | + propagateSubtreeFacts(node.Type) | + propagateSubtreeFacts(node.Initializer) +} + +func IsPropertyAssignment(node *Node) bool { + return node.Kind == KindPropertyAssignment +} + +// ShorthandPropertyAssignment + +type ShorthandPropertyAssignment struct { + NodeBase + NamedMemberBase + ObjectLiteralElementBase + compositeNodeBase + Type *TypeNode // TypeNode. Only set by JSDoc @type tags. + EqualsToken *TokenNode + ObjectAssignmentInitializer *Expression // Optional +} + +func (f *NodeFactory) NewShorthandPropertyAssignment(modifiers *ModifierList, name *PropertyName, postfixToken *TokenNode, typeNode *TypeNode, equalsToken *TokenNode, objectAssignmentInitializer *Expression) *Node { + data := &ShorthandPropertyAssignment{} + data.modifiers = modifiers + data.name = name + data.PostfixToken = postfixToken + data.Type = typeNode + data.EqualsToken = equalsToken + data.ObjectAssignmentInitializer = objectAssignmentInitializer + return f.newNode(KindShorthandPropertyAssignment, data) +} + +func (f *NodeFactory) UpdateShorthandPropertyAssignment(node *ShorthandPropertyAssignment, modifiers *ModifierList, name *PropertyName, postfixToken *TokenNode, typeNode *TypeNode, equalsToken *TokenNode, objectAssignmentInitializer *Expression) *Node { + if modifiers != node.modifiers || name != node.name || typeNode != node.Type || postfixToken != node.PostfixToken || objectAssignmentInitializer != node.ObjectAssignmentInitializer { + return updateNode(f.NewShorthandPropertyAssignment(modifiers, name, postfixToken, typeNode, equalsToken, objectAssignmentInitializer), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ShorthandPropertyAssignment) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visit(v, node.name) || visit(v, node.Type) || visit(v, node.PostfixToken) || visit(v, node.EqualsToken) || visit(v, node.ObjectAssignmentInitializer) +} + +func (node *ShorthandPropertyAssignment) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateShorthandPropertyAssignment(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitToken(node.PostfixToken), v.visitNode(node.Type), v.visitToken(node.EqualsToken), v.visitNode(node.ObjectAssignmentInitializer)) +} + +func (node *ShorthandPropertyAssignment) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewShorthandPropertyAssignment(node.Modifiers(), node.Name(), node.PostfixToken, node.Type, node.EqualsToken, node.ObjectAssignmentInitializer), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ShorthandPropertyAssignment) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.name) | // we do not use propagateSubtreeFacts here because this is an IdentifierReference + propagateSubtreeFacts(node.Type) | + propagateSubtreeFacts(node.ObjectAssignmentInitializer) | + SubtreeContainsTypeScript // may require rewriting in a TypeScript namespace +} + +func IsShorthandPropertyAssignment(node *Node) bool { + return node.Kind == KindShorthandPropertyAssignment +} + +// DeleteExpression + +type DeleteExpression struct { + ExpressionBase + Expression *Expression // Expression +} + +func (f *NodeFactory) NewDeleteExpression(expression *Expression) *Node { + data := &DeleteExpression{} + data.Expression = expression + return f.newNode(KindDeleteExpression, data) +} + +func (f *NodeFactory) UpdateDeleteExpression(node *DeleteExpression, expression *Expression) *Node { + if expression != node.Expression { + return updateNode(f.NewDeleteExpression(expression), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *DeleteExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) +} + +func (node *DeleteExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateDeleteExpression(node, v.visitNode(node.Expression)) +} + +func (node *DeleteExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewDeleteExpression(node.Expression), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *DeleteExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) +} + +// TypeOfExpression + +type TypeOfExpression struct { + ExpressionBase + Expression *Expression // Expression +} + +func (f *NodeFactory) NewTypeOfExpression(expression *Expression) *Node { + data := &TypeOfExpression{} + data.Expression = expression + return f.newNode(KindTypeOfExpression, data) +} + +func (f *NodeFactory) UpdateTypeOfExpression(node *TypeOfExpression, expression *Expression) *Node { + if expression != node.Expression { + return updateNode(f.NewTypeOfExpression(expression), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *TypeOfExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) +} + +func (node *TypeOfExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateTypeOfExpression(node, v.visitNode(node.Expression)) +} + +func (node *TypeOfExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewTypeOfExpression(node.Expression), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *TypeOfExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) +} + +func IsTypeOfExpression(node *Node) bool { + return node.Kind == KindTypeOfExpression +} + +// VoidExpression + +type VoidExpression struct { + ExpressionBase + Expression *Expression // Expression +} + +func (f *NodeFactory) NewVoidExpression(expression *Expression) *Node { + data := &VoidExpression{} + data.Expression = expression + return f.newNode(KindVoidExpression, data) +} + +func (f *NodeFactory) UpdateVoidExpression(node *VoidExpression, expression *Expression) *Node { + if expression != node.Expression { + return updateNode(f.NewVoidExpression(expression), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *VoidExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) +} + +func (node *VoidExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateVoidExpression(node, v.visitNode(node.Expression)) +} + +func (node *VoidExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewVoidExpression(node.Expression), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *VoidExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) +} + +// AwaitExpression + +type AwaitExpression struct { + ExpressionBase + Expression *Expression // Expression +} + +func (f *NodeFactory) NewAwaitExpression(expression *Expression) *Node { + data := &AwaitExpression{} + data.Expression = expression + return f.newNode(KindAwaitExpression, data) +} + +func (f *NodeFactory) UpdateAwaitExpression(node *AwaitExpression, expression *Expression) *Node { + if expression != node.Expression { + return updateNode(f.NewAwaitExpression(expression), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *AwaitExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) +} + +func (node *AwaitExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateAwaitExpression(node, v.visitNode(node.Expression)) +} + +func (node *AwaitExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewAwaitExpression(node.Expression), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *AwaitExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | SubtreeContainsAwait +} + +func IsAwaitExpression(node *Node) bool { + return node.Kind == KindAwaitExpression +} + +// TypeAssertion + +type TypeAssertion struct { + ExpressionBase + Type *TypeNode // TypeNode + Expression *Expression // Expression +} + +func (f *NodeFactory) NewTypeAssertion(typeNode *TypeNode, expression *Expression) *Node { + data := &TypeAssertion{} + data.Type = typeNode + data.Expression = expression + return f.newNode(KindTypeAssertionExpression, data) +} + +func (f *NodeFactory) UpdateTypeAssertion(node *TypeAssertion, typeNode *TypeNode, expression *Expression) *Node { + if typeNode != node.Type || expression != node.Expression { + return updateNode(f.NewTypeAssertion(typeNode, expression), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *TypeAssertion) ForEachChild(v Visitor) bool { + return visit(v, node.Type) || visit(v, node.Expression) +} + +func (node *TypeAssertion) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateTypeAssertion(node, v.visitNode(node.Type), v.visitNode(node.Expression)) +} + +func (node *TypeAssertion) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewTypeAssertion(node.Type, node.Expression), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *TypeAssertion) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | SubtreeContainsTypeScript +} + +func (node *TypeAssertion) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsOuterExpression +} + +// TypeNodeBase + +type TypeNodeBase struct { + NodeBase + typeSyntaxBase +} + +// KeywordTypeNode + +type KeywordTypeNode struct { + TypeNodeBase +} + +func (f *NodeFactory) NewKeywordTypeNode(kind Kind) *Node { + return f.newNode(kind, f.keywordTypeNodePool.New()) +} + +func (node *KeywordTypeNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewKeywordTypeNode(node.Kind), node.AsNode(), f.AsNodeFactory().hooks) +} + +// UnionOrIntersectionTypeBase + +type UnionOrIntersectionTypeNodeBase struct { + TypeNodeBase + Types *NodeList // NodeList[*TypeNode] +} + +func (node *UnionOrIntersectionTypeNodeBase) ForEachChild(v Visitor) bool { + return visitNodeList(v, node.Types) +} + +// UnionTypeNode + +type UnionTypeNode struct { + UnionOrIntersectionTypeNodeBase +} + +func (f *NodeFactory) UpdateUnionTypeNode(node *UnionTypeNode, types *TypeList) *Node { + if types != node.Types { + return updateNode(f.NewUnionTypeNode(types), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (f *NodeFactory) NewUnionTypeNode(types *NodeList) *Node { + data := f.unionTypeNodePool.New() + data.Types = types + return f.newNode(KindUnionType, data) +} + +func (node *UnionTypeNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateUnionTypeNode(node, v.visitNodes(node.Types)) +} + +func (node *UnionTypeNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewUnionTypeNode(node.Types), node.AsNode(), f.AsNodeFactory().hooks) +} + +// IntersectionTypeNode + +type IntersectionTypeNode struct { + UnionOrIntersectionTypeNodeBase +} + +func (f *NodeFactory) UpdateIntersectionTypeNode(node *IntersectionTypeNode, types *TypeList) *Node { + if types != node.Types { + return updateNode(f.NewIntersectionTypeNode(types), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (f *NodeFactory) NewIntersectionTypeNode(types *NodeList) *Node { + data := f.intersectionTypeNodePool.New() + data.Types = types + return f.newNode(KindIntersectionType, data) +} + +func (node *IntersectionTypeNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateIntersectionTypeNode(node, v.visitNodes(node.Types)) +} + +func (node *IntersectionTypeNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewIntersectionTypeNode(node.Types), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsIntersectionTypeNode(node *Node) bool { + return node.Kind == KindIntersectionType +} + +// ConditionalTypeNode + +type ConditionalTypeNode struct { + TypeNodeBase + LocalsContainerBase + CheckType *TypeNode // TypeNode + ExtendsType *TypeNode // TypeNode + TrueType *TypeNode // TypeNode + FalseType *TypeNode // TypeNode +} + +func (f *NodeFactory) NewConditionalTypeNode(checkType *TypeNode, extendsType *TypeNode, trueType *TypeNode, falseType *TypeNode) *Node { + data := &ConditionalTypeNode{} + data.CheckType = checkType + data.ExtendsType = extendsType + data.TrueType = trueType + data.FalseType = falseType + return f.newNode(KindConditionalType, data) +} + +func (f *NodeFactory) UpdateConditionalTypeNode(node *ConditionalTypeNode, checkType *TypeNode, extendsType *TypeNode, trueType *TypeNode, falseType *TypeNode) *Node { + if checkType != node.CheckType || extendsType != node.ExtendsType || trueType != node.TrueType || falseType != node.FalseType { + return updateNode(f.NewConditionalTypeNode(checkType, extendsType, trueType, falseType), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ConditionalTypeNode) ForEachChild(v Visitor) bool { + return visit(v, node.CheckType) || visit(v, node.ExtendsType) || visit(v, node.TrueType) || visit(v, node.FalseType) +} + +func (node *ConditionalTypeNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateConditionalTypeNode(node, v.visitNode(node.CheckType), v.visitNode(node.ExtendsType), v.visitNode(node.TrueType), v.visitNode(node.FalseType)) +} + +func (node *ConditionalTypeNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewConditionalTypeNode(node.CheckType, node.ExtendsType, node.TrueType, node.FalseType), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsConditionalTypeNode(node *Node) bool { + return node.Kind == KindConditionalType +} + +// TypeOperatorNode + +type TypeOperatorNode struct { + TypeNodeBase + Operator Kind // KindKeyOfKeyword | KindUniqueKeyword | KindReadonlyKeyword + Type *TypeNode // TypeNode +} + +func (f *NodeFactory) NewTypeOperatorNode(operator Kind, typeNode *TypeNode) *Node { + data := f.typeOperatorNodePool.New() + data.Operator = operator + data.Type = typeNode + return f.newNode(KindTypeOperator, data) +} + +func (f *NodeFactory) UpdateTypeOperatorNode(node *TypeOperatorNode, typeNode *TypeNode) *Node { + if typeNode != node.Type { + return updateNode(f.NewTypeOperatorNode(node.Operator, typeNode), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *TypeOperatorNode) ForEachChild(v Visitor) bool { + return visit(v, node.Type) +} + +func (node *TypeOperatorNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateTypeOperatorNode(node, v.visitNode(node.Type)) +} + +func (node *TypeOperatorNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewTypeOperatorNode(node.Operator, node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsTypeOperatorNode(node *Node) bool { + return node.Kind == KindTypeOperator +} + +// InferTypeNode + +type InferTypeNode struct { + TypeNodeBase + TypeParameter *TypeParameterDeclarationNode // TypeParameterDeclarationNode +} + +func (f *NodeFactory) NewInferTypeNode(typeParameter *TypeParameterDeclarationNode) *Node { + data := &InferTypeNode{} + data.TypeParameter = typeParameter + return f.newNode(KindInferType, data) +} + +func (f *NodeFactory) UpdateInferTypeNode(node *InferTypeNode, typeParameter *TypeNode) *Node { + if typeParameter != node.TypeParameter { + return updateNode(f.NewInferTypeNode(typeParameter), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *InferTypeNode) ForEachChild(v Visitor) bool { + return visit(v, node.TypeParameter) +} + +func (node *InferTypeNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateInferTypeNode(node, v.visitNode(node.TypeParameter)) +} + +func (node *InferTypeNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewInferTypeNode(node.TypeParameter), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsInferTypeNode(node *Node) bool { + return node.Kind == KindInferType +} + +// ArrayTypeNode + +type ArrayTypeNode struct { + TypeNodeBase + ElementType *TypeNode // TypeNode +} + +func (f *NodeFactory) NewArrayTypeNode(elementType *TypeNode) *Node { + data := f.arrayTypeNodePool.New() + data.ElementType = elementType + return f.newNode(KindArrayType, data) +} + +func (f *NodeFactory) UpdateArrayTypeNode(node *ArrayTypeNode, elementType *TypeNode) *Node { + if elementType != node.ElementType { + return updateNode(f.NewArrayTypeNode(elementType), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ArrayTypeNode) ForEachChild(v Visitor) bool { + return visit(v, node.ElementType) +} + +func (node *ArrayTypeNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateArrayTypeNode(node, v.visitNode(node.ElementType)) +} + +func (node *ArrayTypeNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewArrayTypeNode(node.ElementType), node.AsNode(), f.AsNodeFactory().hooks) +} + +// IndexedAccessTypeNode + +type IndexedAccessTypeNode struct { + TypeNodeBase + ObjectType *TypeNode // TypeNode + IndexType *TypeNode // TypeNode +} + +func (f *NodeFactory) NewIndexedAccessTypeNode(objectType *TypeNode, indexType *TypeNode) *Node { + data := f.indexedAccessTypeNodePool.New() + data.ObjectType = objectType + data.IndexType = indexType + return f.newNode(KindIndexedAccessType, data) +} + +func (f *NodeFactory) UpdateIndexedAccessTypeNode(node *IndexedAccessTypeNode, objectType *TypeNode, indexType *TypeNode) *Node { + if objectType != node.ObjectType || indexType != node.IndexType { + return updateNode(f.NewIndexedAccessTypeNode(objectType, indexType), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *IndexedAccessTypeNode) ForEachChild(v Visitor) bool { + return visit(v, node.ObjectType) || visit(v, node.IndexType) +} + +func (node *IndexedAccessTypeNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateIndexedAccessTypeNode(node, v.visitNode(node.ObjectType), v.visitNode(node.IndexType)) +} + +func (node *IndexedAccessTypeNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewIndexedAccessTypeNode(node.ObjectType, node.IndexType), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsIndexedAccessTypeNode(node *Node) bool { + return node.Kind == KindIndexedAccessType +} + +// TypeReferenceNode + +type TypeReferenceNode struct { + TypeNodeBase + TypeName *EntityName // EntityName + TypeArguments *NodeList // NodeList[*TypeNode]. Optional +} + +func (f *NodeFactory) NewTypeReferenceNode(typeName *EntityName, typeArguments *NodeList) *Node { + data := f.typeReferenceNodePool.New() + data.TypeName = typeName + data.TypeArguments = typeArguments + return f.newNode(KindTypeReference, data) +} + +func (f *NodeFactory) UpdateTypeReferenceNode(node *TypeReferenceNode, typeName *EntityName, typeArguments *TypeArgumentList) *Node { + if typeName != node.TypeName || typeArguments != node.TypeArguments { + return updateNode(f.NewTypeReferenceNode(typeName, typeArguments), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *TypeReferenceNode) ForEachChild(v Visitor) bool { + return visit(v, node.TypeName) || visitNodeList(v, node.TypeArguments) +} + +func (node *TypeReferenceNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateTypeReferenceNode(node, v.visitNode(node.TypeName), v.visitNodes(node.TypeArguments)) +} + +func (node *TypeReferenceNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewTypeReferenceNode(node.TypeName, node.TypeArguments), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsTypeReferenceNode(node *Node) bool { + return node.Kind == KindTypeReference +} + +// ExpressionWithTypeArguments + +type ExpressionWithTypeArguments struct { + ExpressionBase + compositeNodeBase + Expression *Expression // Expression + TypeArguments *NodeList // NodeList[*TypeNode]. Optional +} + +func (f *NodeFactory) NewExpressionWithTypeArguments(expression *Expression, typeArguments *NodeList) *Node { + data := f.expressionWithTypeArgumentsPool.New() + data.Expression = expression + data.TypeArguments = typeArguments + return f.newNode(KindExpressionWithTypeArguments, data) +} + +func (f *NodeFactory) UpdateExpressionWithTypeArguments(node *ExpressionWithTypeArguments, expression *Expression, typeArguments *TypeArgumentList) *Node { + if expression != node.Expression || typeArguments != node.TypeArguments { + return updateNode(f.NewExpressionWithTypeArguments(expression, typeArguments), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ExpressionWithTypeArguments) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) || visitNodeList(v, node.TypeArguments) +} + +func (node *ExpressionWithTypeArguments) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateExpressionWithTypeArguments(node, v.visitNode(node.Expression), v.visitNodes(node.TypeArguments)) +} + +func (node *ExpressionWithTypeArguments) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewExpressionWithTypeArguments(node.Expression, node.TypeArguments), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ExpressionWithTypeArguments) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | + propagateEraseableSyntaxListSubtreeFacts(node.TypeArguments) +} + +func IsExpressionWithTypeArguments(node *Node) bool { + return node.Kind == KindExpressionWithTypeArguments +} + +// LiteralTypeNode + +type LiteralTypeNode struct { + TypeNodeBase + Literal *Node // KeywordExpression | LiteralExpression | PrefixUnaryExpression +} + +func (f *NodeFactory) NewLiteralTypeNode(literal *Node) *Node { + data := f.literalTypeNodePool.New() + data.Literal = literal + return f.newNode(KindLiteralType, data) +} + +func (f *NodeFactory) UpdateLiteralTypeNode(node *LiteralTypeNode, literal *Node) *Node { + if literal != node.Literal { + return updateNode(f.NewLiteralTypeNode(literal), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *LiteralTypeNode) ForEachChild(v Visitor) bool { + return visit(v, node.Literal) +} + +func (node *LiteralTypeNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateLiteralTypeNode(node, v.visitNode(node.Literal)) +} + +func (node *LiteralTypeNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewLiteralTypeNode(node.Literal), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsLiteralTypeNode(node *Node) bool { + return node.Kind == KindLiteralType +} + +// ThisTypeNode + +type ThisTypeNode struct { + TypeNodeBase +} + +func (f *NodeFactory) NewThisTypeNode() *Node { + return f.newNode(KindThisType, &ThisTypeNode{}) +} + +func (node *ThisTypeNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewThisTypeNode(), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsThisTypeNode(node *Node) bool { + return node.Kind == KindThisType +} + +// TypePredicateNode + +type TypePredicateNode struct { + TypeNodeBase + AssertsModifier *TokenNode // TokenNode. Optional + ParameterName *TypePredicateParameterName // TypePredicateParameterName (Identifier | ThisTypeNode) + Type *TypeNode // TypeNode. Optional +} + +func (f *NodeFactory) NewTypePredicateNode(assertsModifier *TokenNode, parameterName *TypePredicateParameterName, typeNode *TypeNode) *Node { + data := &TypePredicateNode{} + data.AssertsModifier = assertsModifier + data.ParameterName = parameterName + data.Type = typeNode + return f.newNode(KindTypePredicate, data) +} + +func (f *NodeFactory) UpdateTypePredicateNode(node *TypePredicateNode, assertsModifier *TokenNode, parameterName *TypePredicateParameterName, typeNode *TypeNode) *Node { + if assertsModifier != node.AssertsModifier || parameterName != node.ParameterName || typeNode != node.Type { + return updateNode(f.NewTypePredicateNode(assertsModifier, parameterName, typeNode), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *TypePredicateNode) ForEachChild(v Visitor) bool { + return visit(v, node.AssertsModifier) || visit(v, node.ParameterName) || visit(v, node.Type) +} + +func (node *TypePredicateNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateTypePredicateNode(node, v.visitNode(node.AssertsModifier), v.visitNode(node.ParameterName), v.visitNode(node.Type)) +} + +func (node *TypePredicateNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewTypePredicateNode(node.AssertsModifier, node.ParameterName, node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsTypePredicateNode(node *Node) bool { + return node.Kind == KindTypePredicate +} + +// ImportTypeNode + +type ImportTypeNode struct { + TypeNodeBase + IsTypeOf bool + Argument *TypeNode // TypeNode + Attributes *ImportAttributesNode // ImportAttributesNode. Optional + Qualifier *EntityName // EntityName. Optional + TypeArguments *NodeList // NodeList[*TypeNode]. Optional +} + +func (f *NodeFactory) NewImportTypeNode(isTypeOf bool, argument *TypeNode, attributes *ImportAttributesNode, qualifier *EntityName, typeArguments *NodeList) *Node { + data := &ImportTypeNode{} + data.IsTypeOf = isTypeOf + data.Argument = argument + data.Attributes = attributes + data.Qualifier = qualifier + data.TypeArguments = typeArguments + return f.newNode(KindImportType, data) +} + +func (f *NodeFactory) UpdateImportTypeNode(node *ImportTypeNode, isTypeOf bool, argument *TypeNode, attributes *ImportAttributesNode, qualifier *EntityName, typeArguments *TypeArgumentList) *Node { + if isTypeOf != node.IsTypeOf || argument != node.Argument || attributes != node.Attributes || qualifier != node.Qualifier || typeArguments != node.TypeArguments { + return updateNode(f.NewImportTypeNode(isTypeOf, argument, attributes, qualifier, typeArguments), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ImportTypeNode) ForEachChild(v Visitor) bool { + return visit(v, node.Argument) || visit(v, node.Attributes) || visit(v, node.Qualifier) || visitNodeList(v, node.TypeArguments) +} + +func (node *ImportTypeNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateImportTypeNode(node, node.IsTypeOf, v.visitNode(node.Argument), v.visitNode(node.Attributes), v.visitNode(node.Qualifier), v.visitNodes(node.TypeArguments)) +} + +func (node *ImportTypeNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewImportTypeNode(node.IsTypeOf, node.Argument, node.Attributes, node.Qualifier, node.TypeArguments), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsImportTypeNode(node *Node) bool { + return node.Kind == KindImportType +} + +// ImportAttribute + +type ImportAttribute struct { + NodeBase + compositeNodeBase + name *ImportAttributeName // ImportAttributeName + Value *Expression // Expression +} + +func (f *NodeFactory) NewImportAttribute(name *ImportAttributeName, value *Expression) *Node { + data := &ImportAttribute{} + data.name = name + data.Value = value + return f.newNode(KindImportAttribute, data) +} + +func (f *NodeFactory) UpdateImportAttribute(node *ImportAttribute, name *ImportAttributeName, value *Expression) *Node { + if name != node.name || value != node.Value { + return updateNode(f.NewImportAttribute(name, value), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ImportAttribute) ForEachChild(v Visitor) bool { + return visit(v, node.name) || visit(v, node.Value) +} + +func (node *ImportAttribute) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateImportAttribute(node, v.visitNode(node.name), v.visitNode(node.Value)) +} + +func (node *ImportAttribute) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewImportAttribute(node.Name(), node.Value), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ImportAttribute) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.name) | + propagateSubtreeFacts(node.Value) +} + +func (node *ImportAttribute) Name() *ImportAttributeName { + return node.name +} + +// ImportAttributes + +type ImportAttributes struct { + NodeBase + compositeNodeBase + Token Kind + Attributes *NodeList // NodeList[*ImportAttributeNode] + MultiLine bool +} + +func (f *NodeFactory) NewImportAttributes(token Kind, attributes *NodeList, multiLine bool) *Node { + data := &ImportAttributes{} + data.Token = token + data.Attributes = attributes + data.MultiLine = multiLine + return f.newNode(KindImportAttributes, data) +} + +func (f *NodeFactory) UpdateImportAttributes(node *ImportAttributes, attributes *ImportAttributeList) *Node { + if attributes != node.Attributes { + return updateNode(f.NewImportAttributes(node.Token, attributes, node.MultiLine), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ImportAttributes) ForEachChild(v Visitor) bool { + return visitNodeList(v, node.Attributes) +} + +func (node *ImportAttributes) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateImportAttributes(node, v.visitNodes(node.Attributes)) +} + +func (node *ImportAttributes) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewImportAttributes(node.Token, node.Attributes, node.MultiLine), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *ImportAttributes) computeSubtreeFacts() SubtreeFacts { + return propagateNodeListSubtreeFacts(node.Attributes, propagateSubtreeFacts) +} + +func IsImportAttributes(node *Node) bool { + return node.Kind == KindImportAttributes +} + +func (node *ImportAttributesNode) GetResolutionModeOverride( /* !!! grammarErrorOnNode?: (node: Node, diagnostic: DiagnosticMessage) => void*/ ) (core.ResolutionMode, bool) { + if node == nil { + return core.ResolutionModeNone, false + } + + attributes := node.AsImportAttributes().Attributes + + if len(attributes.Nodes) != 1 { + // !!! + // grammarErrorOnNode?.( + // node, + // node.token === SyntaxKind.WithKeyword + // ? Diagnostics.Type_import_attributes_should_have_exactly_one_key_resolution_mode_with_value_import_or_require + // : Diagnostics.Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require, + // ); + return core.ResolutionModeNone, false + } + + elem := attributes.Nodes[0].AsImportAttribute() + if !IsStringLiteralLike(elem.Name()) { + return core.ResolutionModeNone, false + } + if elem.Name().Text() != "resolution-mode" { + // !!! + // grammarErrorOnNode?.( + // elem.name, + // node.token === SyntaxKind.WithKeyword + // ? Diagnostics.resolution_mode_is_the_only_valid_key_for_type_import_attributes + // : Diagnostics.resolution_mode_is_the_only_valid_key_for_type_import_assertions, + // ); + return core.ResolutionModeNone, false + } + if !IsStringLiteralLike(elem.Value) { + return core.ResolutionModeNone, false + } + if elem.Value.Text() != "import" && elem.Value.Text() != "require" { + // !!! + // grammarErrorOnNode?.(elem.value, Diagnostics.resolution_mode_should_be_either_require_or_import); + return core.ResolutionModeNone, false + } + if elem.Value.Text() == "import" { + return core.ResolutionModeESM, true + } else { + return core.ModuleKindCommonJS, true + } +} + +// TypeQueryNode + +type TypeQueryNode struct { + TypeNodeBase + ExprName *EntityName // EntityName + TypeArguments *NodeList // NodeList[*TypeNode]. Optional +} + +func (f *NodeFactory) NewTypeQueryNode(exprName *EntityName, typeArguments *NodeList) *Node { + data := &TypeQueryNode{} + data.ExprName = exprName + data.TypeArguments = typeArguments + return f.newNode(KindTypeQuery, data) +} + +func (f *NodeFactory) UpdateTypeQueryNode(node *TypeQueryNode, exprName *EntityName, typeArguments *TypeArgumentList) *Node { + if exprName != node.ExprName || typeArguments != node.TypeArguments { + return updateNode(f.NewTypeQueryNode(exprName, typeArguments), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *TypeQueryNode) ForEachChild(v Visitor) bool { + return visit(v, node.ExprName) || visitNodeList(v, node.TypeArguments) +} + +func (node *TypeQueryNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateTypeQueryNode(node, v.visitNode(node.ExprName), v.visitNodes(node.TypeArguments)) +} + +func (node *TypeQueryNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewTypeQueryNode(node.ExprName, node.TypeArguments), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsTypeQueryNode(node *Node) bool { + return node.Kind == KindTypeQuery +} + +// MappedTypeNode + +type MappedTypeNode struct { + TypeNodeBase + DeclarationBase + LocalsContainerBase + ReadonlyToken *TokenNode // TokenNode. Optional + TypeParameter *TypeParameterDeclarationNode // TypeParameterDeclarationNode + NameType *TypeNode // TypeNode. Optional + QuestionToken *TokenNode // TokenNode. Optional + Type *TypeNode // TypeNode. Optional (error if missing) + Members *NodeList // NodeList[*TypeElement]. Used only to produce grammar errors +} + +func (f *NodeFactory) NewMappedTypeNode(readonlyToken *TokenNode, typeParameter *TypeParameterDeclarationNode, nameType *TypeNode, questionToken *TokenNode, typeNode *TypeNode, members *NodeList) *Node { + data := &MappedTypeNode{} + data.ReadonlyToken = readonlyToken + data.TypeParameter = typeParameter + data.NameType = nameType + data.QuestionToken = questionToken + data.Type = typeNode + data.Members = members + return f.newNode(KindMappedType, data) +} + +func (f *NodeFactory) UpdateMappedTypeNode(node *MappedTypeNode, readonlyToken *TokenNode, typeParameter *TypeParameterDeclarationNode, nameType *TypeNode, questionToken *TokenNode, typeNode *TypeNode, members *TypeElementList) *Node { + if readonlyToken != node.ReadonlyToken || typeParameter != node.TypeParameter || nameType != node.NameType || questionToken != node.QuestionToken || typeNode != node.Type || members != node.Members { + return updateNode(f.NewMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, typeNode, members), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *MappedTypeNode) ForEachChild(v Visitor) bool { + return visit(v, node.ReadonlyToken) || visit(v, node.TypeParameter) || visit(v, node.NameType) || + visit(v, node.QuestionToken) || visit(v, node.Type) || visitNodeList(v, node.Members) +} + +func (node *MappedTypeNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateMappedTypeNode(node, v.visitToken(node.ReadonlyToken), v.visitNode(node.TypeParameter), v.visitNode(node.NameType), v.visitToken(node.QuestionToken), v.visitNode(node.Type), v.visitNodes(node.Members)) +} + +func (node *MappedTypeNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewMappedTypeNode(node.ReadonlyToken, node.TypeParameter, node.NameType, node.QuestionToken, node.Type, node.Members), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsMappedTypeNode(node *Node) bool { + return node.Kind == KindMappedType +} + +// TypeLiteralNode + +type TypeLiteralNode struct { + TypeNodeBase + DeclarationBase + Members *NodeList // NodeList[*TypeElement] +} + +func (f *NodeFactory) NewTypeLiteralNode(members *NodeList) *Node { + data := f.typeLiteralNodePool.New() + data.Members = members + return f.newNode(KindTypeLiteral, data) +} + +func (f *NodeFactory) UpdateTypeLiteralNode(node *TypeLiteralNode, members *TypeElementList) *Node { + if members != node.Members { + return updateNode(f.NewTypeLiteralNode(members), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *TypeLiteralNode) ForEachChild(v Visitor) bool { + return visitNodeList(v, node.Members) +} + +func (node *TypeLiteralNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateTypeLiteralNode(node, v.visitNodes(node.Members)) +} + +func (node *TypeLiteralNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewTypeLiteralNode(node.Members), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsTypeLiteralNode(node *Node) bool { + return node.Kind == KindTypeLiteral +} + +// TupleTypeNode + +type TupleTypeNode struct { + TypeNodeBase + Elements *NodeList // NodeList[*TypeNode] +} + +func (f *NodeFactory) NewTupleTypeNode(elements *NodeList) *Node { + data := &TupleTypeNode{} + data.Elements = elements + return f.newNode(KindTupleType, data) +} + +func (f *NodeFactory) UpdateTupleTypeNode(node *TupleTypeNode, elements *TypeList) *Node { + if elements != node.Elements { + return updateNode(f.NewTupleTypeNode(elements), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *TupleTypeNode) ForEachChild(v Visitor) bool { + return visitNodeList(v, node.Elements) +} + +func (node *TupleTypeNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateTupleTypeNode(node, v.visitNodes(node.Elements)) +} + +func (node *TupleTypeNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewTupleTypeNode(node.Elements), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsTupleTypeNode(node *Node) bool { + return node.Kind == KindTupleType +} + +// NamedTupleTypeMember + +type NamedTupleMember struct { + TypeNodeBase + DeclarationBase + DotDotDotToken *TokenNode // TokenNode + name *IdentifierNode // IdentifierNode + QuestionToken *TokenNode // TokenNode + Type *TypeNode // TypeNode +} + +func (f *NodeFactory) NewNamedTupleMember(dotDotDotToken *TokenNode, name *IdentifierNode, questionToken *TokenNode, typeNode *TypeNode) *Node { + data := &NamedTupleMember{} + data.DotDotDotToken = dotDotDotToken + data.name = name + data.QuestionToken = questionToken + data.Type = typeNode + return f.newNode(KindNamedTupleMember, data) +} + +func (f *NodeFactory) UpdateNamedTupleMember(node *NamedTupleMember, dotDotDotToken *TokenNode, name *IdentifierNode, questionToken *TokenNode, typeNode *TypeNode) *Node { + if dotDotDotToken != node.DotDotDotToken || name != node.name || questionToken != node.QuestionToken || typeNode != node.Type { + return updateNode(f.NewNamedTupleMember(dotDotDotToken, name, questionToken, typeNode), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *NamedTupleMember) ForEachChild(v Visitor) bool { + return visit(v, node.DotDotDotToken) || visit(v, node.name) || visit(v, node.QuestionToken) || visit(v, node.Type) +} + +func (node *NamedTupleMember) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateNamedTupleMember(node, v.visitToken(node.DotDotDotToken), v.visitNode(node.name), v.visitToken(node.QuestionToken), v.visitNode(node.Type)) +} + +func (node *NamedTupleMember) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewNamedTupleMember(node.DotDotDotToken, node.Name(), node.QuestionToken, node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *NamedTupleMember) Name() *DeclarationName { + return node.name +} + +func IsNamedTupleMember(node *Node) bool { + return node.Kind == KindNamedTupleMember +} + +// OptionalTypeNode + +type OptionalTypeNode struct { + TypeNodeBase + Type *TypeNode // TypeNode +} + +func (f *NodeFactory) NewOptionalTypeNode(typeNode *TypeNode) *Node { + data := &OptionalTypeNode{} + data.Type = typeNode + return f.newNode(KindOptionalType, data) +} + +func (f *NodeFactory) UpdateOptionalTypeNode(node *OptionalTypeNode, typeNode *TypeNode) *Node { + if typeNode != node.Type { + return updateNode(f.NewOptionalTypeNode(typeNode), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *OptionalTypeNode) ForEachChild(v Visitor) bool { + return visit(v, node.Type) +} + +func (node *OptionalTypeNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateOptionalTypeNode(node, v.visitNode(node.Type)) +} + +func (node *OptionalTypeNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewOptionalTypeNode(node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsOptionalTypeNode(node *Node) bool { + return node.Kind == KindOptionalType +} + +// RestTypeNode + +type RestTypeNode struct { + TypeNodeBase + Type *TypeNode // TypeNode +} + +func (f *NodeFactory) NewRestTypeNode(typeNode *TypeNode) *Node { + data := &RestTypeNode{} + data.Type = typeNode + return f.newNode(KindRestType, data) +} + +func (f *NodeFactory) UpdateRestTypeNode(node *RestTypeNode, typeNode *TypeNode) *Node { + if typeNode != node.Type { + return updateNode(f.NewRestTypeNode(typeNode), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *RestTypeNode) ForEachChild(v Visitor) bool { + return visit(v, node.Type) +} + +func (node *RestTypeNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateRestTypeNode(node, v.visitNode(node.Type)) +} + +func (node *RestTypeNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewRestTypeNode(node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsRestTypeNode(node *Node) bool { + return node.Kind == KindRestType +} + +// ParenthesizedTypeNode + +type ParenthesizedTypeNode struct { + TypeNodeBase + Type *TypeNode // TypeNode +} + +func (f *NodeFactory) NewParenthesizedTypeNode(typeNode *TypeNode) *Node { + data := f.parenthesizedTypeNodePool.New() + data.Type = typeNode + return f.newNode(KindParenthesizedType, data) +} + +func (f *NodeFactory) UpdateParenthesizedTypeNode(node *ParenthesizedTypeNode, typeNode *TypeNode) *Node { + if typeNode != node.Type { + return updateNode(f.NewParenthesizedTypeNode(typeNode), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ParenthesizedTypeNode) ForEachChild(v Visitor) bool { + return visit(v, node.Type) +} + +func (node *ParenthesizedTypeNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateParenthesizedTypeNode(node, v.visitNode(node.Type)) +} + +func (node *ParenthesizedTypeNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewParenthesizedTypeNode(node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsParenthesizedTypeNode(node *Node) bool { + return node.Kind == KindParenthesizedType +} + +// FunctionOrConstructorTypeNodeBase + +type FunctionOrConstructorTypeNodeBase struct { + TypeNodeBase + DeclarationBase + ModifiersBase + FunctionLikeBase +} + +func (node *FunctionOrConstructorTypeNodeBase) ForEachChild(v Visitor) bool { + return visitModifiers(v, node.modifiers) || visitNodeList(v, node.TypeParameters) || visitNodeList(v, node.Parameters) || visit(v, node.Type) +} + +// FunctionTypeNode + +type FunctionTypeNode struct { + FunctionOrConstructorTypeNodeBase +} + +func (f *NodeFactory) NewFunctionTypeNode(typeParameters *NodeList, parameters *NodeList, returnType *TypeNode) *Node { + data := f.functionTypeNodePool.New() + data.TypeParameters = typeParameters + data.Parameters = parameters + data.Type = returnType + return f.newNode(KindFunctionType, data) +} + +func (f *NodeFactory) UpdateFunctionTypeNode(node *FunctionTypeNode, typeParameters *TypeParameterList, parameters *ParameterList, returnType *TypeNode) *Node { + if typeParameters != node.TypeParameters || parameters != node.Parameters || returnType != node.Type { + return updateNode(f.NewFunctionTypeNode(typeParameters, parameters, returnType), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *FunctionTypeNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateFunctionTypeNode(node, v.visitNodes(node.TypeParameters), v.visitNodes(node.Parameters), v.visitNode(node.Type)) +} + +func (node *FunctionTypeNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewFunctionTypeNode(node.TypeParameters, node.Parameters, node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsFunctionTypeNode(node *Node) bool { + return node.Kind == KindFunctionType +} + +// ConstructorTypeNode + +type ConstructorTypeNode struct { + FunctionOrConstructorTypeNodeBase +} + +func (f *NodeFactory) NewConstructorTypeNode(modifiers *ModifierList, typeParameters *NodeList, parameters *NodeList, returnType *TypeNode) *Node { + data := &ConstructorTypeNode{} + data.modifiers = modifiers + data.TypeParameters = typeParameters + data.Parameters = parameters + data.Type = returnType + return f.newNode(KindConstructorType, data) +} + +func (f *NodeFactory) UpdateConstructorTypeNode(node *ConstructorTypeNode, modifiers *ModifierList, typeParameters *TypeParameterList, parameters *ParameterList, returnType *TypeNode) *Node { + if modifiers != node.modifiers || typeParameters != node.TypeParameters || parameters != node.Parameters || returnType != node.Type { + return updateNode(f.NewConstructorTypeNode(modifiers, typeParameters, parameters, returnType), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *ConstructorTypeNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateConstructorTypeNode(node, v.visitModifiers(node.modifiers), v.visitNodes(node.TypeParameters), v.visitNodes(node.Parameters), v.visitNode(node.Type)) +} + +func (node *ConstructorTypeNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewConstructorTypeNode(node.Modifiers(), node.TypeParameters, node.Parameters, node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsConstructorTypeNode(node *Node) bool { + return node.Kind == KindConstructorType +} + +// TemplateLiteralLikeBase + +type TemplateLiteralLikeBase struct { + LiteralLikeBase + RawText string + TemplateFlags TokenFlags +} + +func (node *TemplateLiteralLikeBase) LiteralLikeData() *LiteralLikeBase { return &node.LiteralLikeBase } +func (node *TemplateLiteralLikeBase) TemplateLiteralLikeData() *TemplateLiteralLikeBase { return node } + +// TemplateHead + +type TemplateHead struct { + NodeBase + TemplateLiteralLikeBase +} + +func (f *NodeFactory) NewTemplateHead(text string, rawText string, templateFlags TokenFlags) *Node { + data := &TemplateHead{} + data.Text = text + data.RawText = rawText + data.TemplateFlags = templateFlags + f.textCount++ + return f.newNode(KindTemplateHead, data) +} + +func (node *TemplateHead) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewTemplateHead(node.Text, node.RawText, node.TemplateFlags), node.AsNode(), f.AsNodeFactory().hooks) +} + +// TemplateMiddle + +type TemplateMiddle struct { + NodeBase + TemplateLiteralLikeBase +} + +func (f *NodeFactory) NewTemplateMiddle(text string, rawText string, templateFlags TokenFlags) *Node { + data := &TemplateMiddle{} + data.Text = text + data.RawText = rawText + data.TemplateFlags = templateFlags + f.textCount++ + return f.newNode(KindTemplateMiddle, data) +} + +func (node *TemplateMiddle) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewTemplateMiddle(node.Text, node.RawText, node.TemplateFlags), node.AsNode(), f.AsNodeFactory().hooks) +} + +// TemplateTail + +type TemplateTail struct { + NodeBase + TemplateLiteralLikeBase +} + +func (f *NodeFactory) NewTemplateTail(text string, rawText string, templateFlags TokenFlags) *Node { + data := &TemplateTail{} + data.Text = text + data.RawText = rawText + data.TemplateFlags = templateFlags + f.textCount++ + return f.newNode(KindTemplateTail, data) +} + +func (node *TemplateTail) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewTemplateTail(node.Text, node.RawText, node.TemplateFlags), node.AsNode(), f.AsNodeFactory().hooks) +} + +// TemplateLiteralTypeNode + +type TemplateLiteralTypeNode struct { + TypeNodeBase + Head *TemplateHeadNode // TemplateHeadNode + TemplateSpans *NodeList // NodeList[*TemplateLiteralTypeSpanNode] +} + +func (f *NodeFactory) NewTemplateLiteralTypeNode(head *TemplateHeadNode, templateSpans *NodeList) *Node { + data := &TemplateLiteralTypeNode{} + data.Head = head + data.TemplateSpans = templateSpans + return f.newNode(KindTemplateLiteralType, data) +} + +func (f *NodeFactory) UpdateTemplateLiteralTypeNode(node *TemplateLiteralTypeNode, head *TemplateHeadNode, templateSpans *TemplateLiteralTypeSpanList) *Node { + if head != node.Head || templateSpans != node.TemplateSpans { + return updateNode(f.NewTemplateLiteralTypeNode(head, templateSpans), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *TemplateLiteralTypeNode) ForEachChild(v Visitor) bool { + return visit(v, node.Head) || visitNodeList(v, node.TemplateSpans) +} + +func (node *TemplateLiteralTypeNode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateTemplateLiteralTypeNode(node, v.visitNode(node.Head), v.visitNodes(node.TemplateSpans)) +} + +func (node *TemplateLiteralTypeNode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewTemplateLiteralTypeNode(node.Head, node.TemplateSpans), node.AsNode(), f.AsNodeFactory().hooks) +} + +// TemplateLiteralTypeSpan + +type TemplateLiteralTypeSpan struct { + NodeBase + typeSyntaxBase + Type *TypeNode // TypeNode + Literal *TemplateMiddleOrTail // TemplateMiddleOrTail +} + +func (f *NodeFactory) NewTemplateLiteralTypeSpan(typeNode *TypeNode, literal *TemplateMiddleOrTail) *Node { + data := &TemplateLiteralTypeSpan{} + data.Type = typeNode + data.Literal = literal + return f.newNode(KindTemplateLiteralTypeSpan, data) +} + +func (f *NodeFactory) UpdateTemplateLiteralTypeSpan(node *TemplateLiteralTypeSpan, typeNode *TypeNode, literal *TemplateMiddleOrTail) *Node { + if typeNode != node.Type || literal != node.Literal { + return updateNode(f.NewTemplateLiteralTypeSpan(typeNode, literal), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *TemplateLiteralTypeSpan) ForEachChild(v Visitor) bool { + return visit(v, node.Type) || visit(v, node.Literal) +} + +func (node *TemplateLiteralTypeSpan) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateTemplateLiteralTypeSpan(node, v.visitNode(node.Type), v.visitNode(node.Literal)) +} + +func (node *TemplateLiteralTypeSpan) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewTemplateLiteralTypeSpan(node.Type, node.Literal), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsTemplateLiteralTypeSpan(node *Node) bool { + return node.Kind == KindTemplateLiteralTypeSpan +} + +// SyntheticExpression + +type SyntheticExpression struct { + ExpressionBase + Type any + IsSpread bool + TupleNameSource *Node +} + +func (f *NodeFactory) NewSyntheticExpression(t any, isSpread bool, tupleNameSource *Node) *Node { + data := &SyntheticExpression{} + data.Type = t + data.IsSpread = isSpread + data.TupleNameSource = tupleNameSource + return f.newNode(KindSyntheticExpression, data) +} + +func (node *SyntheticExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewSyntheticExpression(node.Type, node.IsSpread, node.TupleNameSource), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsSyntheticExpression(node *Node) bool { + return node.Kind == KindSyntheticExpression +} + +// PartiallyEmittedExpression + +type PartiallyEmittedExpression struct { + ExpressionBase + Expression *Expression // Expression +} + +func (f *NodeFactory) NewPartiallyEmittedExpression(expression *Expression) *Node { + data := &PartiallyEmittedExpression{} + data.Expression = expression + return newNode(KindPartiallyEmittedExpression, data, f.hooks) +} + +func (f *NodeFactory) UpdatePartiallyEmittedExpression(node *PartiallyEmittedExpression, expression *Expression) *Node { + if expression != node.Expression { + return updateNode(f.NewPartiallyEmittedExpression(expression), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *PartiallyEmittedExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) +} + +func (node *PartiallyEmittedExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdatePartiallyEmittedExpression(node, v.visitNode(node.Expression)) +} + +func (node *PartiallyEmittedExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewPartiallyEmittedExpression(node.Expression), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *PartiallyEmittedExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) +} + +func (node *PartiallyEmittedExpression) propagateSubtreeFacts() SubtreeFacts { + return node.SubtreeFacts() & ^SubtreeExclusionsOuterExpression +} + +func IsPartiallyEmittedExpression(node *Node) bool { + return node.Kind == KindPartiallyEmittedExpression +} + +/// A JSX expression of the form ... + +type JsxElement struct { + ExpressionBase + compositeNodeBase + OpeningElement *JsxOpeningElementNode // JsxOpeningElementNode + Children *NodeList // NodeList[*JsxChild] + ClosingElement *JsxClosingElementNode // JsxClosingElementNode +} + +func (f *NodeFactory) NewJsxElement(openingElement *JsxOpeningElementNode, children *NodeList, closingElement *JsxClosingElementNode) *Node { + data := &JsxElement{} + data.OpeningElement = openingElement + data.Children = children + data.ClosingElement = closingElement + return f.newNode(KindJsxElement, data) +} + +func (f *NodeFactory) UpdateJsxElement(node *JsxElement, openingElement *JsxOpeningElementNode, children *JsxChildList, closingElement *JsxClosingElementNode) *Node { + if openingElement != node.OpeningElement || children != node.Children || closingElement != node.ClosingElement { + return updateNode(f.NewJsxElement(openingElement, children, closingElement), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JsxElement) ForEachChild(v Visitor) bool { + return visit(v, node.OpeningElement) || visitNodeList(v, node.Children) || visit(v, node.ClosingElement) +} + +func (node *JsxElement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJsxElement(node, v.visitNode(node.OpeningElement), v.visitNodes(node.Children), v.visitNode(node.ClosingElement)) +} + +func (node *JsxElement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJsxElement(node.OpeningElement, node.Children, node.ClosingElement), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *JsxElement) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.OpeningElement) | + propagateNodeListSubtreeFacts(node.Children, propagateSubtreeFacts) | + propagateSubtreeFacts(node.ClosingElement) | + SubtreeContainsJsx +} + +func IsJsxElement(node *Node) bool { + return node.Kind == KindJsxElement +} + +// JsxAttributes +type JsxAttributes struct { + ExpressionBase + DeclarationBase + compositeNodeBase + Properties *NodeList // NodeList[*JsxAttributeLike] +} + +func (f *NodeFactory) NewJsxAttributes(properties *NodeList) *Node { + data := &JsxAttributes{} + data.Properties = properties + return f.newNode(KindJsxAttributes, data) +} + +func (f *NodeFactory) UpdateJsxAttributes(node *JsxAttributes, properties *JsxAttributeList) *Node { + if properties != node.Properties { + return updateNode(f.NewJsxAttributes(properties), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JsxAttributes) ForEachChild(v Visitor) bool { + return visitNodeList(v, node.Properties) +} + +func (node *JsxAttributes) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJsxAttributes(node, v.visitNodes(node.Properties)) +} + +func (node *JsxAttributes) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJsxAttributes(node.Properties), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *JsxAttributes) computeSubtreeFacts() SubtreeFacts { + return propagateNodeListSubtreeFacts(node.Properties, propagateSubtreeFacts) | + SubtreeContainsJsx +} + +func IsJsxAttributes(node *Node) bool { + return node.Kind == KindJsxAttributes +} + +// JsxNamespacedName + +type JsxNamespacedName struct { + ExpressionBase + compositeNodeBase + name *IdentifierNode // IdentifierNode + Namespace *IdentifierNode // IdentifierNode +} + +func (f *NodeFactory) NewJsxNamespacedName(namespace *IdentifierNode, name *IdentifierNode) *Node { + data := &JsxNamespacedName{} + data.Namespace = namespace + data.name = name + return f.newNode(KindJsxNamespacedName, data) +} + +func (f *NodeFactory) UpdateJsxNamespacedName(node *JsxNamespacedName, name *IdentifierNode, namespace *IdentifierNode) *Node { + if name != node.name || namespace != node.Namespace { + return updateNode(f.NewJsxNamespacedName(name, namespace), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JsxNamespacedName) ForEachChild(v Visitor) bool { + return visit(v, node.Namespace) || visit(v, node.name) +} + +func (node *JsxNamespacedName) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJsxNamespacedName(node, v.visitNode(node.name), v.visitNode(node.Namespace)) +} + +func (node *JsxNamespacedName) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJsxNamespacedName(node.Name(), node.Namespace), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *JsxNamespacedName) Name() *DeclarationName { + return node.name +} + +func (node *JsxNamespacedName) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Namespace) | + propagateSubtreeFacts(node.name) | + SubtreeContainsJsx +} + +func IsJsxNamespacedName(node *Node) bool { + return node.Kind == KindJsxNamespacedName +} + +/// The opening element of a ... JsxElement + +type JsxOpeningElement struct { + ExpressionBase + compositeNodeBase + TagName *JsxTagNameExpression // JsxTagNameExpression (Identifier | KeywordExpression | JsxTagNamePropertyAccess | JsxNamespacedName) + TypeArguments *NodeList // NodeList[*TypeNode]. Optional + Attributes *JsxAttributesNode // JsxAttributesNode +} + +func (f *NodeFactory) NewJsxOpeningElement(tagName *JsxTagNameExpression, typeArguments *NodeList, attributes *JsxAttributesNode) *Node { + data := &JsxOpeningElement{} + data.TagName = tagName + data.TypeArguments = typeArguments + data.Attributes = attributes + return f.newNode(KindJsxOpeningElement, data) +} + +func (f *NodeFactory) UpdateJsxOpeningElement(node *JsxOpeningElement, tagName *JsxTagNameExpression, typeArguments *TypeArgumentList, attributes *JsxAttributesNode) *Node { + if tagName != node.TagName || typeArguments != node.TypeArguments || attributes != node.Attributes { + return updateNode(f.NewJsxOpeningElement(tagName, typeArguments, attributes), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JsxOpeningElement) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) || visitNodeList(v, node.TypeArguments) || visit(v, node.Attributes) +} + +func (node *JsxOpeningElement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJsxOpeningElement(node, v.visitNode(node.TagName), v.visitNodes(node.TypeArguments), v.visitNode(node.Attributes)) +} + +func (node *JsxOpeningElement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJsxOpeningElement(node.TagName, node.TypeArguments, node.Attributes), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *JsxOpeningElement) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.TagName) | + propagateEraseableSyntaxListSubtreeFacts(node.TypeArguments) | + propagateSubtreeFacts(node.Attributes) | + SubtreeContainsJsx +} + +func IsJsxOpeningElement(node *Node) bool { + return node.Kind == KindJsxOpeningElement +} + +/// A JSX expression of the form + +type JsxSelfClosingElement struct { + ExpressionBase + compositeNodeBase + TagName *JsxTagNameExpression // JsxTagNameExpression (IdentifierReference | KeywordExpression | JsxTagNamePropertyAccess | JsxNamespacedName) + TypeArguments *NodeList // NodeList[*TypeNode]. Optional + Attributes *JsxAttributesNode // JsxAttributesNode +} + +func (f *NodeFactory) NewJsxSelfClosingElement(tagName *JsxTagNameExpression, typeArguments *NodeList, attributes *JsxAttributesNode) *Node { + data := &JsxSelfClosingElement{} + data.TagName = tagName + data.TypeArguments = typeArguments + data.Attributes = attributes + return f.newNode(KindJsxSelfClosingElement, data) +} + +func (f *NodeFactory) UpdateJsxSelfClosingElement(node *JsxSelfClosingElement, tagName *JsxTagNameExpression, typeArguments *TypeArgumentList, attributes *JsxAttributesNode) *Node { + if tagName != node.TagName || typeArguments != node.TypeArguments || attributes != node.Attributes { + return updateNode(f.NewJsxSelfClosingElement(tagName, typeArguments, attributes), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JsxSelfClosingElement) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) || visitNodeList(v, node.TypeArguments) || visit(v, node.Attributes) +} + +func (node *JsxSelfClosingElement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJsxSelfClosingElement(node, v.visitNode(node.TagName), v.visitNodes(node.TypeArguments), v.visitNode(node.Attributes)) +} + +func (node *JsxSelfClosingElement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJsxSelfClosingElement(node.TagName, node.TypeArguments, node.Attributes), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *JsxSelfClosingElement) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.TagName) | + propagateEraseableSyntaxListSubtreeFacts(node.TypeArguments) | + propagateSubtreeFacts(node.Attributes) | + SubtreeContainsJsx +} + +func IsJsxSelfClosingElement(node *Node) bool { + return node.Kind == KindJsxSelfClosingElement +} + +/// A JSX expression of the form <>... + +type JsxFragment struct { + ExpressionBase + compositeNodeBase + OpeningFragment *JsxOpeningFragmentNode // JsxOpeningFragmentNode + Children *NodeList // NodeList[*JsxChild] + ClosingFragment *JsxClosingFragmentNode // JsxClosingFragmentNode +} + +func (f *NodeFactory) NewJsxFragment(openingFragment *JsxOpeningFragmentNode, children *NodeList, closingFragment *JsxClosingFragmentNode) *Node { + data := &JsxFragment{} + data.OpeningFragment = openingFragment + data.Children = children + data.ClosingFragment = closingFragment + return f.newNode(KindJsxFragment, data) +} + +func (f *NodeFactory) UpdateJsxFragment(node *JsxFragment, openingFragment *JsxOpeningFragmentNode, children *JsxChildList, closingFragment *JsxClosingFragmentNode) *Node { + if openingFragment != node.OpeningFragment || children != node.Children || closingFragment != node.ClosingFragment { + return updateNode(f.NewJsxFragment(openingFragment, children, closingFragment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JsxFragment) ForEachChild(v Visitor) bool { + return visit(v, node.OpeningFragment) || visitNodeList(v, node.Children) || visit(v, node.ClosingFragment) +} + +func (node *JsxFragment) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJsxFragment(node, v.visitNode(node.OpeningFragment), v.visitNodes(node.Children), v.visitNode(node.ClosingFragment)) +} + +func (node *JsxFragment) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJsxFragment(node.OpeningFragment, node.Children, node.ClosingFragment), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *JsxFragment) computeSubtreeFacts() SubtreeFacts { + return propagateNodeListSubtreeFacts(node.Children, propagateSubtreeFacts) | + SubtreeContainsJsx +} + +func IsJsxFragment(node *Node) bool { + return node.Kind == KindJsxFragment +} + +/// The opening element of a <>... JsxFragment + +type JsxOpeningFragment struct { + ExpressionBase +} + +func (f *NodeFactory) NewJsxOpeningFragment() *Node { + return f.newNode(KindJsxOpeningFragment, &JsxOpeningFragment{}) +} + +func (node *JsxOpeningFragment) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJsxOpeningFragment(), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *JsxOpeningFragment) computeSubtreeFacts() SubtreeFacts { + return SubtreeContainsJsx +} + +func IsJsxOpeningFragment(node *Node) bool { + return node.Kind == KindJsxOpeningFragment +} + +/// The closing element of a <>... JsxFragment + +type JsxClosingFragment struct { + ExpressionBase +} + +func (f *NodeFactory) NewJsxClosingFragment() *Node { + return f.newNode(KindJsxClosingFragment, &JsxClosingFragment{}) +} + +func (node *JsxClosingFragment) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJsxClosingFragment(), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *JsxClosingFragment) computeSubtreeFacts() SubtreeFacts { + return SubtreeContainsJsx +} + +// JsxAttribute + +type JsxAttribute struct { + NodeBase + DeclarationBase + compositeNodeBase + name *JsxAttributeName // JsxAttributeName + Initializer *JsxAttributeValue // JsxAttributeValue. Optional, is sugar for +} + +func (f *NodeFactory) NewJsxAttribute(name *JsxAttributeName, initializer *JsxAttributeValue) *Node { + data := &JsxAttribute{} + data.name = name + data.Initializer = initializer + return f.newNode(KindJsxAttribute, data) +} + +func (f *NodeFactory) UpdateJsxAttribute(node *JsxAttribute, name *JsxAttributeName, initializer *JsxAttributeValue) *Node { + if name != node.name || initializer != node.Initializer { + return updateNode(f.NewJsxAttribute(name, initializer), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JsxAttribute) ForEachChild(v Visitor) bool { + return visit(v, node.name) || visit(v, node.Initializer) +} + +func (node *JsxAttribute) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJsxAttribute(node, v.visitNode(node.name), v.visitNode(node.Initializer)) +} + +func (node *JsxAttribute) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJsxAttribute(node.Name(), node.Initializer), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *JsxAttribute) Name() *JsxAttributeName { + return node.name +} + +func (node *JsxAttribute) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.name) | + propagateSubtreeFacts(node.Initializer) | + SubtreeContainsJsx +} + +func IsJsxAttribute(node *Node) bool { + return node.Kind == KindJsxAttribute +} + +// JsxSpreadAttribute + +type JsxSpreadAttribute struct { + NodeBase + Expression *Expression // Expression +} + +func (f *NodeFactory) NewJsxSpreadAttribute(expression *Expression) *Node { + data := &JsxSpreadAttribute{} + data.Expression = expression + return f.newNode(KindJsxSpreadAttribute, data) +} + +func (f *NodeFactory) UpdateJsxSpreadAttribute(node *JsxSpreadAttribute, expression *Expression) *Node { + if expression != node.Expression { + return updateNode(f.NewJsxSpreadAttribute(expression), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JsxSpreadAttribute) ForEachChild(v Visitor) bool { + return visit(v, node.Expression) +} + +func (node *JsxSpreadAttribute) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJsxSpreadAttribute(node, v.visitNode(node.Expression)) +} + +func (node *JsxSpreadAttribute) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJsxSpreadAttribute(node.Expression), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *JsxSpreadAttribute) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | SubtreeContainsJsx +} + +func IsJsxSpreadAttribute(node *Node) bool { + return node.Kind == KindJsxSpreadAttribute +} + +// JsxClosingElement + +type JsxClosingElement struct { + NodeBase + TagName *JsxTagNameExpression // JsxTagNameExpression +} + +func (f *NodeFactory) NewJsxClosingElement(tagName *JsxTagNameExpression) *Node { + data := &JsxClosingElement{} + data.TagName = tagName + return f.newNode(KindJsxClosingElement, data) +} + +func (f *NodeFactory) UpdateJsxClosingElement(node *JsxClosingElement, tagName *JsxTagNameExpression) *Node { + if tagName != node.TagName { + return updateNode(f.NewJsxClosingElement(tagName), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JsxClosingElement) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) +} + +func (node *JsxClosingElement) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJsxClosingElement(node, v.visitNode(node.TagName)) +} + +func (node *JsxClosingElement) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJsxClosingElement(node.TagName), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *JsxClosingElement) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.TagName) | SubtreeContainsJsx +} + +func IsJsxClosingElement(node *Node) bool { + return node.Kind == KindJsxClosingElement +} + +// JsxExpression + +type JsxExpression struct { + ExpressionBase + DotDotDotToken *TokenNode // TokenNode. Optional + Expression *Expression // Expression +} + +func (f *NodeFactory) NewJsxExpression(dotDotDotToken *TokenNode, expression *Expression) *Node { + data := &JsxExpression{} + data.DotDotDotToken = dotDotDotToken + data.Expression = expression + return f.newNode(KindJsxExpression, data) +} + +func (f *NodeFactory) UpdateJsxExpression(node *JsxExpression, dotDotDotToken *TokenNode, expression *Expression) *Node { + if dotDotDotToken != node.DotDotDotToken || expression != node.Expression { + return updateNode(f.NewJsxExpression(dotDotDotToken, expression), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JsxExpression) ForEachChild(v Visitor) bool { + return visit(v, node.DotDotDotToken) || visit(v, node.Expression) +} + +func (node *JsxExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJsxExpression(node, v.visitToken(node.DotDotDotToken), v.visitNode(node.Expression)) +} + +func (node *JsxExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJsxExpression(node.DotDotDotToken, node.Expression), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *JsxExpression) computeSubtreeFacts() SubtreeFacts { + return propagateSubtreeFacts(node.Expression) | SubtreeContainsJsx +} + +func IsJsxExpression(node *Node) bool { + return node.Kind == KindJsxExpression +} + +// JsxText + +type JsxText struct { + ExpressionBase + LiteralLikeBase + ContainsOnlyTriviaWhiteSpaces bool +} + +func (f *NodeFactory) NewJsxText(text string, containsOnlyTriviaWhiteSpace bool) *Node { + data := &JsxText{} + data.Text = text + data.ContainsOnlyTriviaWhiteSpaces = containsOnlyTriviaWhiteSpace + f.textCount++ + return f.newNode(KindJsxText, data) +} + +func (node *JsxText) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJsxText(node.Text, node.ContainsOnlyTriviaWhiteSpaces), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *JsxText) computeSubtreeFacts() SubtreeFacts { + return SubtreeContainsJsx +} + +func IsJsxText(node *Node) bool { + return node.Kind == KindJsxText +} + +// SyntaxList + +type SyntaxList struct { + NodeBase + Children []*Node +} + +func (f *NodeFactory) NewSyntaxList(children []*Node) *Node { + data := &SyntaxList{} + data.Children = children + return f.newNode(KindSyntaxList, data) +} + +func (node *SyntaxList) ForEachChild(v Visitor) bool { + return visitNodes(v, node.Children) +} + +func (node *SyntaxList) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewSyntaxList(node.Children), node.AsNode(), f.AsNodeFactory().hooks) +} + +/// JSDoc /// + +type JSDoc struct { + NodeBase + Comment *NodeList // NodeList[*JSDocCommentBase] + Tags *NodeList // NodeList[*JSDocTagBase] +} + +func (f *NodeFactory) NewJSDoc(comment *NodeList, tags *NodeList) *Node { + data := f.jsdocPool.New() + data.Comment = comment + data.Tags = tags + return f.newNode(KindJSDoc, data) +} + +func (f *NodeFactory) UpdateJSDoc(node *JSDoc, comment *NodeList, tags *NodeList) *Node { + if comment != node.Comment || tags != node.Tags { + return updateNode(f.NewJSDoc(comment, tags), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDoc) ForEachChild(v Visitor) bool { + return visitNodeList(v, node.Comment) || visitNodeList(v, node.Tags) +} + +func (node *JSDoc) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDoc(node, v.visitNodes(node.Comment), v.visitNodes(node.Tags)) +} + +func (node *JSDoc) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDoc(node.Comment, node.Tags), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *Node) IsJSDoc() bool { + return node.Kind == KindJSDoc +} + +type JSDocTagBase struct { + NodeBase + TagName *IdentifierNode + Comment *NodeList +} + +type JSDocCommentBase struct { + NodeBase + text []string +} + +// JSDoc comments +type JSDocText struct { + JSDocCommentBase +} + +func (f *NodeFactory) NewJSDocText(text []string) *Node { + data := f.jsdocTextPool.New() + data.text = text + f.textCount++ + return f.newNode(KindJSDocText, data) +} + +func (node *JSDocText) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocText(node.text), node.AsNode(), f.AsNodeFactory().hooks) +} + +type JSDocLink struct { + JSDocCommentBase + name *Node // optional (should only be EntityName) +} + +func (f *NodeFactory) NewJSDocLink(name *Node, text []string) *Node { + data := &JSDocLink{} + data.name = name + data.text = text + f.textCount++ + return f.newNode(KindJSDocLink, data) +} + +func (f *NodeFactory) UpdateJSDocLink(node *JSDocLink, name *Node, text []string) *Node { + if name != node.name || !core.Same(text, node.text) { + return updateNode(f.NewJSDocLink(name, text), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocLink) ForEachChild(v Visitor) bool { + return visit(v, node.name) +} + +func (node *JSDocLink) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocLink(node, v.visitNode(node.name), node.text) +} + +func (node *JSDocLink) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocLink(node.Name(), node.text), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *JSDocLink) Name() *DeclarationName { + return node.name +} + +type JSDocLinkPlain struct { + JSDocCommentBase + name *Node // optional (should only be EntityName) +} + +func (f *NodeFactory) NewJSDocLinkPlain(name *Node, text []string) *Node { + data := &JSDocLinkPlain{} + data.name = name + data.text = text + f.textCount++ + return f.newNode(KindJSDocLinkPlain, data) +} + +func (f *NodeFactory) UpdateJSDocLinkPlain(node *JSDocLinkPlain, name *Node, text []string) *Node { + if name != node.name || !core.Same(text, node.text) { + return updateNode(f.NewJSDocLinkPlain(name, text), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocLinkPlain) ForEachChild(v Visitor) bool { + return visit(v, node.name) +} + +func (node *JSDocLinkPlain) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocLinkPlain(node, v.visitNode(node.name), node.text) +} + +func (node *JSDocLinkPlain) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocLinkPlain(node.Name(), node.text), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *JSDocLinkPlain) Name() *DeclarationName { + return node.name +} + +type JSDocLinkCode struct { + JSDocCommentBase + name *Node // optional (should only be EntityName) +} + +func (f *NodeFactory) NewJSDocLinkCode(name *Node, text []string) *Node { + data := &JSDocLinkCode{} + data.name = name + data.text = text + f.textCount++ + return f.newNode(KindJSDocLinkCode, data) +} + +func (f *NodeFactory) UpdateJSDocLinkCode(node *JSDocLinkCode, name *Node, text []string) *Node { + if name != node.name || !core.Same(text, node.text) { + return updateNode(f.NewJSDocLinkCode(name, text), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocLinkCode) ForEachChild(v Visitor) bool { + return visit(v, node.name) +} + +func (node *JSDocLinkCode) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocLinkCode(node, v.visitNode(node.name), node.text) +} + +func (node *JSDocLinkCode) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocLinkCode(node.Name(), node.text), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *JSDocLinkCode) Name() *DeclarationName { + return node.name +} + +// JSDocTypeExpression + +type JSDocTypeExpression struct { + TypeNodeBase + Type *TypeNode +} + +func (f *NodeFactory) NewJSDocTypeExpression(typeNode *TypeNode) *Node { + data := &JSDocTypeExpression{} + data.Type = typeNode + return f.newNode(KindJSDocTypeExpression, data) +} + +func (f *NodeFactory) UpdateJSDocTypeExpression(node *JSDocTypeExpression, typeNode *TypeNode) *Node { + if typeNode != node.Type { + return updateNode(f.NewJSDocTypeExpression(typeNode), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocTypeExpression) ForEachChild(v Visitor) bool { + return visit(v, node.Type) +} + +func (node *JSDocTypeExpression) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocTypeExpression(node, v.visitNode(node.Type)) +} + +func (node *JSDocTypeExpression) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocTypeExpression(node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +// JSDocNonNullableType + +type JSDocNonNullableType struct { + TypeNodeBase + Type *TypeNode // TypeNode +} + +func (f *NodeFactory) NewJSDocNonNullableType(typeNode *TypeNode) *Node { + data := &JSDocNonNullableType{} + data.Type = typeNode + return f.newNode(KindJSDocNonNullableType, data) +} + +func (f *NodeFactory) UpdateJSDocNonNullableType(node *JSDocNonNullableType, typeNode *TypeNode) *Node { + if typeNode != node.Type { + return updateNode(f.NewJSDocNonNullableType(typeNode), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocNonNullableType) ForEachChild(v Visitor) bool { + return visit(v, node.Type) +} + +func (node *JSDocNonNullableType) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocNonNullableType(node, v.visitNode(node.Type)) +} + +func (node *JSDocNonNullableType) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocNonNullableType(node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsJSDocNonNullableType(node *Node) bool { + return node.Kind == KindJSDocNonNullableType +} + +// JSDocNullableType + +type JSDocNullableType struct { + TypeNodeBase + Type *TypeNode // TypeNode +} + +func (f *NodeFactory) NewJSDocNullableType(typeNode *TypeNode) *Node { + data := &JSDocNullableType{} + data.Type = typeNode + return f.newNode(KindJSDocNullableType, data) +} + +func (f *NodeFactory) UpdateJSDocNullableType(node *JSDocNullableType, typeNode *TypeNode) *Node { + if typeNode != node.Type { + return updateNode(f.NewJSDocNullableType(typeNode), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocNullableType) ForEachChild(v Visitor) bool { + return visit(v, node.Type) +} + +func (node *JSDocNullableType) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocNullableType(node, v.visitNode(node.Type)) +} + +func (node *JSDocNullableType) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocNullableType(node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsJSDocNullableType(node *Node) bool { + return node.Kind == KindJSDocNullableType +} + +// JSDocAllType + +type JSDocAllType struct { + TypeNodeBase +} + +func (f *NodeFactory) NewJSDocAllType() *Node { + data := &JSDocAllType{} + return f.newNode(KindJSDocAllType, data) +} + +func (node *JSDocAllType) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocAllType(), node.AsNode(), f.AsNodeFactory().hooks) +} + +// JSDocVariadicType + +type JSDocVariadicType struct { + TypeNodeBase + Type *TypeNode +} + +func (f *NodeFactory) NewJSDocVariadicType(typeNode *TypeNode) *Node { + data := &JSDocVariadicType{} + data.Type = typeNode + return f.newNode(KindJSDocVariadicType, data) +} + +func (f *NodeFactory) UpdateJSDocVariadicType(node *JSDocVariadicType, typeNode *TypeNode) *Node { + if typeNode != node.Type { + return updateNode(f.NewJSDocVariadicType(typeNode), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocVariadicType) ForEachChild(v Visitor) bool { + return visit(v, node.Type) +} + +func (node *JSDocVariadicType) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocVariadicType(node, v.visitNode(node.Type)) +} + +func (node *JSDocVariadicType) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocVariadicType(node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +// JSDocOptionalType + +type JSDocOptionalType struct { + TypeNodeBase + Type *TypeNode +} + +func (f *NodeFactory) NewJSDocOptionalType(typeNode *TypeNode) *Node { + data := &JSDocOptionalType{} + data.Type = typeNode + return f.newNode(KindJSDocOptionalType, data) +} + +func (f *NodeFactory) UpdateJSDocOptionalType(node *JSDocOptionalType, typeNode *TypeNode) *Node { + if typeNode != node.Type { + return updateNode(f.NewJSDocOptionalType(typeNode), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocOptionalType) ForEachChild(v Visitor) bool { + return visit(v, node.Type) +} + +func (node *JSDocOptionalType) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocOptionalType(node, v.visitNode(node.Type)) +} + +func (node *JSDocOptionalType) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocOptionalType(node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +// JSDocTypeTag + +type JSDocTypeTag struct { + JSDocTagBase + TypeExpression *TypeNode +} + +func (f *NodeFactory) NewJSDocTypeTag(tagName *IdentifierNode, typeExpression *Node, comment *NodeList) *Node { + data := &JSDocTypeTag{} + data.TagName = tagName + data.TypeExpression = typeExpression + data.Comment = comment + return f.newNode(KindJSDocTypeTag, data) +} + +func (f *NodeFactory) UpdateJSDocTypeTag(node *JSDocTypeTag, tagName *IdentifierNode, typeExpression *TypeNode, comment *NodeList) *Node { + if tagName != node.TagName || typeExpression != node.TypeExpression || comment != node.Comment { + return updateNode(f.NewJSDocTypeTag(tagName, typeExpression, comment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocTypeTag) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) || visit(v, node.TypeExpression) || visitNodeList(v, node.Comment) +} + +func (node *JSDocTypeTag) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocTypeTag(node, v.visitNode(node.TagName), v.visitNode(node.TypeExpression), v.visitNodes(node.Comment)) +} + +func (node *JSDocTypeTag) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocTypeTag(node.TagName, node.TypeExpression, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsJSDocTypeTag(node *Node) bool { + return node.Kind == KindJSDocTypeTag +} + +// JSDocUnknownTag +type JSDocUnknownTag struct { + JSDocTagBase +} + +func (f *NodeFactory) NewJSDocUnknownTag(tagName *IdentifierNode, comment *NodeList) *Node { + data := f.jsdocUnknownTagPool.New() + data.TagName = tagName + data.Comment = comment + return f.newNode(KindJSDocTag, data) +} + +func (f *NodeFactory) UpdateJSDocUnknownTag(node *JSDocUnknownTag, tagName *IdentifierNode, comment *NodeList) *Node { + if tagName != node.TagName || comment != node.Comment { + return updateNode(f.NewJSDocUnknownTag(tagName, comment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocUnknownTag) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) || visitNodeList(v, node.Comment) +} + +func (node *JSDocUnknownTag) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocUnknownTag(node, v.visitNode(node.TagName), v.visitNodes(node.Comment)) +} + +func (node *JSDocUnknownTag) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocUnknownTag(node.TagName, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsJSDocUnknownTag(node *Node) bool { + return node.Kind == KindJSDocTag +} + +// JSDocTemplateTag +type JSDocTemplateTag struct { + JSDocTagBase + Constraint *Node + TypeParameters *TypeParameterList +} + +func (f *NodeFactory) NewJSDocTemplateTag(tagName *IdentifierNode, constraint *Node, typeParameters *TypeParameterList, comment *NodeList) *Node { + data := &JSDocTemplateTag{} + data.TagName = tagName + data.Constraint = constraint + data.TypeParameters = typeParameters + data.Comment = comment + return f.newNode(KindJSDocTemplateTag, data) +} + +func (f *NodeFactory) UpdateJSDocTemplateTag(node *JSDocTemplateTag, tagName *IdentifierNode, constraint *Node, typeParameters *TypeParameterList, comment *NodeList) *Node { + if tagName != node.TagName || constraint != node.Constraint || typeParameters != node.TypeParameters || comment != node.Comment { + return updateNode(f.NewJSDocTemplateTag(tagName, constraint, typeParameters, comment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocTemplateTag) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) || visit(v, node.Constraint) || visitNodeList(v, node.TypeParameters) || visitNodeList(v, node.Comment) +} + +func (node *JSDocTemplateTag) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocTemplateTag(node, v.visitNode(node.TagName), v.visitNode(node.Constraint), v.visitNodes(node.TypeParameters), v.visitNodes(node.Comment)) +} + +func (node *JSDocTemplateTag) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocTemplateTag(node.TagName, node.Constraint, node.TypeParameters, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsJSDocTemplateTag(n *Node) bool { + return n.Kind == KindJSDocTemplateTag +} + +// JSDocParameterOrPropertyTag +type JSDocParameterOrPropertyTag struct { + JSDocTagBase + name *EntityName + IsBracketed bool + TypeExpression *TypeNode + IsNameFirst bool +} + +type ( + JSDocParameterTag = JSDocParameterOrPropertyTag + JSDocPropertyTag = JSDocParameterOrPropertyTag +) + +func (f *NodeFactory) newJSDocParameterOrPropertyTag(kind Kind, tagName *IdentifierNode, name *EntityName, isBracketed bool, typeExpression *TypeNode, isNameFirst bool, comment *NodeList) *Node { + data := f.jsdocParameterOrPropertyTagPool.New() + data.TagName = tagName + data.name = name + data.IsBracketed = isBracketed + data.TypeExpression = typeExpression + data.IsNameFirst = isNameFirst + data.Comment = comment + return f.newNode(kind, data) +} + +func (f *NodeFactory) NewJSDocParameterTag(tagName *IdentifierNode, name *EntityName, isBracketed bool, typeExpression *TypeNode, isNameFirst bool, comment *NodeList) *Node { + return f.newJSDocParameterOrPropertyTag(KindJSDocParameterTag, tagName, name, isBracketed, typeExpression, isNameFirst, comment) +} + +func (f *NodeFactory) NewJSDocPropertyTag(tagName *IdentifierNode, name *EntityName, isBracketed bool, typeExpression *TypeNode, isNameFirst bool, comment *NodeList) *Node { + return f.newJSDocParameterOrPropertyTag(KindJSDocPropertyTag, tagName, name, isBracketed, typeExpression, isNameFirst, comment) +} + +func (f *NodeFactory) UpdateJSDocParameterOrPropertyTag(kind Kind, node *JSDocParameterOrPropertyTag, tagName *IdentifierNode, name *EntityName, isBracketed bool, typeExpression *TypeNode, isNameFirst bool, comment *NodeList) *Node { + if tagName != node.TagName || name != node.name || isBracketed != node.IsBracketed || typeExpression != node.TypeExpression || isNameFirst != node.IsNameFirst || comment != node.Comment { + return updateNode(f.newJSDocParameterOrPropertyTag(kind, tagName, name, isBracketed, typeExpression, isNameFirst, comment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocParameterOrPropertyTag) ForEachChild(v Visitor) bool { + if node.IsNameFirst { + return visit(v, node.TagName) || visit(v, node.name) || visit(v, node.TypeExpression) || visitNodeList(v, node.Comment) + } else { + return visit(v, node.TagName) || visit(v, node.TypeExpression) || visit(v, node.name) || visitNodeList(v, node.Comment) + } +} + +func (node *JSDocParameterOrPropertyTag) VisitEachChild(v *NodeVisitor) *Node { + tagName := v.visitNode(node.TagName) + var name, typeExpression *Node + if node.IsNameFirst { + name, typeExpression = v.visitNode(node.name), v.visitNode(node.TypeExpression) + } else { + typeExpression, name = v.visitNode(node.TypeExpression), v.visitNode(node.name) + } + return v.Factory.UpdateJSDocParameterOrPropertyTag(node.Kind, node, tagName, name, node.IsBracketed, typeExpression, node.IsNameFirst, v.visitNodes(node.Comment)) +} + +func (node *JSDocParameterOrPropertyTag) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().newJSDocParameterOrPropertyTag(node.Kind, node.TagName, node.Name(), node.IsBracketed, node.TypeExpression, node.IsNameFirst, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *JSDocParameterOrPropertyTag) Name() *EntityName { return node.name } + +func IsJSDocParameterTag(node *Node) bool { + return node.Kind == KindJSDocParameterTag +} + +func IsJSDocPropertyTag(node *Node) bool { + return node.Kind == KindJSDocPropertyTag +} + +// JSDocReturnTag +type JSDocReturnTag struct { + JSDocTagBase + TypeExpression *TypeNode +} + +func (f *NodeFactory) NewJSDocReturnTag(tagName *IdentifierNode, typeExpression *TypeNode, comment *NodeList) *Node { + data := &JSDocReturnTag{} + data.TagName = tagName + data.TypeExpression = typeExpression + data.Comment = comment + return f.newNode(KindJSDocReturnTag, data) +} + +func (f *NodeFactory) UpdateJSDocReturnTag(node *JSDocReturnTag, tagName *IdentifierNode, typeExpression *TypeNode, comment *NodeList) *Node { + if tagName != node.TagName || typeExpression != node.TypeExpression || comment != node.Comment { + return updateNode(f.NewJSDocReturnTag(tagName, typeExpression, comment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocReturnTag) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) || visit(v, node.TypeExpression) || visitNodeList(v, node.Comment) +} + +func (node *JSDocReturnTag) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocReturnTag(node, v.visitNode(node.TagName), v.visitNode(node.TypeExpression), v.visitNodes(node.Comment)) +} + +func (node *JSDocReturnTag) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocReturnTag(node.TagName, node.TypeExpression, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsJSDocReturnTag(node *Node) bool { + return node.Kind == KindJSDocReturnTag +} + +// JSDocPublicTag +type JSDocPublicTag struct { + JSDocTagBase +} + +func (f *NodeFactory) NewJSDocPublicTag(tagName *IdentifierNode, comment *NodeList) *Node { + data := &JSDocPublicTag{} + data.TagName = tagName + data.Comment = comment + return f.newNode(KindJSDocPublicTag, data) +} + +func (f *NodeFactory) UpdateJSDocPublicTag(node *JSDocPublicTag, tagName *IdentifierNode, comment *NodeList) *Node { + if tagName != node.TagName || comment != node.Comment { + return updateNode(f.NewJSDocPublicTag(tagName, comment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocPublicTag) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) || visitNodeList(v, node.Comment) +} + +func (node *JSDocPublicTag) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocPublicTag(node, v.visitNode(node.TagName), v.visitNodes(node.Comment)) +} + +func (node *JSDocPublicTag) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocPublicTag(node.TagName, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) +} + +// JSDocPrivateTag +type JSDocPrivateTag struct { + JSDocTagBase +} + +func (f *NodeFactory) NewJSDocPrivateTag(tagName *IdentifierNode, comment *NodeList) *Node { + data := &JSDocPrivateTag{} + data.TagName = tagName + data.Comment = comment + return f.newNode(KindJSDocPrivateTag, data) +} + +func (f *NodeFactory) UpdateJSDocPrivateTag(node *JSDocPrivateTag, tagName *IdentifierNode, comment *NodeList) *Node { + if tagName != node.TagName || comment != node.Comment { + return updateNode(f.NewJSDocPrivateTag(tagName, comment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocPrivateTag) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) || visitNodeList(v, node.Comment) +} + +func (node *JSDocPrivateTag) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocPrivateTag(node, v.visitNode(node.TagName), v.visitNodes(node.Comment)) +} + +func (node *JSDocPrivateTag) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocPrivateTag(node.TagName, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) +} + +// JSDocProtectedTag +type JSDocProtectedTag struct { + JSDocTagBase +} + +func (f *NodeFactory) NewJSDocProtectedTag(tagName *IdentifierNode, comment *NodeList) *Node { + data := &JSDocProtectedTag{} + data.TagName = tagName + data.Comment = comment + return f.newNode(KindJSDocProtectedTag, data) +} + +func (f *NodeFactory) UpdateJSDocProtectedTag(node *JSDocProtectedTag, tagName *IdentifierNode, comment *NodeList) *Node { + if tagName != node.TagName || comment != node.Comment { + return updateNode(f.NewJSDocProtectedTag(tagName, comment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocProtectedTag) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) || visitNodeList(v, node.Comment) +} + +func (node *JSDocProtectedTag) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocProtectedTag(node, v.visitNode(node.TagName), v.visitNodes(node.Comment)) +} + +func (node *JSDocProtectedTag) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocProtectedTag(node.TagName, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) +} + +// JSDocReadonlyTag +type JSDocReadonlyTag struct { + JSDocTagBase +} + +func (f *NodeFactory) NewJSDocReadonlyTag(tagName *IdentifierNode, comment *NodeList) *Node { + data := &JSDocReadonlyTag{} + data.TagName = tagName + data.Comment = comment + return f.newNode(KindJSDocReadonlyTag, data) +} + +func (f *NodeFactory) UpdateJSDocReadonlyTag(node *JSDocReadonlyTag, tagName *IdentifierNode, comment *NodeList) *Node { + if tagName != node.TagName || comment != node.Comment { + return updateNode(f.NewJSDocReadonlyTag(tagName, comment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocReadonlyTag) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) || visitNodeList(v, node.Comment) +} + +func (node *JSDocReadonlyTag) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocReadonlyTag(node, v.visitNode(node.TagName), v.visitNodes(node.Comment)) +} + +func (node *JSDocReadonlyTag) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocReadonlyTag(node.TagName, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) +} + +// JSDocOverrideTag +type JSDocOverrideTag struct { + JSDocTagBase +} + +func (f *NodeFactory) NewJSDocOverrideTag(tagName *IdentifierNode, comment *NodeList) *Node { + data := &JSDocOverrideTag{} + data.TagName = tagName + data.Comment = comment + return f.newNode(KindJSDocOverrideTag, data) +} + +func (f *NodeFactory) UpdateJSDocOverrideTag(node *JSDocOverrideTag, tagName *IdentifierNode, comment *NodeList) *Node { + if tagName != node.TagName || comment != node.Comment { + return updateNode(f.NewJSDocOverrideTag(tagName, comment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocOverrideTag) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) || visitNodeList(v, node.Comment) +} + +func (node *JSDocOverrideTag) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocOverrideTag(node, v.visitNode(node.TagName), v.visitNodes(node.Comment)) +} + +func (node *JSDocOverrideTag) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocOverrideTag(node.TagName, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) +} + +// JSDocDeprecatedTag +type JSDocDeprecatedTag struct { + JSDocTagBase +} + +func (f *NodeFactory) NewJSDocDeprecatedTag(tagName *IdentifierNode, comment *NodeList) *Node { + data := f.jsdocDeprecatedTagPool.New() + data.TagName = tagName + data.Comment = comment + return f.newNode(KindJSDocDeprecatedTag, data) +} + +func (f *NodeFactory) UpdateJSDocDeprecatedTag(node *JSDocDeprecatedTag, tagName *IdentifierNode, comment *NodeList) *Node { + if tagName != node.TagName || comment != node.Comment { + return updateNode(f.NewJSDocDeprecatedTag(tagName, comment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocDeprecatedTag) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) || visitNodeList(v, node.Comment) +} + +func (node *JSDocDeprecatedTag) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocDeprecatedTag(node, v.visitNode(node.TagName), v.visitNodes(node.Comment)) +} + +func (node *JSDocDeprecatedTag) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocDeprecatedTag(node.TagName, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsJSDocDeprecatedTag(node *Node) bool { + return node.Kind == KindJSDocDeprecatedTag +} + +// JSDocSeeTag +type JSDocSeeTag struct { + JSDocTagBase + NameExpression *TypeNode +} + +func (f *NodeFactory) NewJSDocSeeTag(tagName *IdentifierNode, nameExpression *TypeNode, comment *NodeList) *Node { + data := &JSDocSeeTag{} + data.TagName = tagName + data.NameExpression = nameExpression + data.Comment = comment + return f.newNode(KindJSDocSeeTag, data) +} + +func (f *NodeFactory) UpdateJSDocSeeTag(node *JSDocSeeTag, tagName *IdentifierNode, nameExpression *TypeNode, comment *NodeList) *Node { + if tagName != node.TagName || nameExpression != node.NameExpression || comment != node.Comment { + return updateNode(f.NewJSDocSeeTag(tagName, nameExpression, comment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocSeeTag) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) || visit(v, node.NameExpression) || visitNodeList(v, node.Comment) +} + +func (node *JSDocSeeTag) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocSeeTag(node, v.visitNode(node.TagName), v.visitNode(node.NameExpression), v.visitNodes(node.Comment)) +} + +func (node *JSDocSeeTag) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocSeeTag(node.TagName, node.NameExpression, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) +} + +// JSDocImplementsTag +type JSDocImplementsTag struct { + JSDocTagBase + ClassName *Expression +} + +func (f *NodeFactory) NewJSDocImplementsTag(tagName *IdentifierNode, className *Expression, comment *NodeList) *Node { + data := &JSDocImplementsTag{} + data.TagName = tagName + data.ClassName = className + data.Comment = comment + return f.newNode(KindJSDocImplementsTag, data) +} + +func (f *NodeFactory) UpdateJSDocImplementsTag(node *JSDocImplementsTag, tagName *IdentifierNode, className *Expression, comment *NodeList) *Node { + if tagName != node.TagName || className != node.ClassName || comment != node.Comment { + return updateNode(f.NewJSDocImplementsTag(tagName, className, comment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocImplementsTag) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) || visit(v, node.ClassName) || visitNodeList(v, node.Comment) +} + +func (node *JSDocImplementsTag) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocImplementsTag(node, v.visitNode(node.TagName), v.visitNode(node.ClassName), v.visitNodes(node.Comment)) +} + +func (node *JSDocImplementsTag) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocImplementsTag(node.TagName, node.ClassName, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsJSDocImplementsTag(node *Node) bool { + return node.Kind == KindJSDocImplementsTag +} + +// JSDocAugmentsTag +type JSDocAugmentsTag struct { + JSDocTagBase + ClassName *Expression +} + +func (f *NodeFactory) NewJSDocAugmentsTag(tagName *IdentifierNode, className *Expression, comment *NodeList) *Node { + data := &JSDocAugmentsTag{} + data.TagName = tagName + data.ClassName = className + data.Comment = comment + return f.newNode(KindJSDocAugmentsTag, data) +} + +func (f *NodeFactory) UpdateJSDocAugmentsTag(node *JSDocAugmentsTag, tagName *IdentifierNode, className *Expression, comment *NodeList) *Node { + if tagName != node.TagName || className != node.ClassName || comment != node.Comment { + return updateNode(f.NewJSDocAugmentsTag(tagName, className, comment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocAugmentsTag) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) || visit(v, node.ClassName) || visitNodeList(v, node.Comment) +} + +func (node *JSDocAugmentsTag) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocAugmentsTag(node, v.visitNode(node.TagName), v.visitNode(node.ClassName), v.visitNodes(node.Comment)) +} + +func (node *JSDocAugmentsTag) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocAugmentsTag(node.TagName, node.ClassName, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsJSDocAugmentsTag(node *Node) bool { + return node.Kind == KindJSDocAugmentsTag +} + +// JSDocSatisfiesTag +type JSDocSatisfiesTag struct { + JSDocTagBase + TypeExpression *TypeNode +} + +func (f *NodeFactory) NewJSDocSatisfiesTag(tagName *IdentifierNode, typeExpression *TypeNode, comment *NodeList) *Node { + data := &JSDocSatisfiesTag{} + data.TagName = tagName + data.TypeExpression = typeExpression + data.Comment = comment + return f.newNode(KindJSDocSatisfiesTag, data) +} + +func (f *NodeFactory) UpdateJSDocSatisfiesTag(node *JSDocSatisfiesTag, tagName *IdentifierNode, typeExpression *TypeNode, comment *NodeList) *Node { + if tagName != node.TagName || typeExpression != node.TypeExpression || comment != node.Comment { + return updateNode(f.NewJSDocSatisfiesTag(tagName, typeExpression, comment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocSatisfiesTag) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) || visit(v, node.TypeExpression) || visitNodeList(v, node.Comment) +} + +func (node *JSDocSatisfiesTag) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocSatisfiesTag(node, v.visitNode(node.TagName), v.visitNode(node.TypeExpression), v.visitNodes(node.Comment)) +} + +func (node *JSDocSatisfiesTag) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocSatisfiesTag(node.TagName, node.TypeExpression, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) +} + +// JSDocThisTag +type JSDocThisTag struct { + JSDocTagBase + TypeExpression *TypeNode +} + +func (f *NodeFactory) NewJSDocThisTag(tagName *IdentifierNode, typeExpression *TypeNode, comment *NodeList) *Node { + data := &JSDocThisTag{} + data.TagName = tagName + data.TypeExpression = typeExpression + data.Comment = comment + return f.newNode(KindJSDocThisTag, data) +} + +func (f *NodeFactory) UpdateJSDocThisTag(node *JSDocThisTag, tagName *IdentifierNode, typeExpression *TypeNode, comment *NodeList) *Node { + if tagName != node.TagName || typeExpression != node.TypeExpression || comment != node.Comment { + return updateNode(f.NewJSDocThisTag(tagName, typeExpression, comment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocThisTag) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) || visit(v, node.TypeExpression) || visitNodeList(v, node.Comment) +} + +func (node *JSDocThisTag) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocThisTag(node, v.visitNode(node.TagName), v.visitNode(node.TypeExpression), v.visitNodes(node.Comment)) +} + +func (node *JSDocThisTag) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocThisTag(node.TagName, node.TypeExpression, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) +} + +// JSDocImportTag +type JSDocImportTag struct { + JSDocTagBase + ImportClause *Declaration + ModuleSpecifier *Expression + Attributes *Node +} + +func (f *NodeFactory) NewJSDocImportTag(tagName *IdentifierNode, importClause *Declaration, moduleSpecifier *Node, attributes *Node, comment *NodeList) *Node { + data := &JSDocImportTag{} + data.TagName = tagName + data.ImportClause = importClause + data.ModuleSpecifier = moduleSpecifier + data.Attributes = attributes + data.Comment = comment + return f.newNode(KindJSDocImportTag, data) +} + +func (f *NodeFactory) UpdateJSDocImportTag(node *JSDocImportTag, tagName *IdentifierNode, importClause *Declaration, moduleSpecifier *Node, attributes *Node, comment *NodeList) *Node { + if tagName != node.TagName || importClause != node.ImportClause || moduleSpecifier != node.ModuleSpecifier || attributes != node.Attributes || comment != node.Comment { + return updateNode(f.NewJSDocImportTag(tagName, importClause, moduleSpecifier, attributes, comment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocImportTag) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) || visit(v, node.ImportClause) || visit(v, node.ModuleSpecifier) || visit(v, node.Attributes) || visitNodeList(v, node.Comment) +} + +func (node *JSDocImportTag) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocImportTag(node, v.visitNode(node.TagName), v.visitNode(node.ImportClause), v.visitNode(node.ModuleSpecifier), v.visitNode(node.Attributes), v.visitNodes(node.Comment)) +} + +func (node *JSDocImportTag) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocImportTag(node.TagName, node.ImportClause, node.ModuleSpecifier, node.Attributes, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsJSDocImportTag(node *Node) bool { + return node.Kind == KindJSDocImportTag +} + +// JSDocCallbackTag +type JSDocCallbackTag struct { + JSDocTagBase + FullName *Node + TypeExpression *TypeNode +} + +func (f *NodeFactory) NewJSDocCallbackTag(tagName *IdentifierNode, typeExpression *TypeNode, fullName *Node, comment *NodeList) *Node { + data := &JSDocCallbackTag{} + data.TagName = tagName + data.FullName = fullName + data.TypeExpression = typeExpression + data.Comment = comment + return f.newNode(KindJSDocCallbackTag, data) +} + +func (f *NodeFactory) UpdateJSDocCallbackTag(node *JSDocCallbackTag, tagName *IdentifierNode, typeExpression *TypeNode, fullName *Node, comment *NodeList) *Node { + if tagName != node.TagName || typeExpression != node.TypeExpression || fullName != node.FullName || comment != node.Comment { + return updateNode(f.NewJSDocCallbackTag(tagName, typeExpression, fullName, comment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocCallbackTag) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) || visit(v, node.FullName) || visit(v, node.TypeExpression) || visitNodeList(v, node.Comment) +} + +func (node *JSDocCallbackTag) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocCallbackTag(node, v.visitNode(node.TagName), v.visitNode(node.TypeExpression), v.visitNode(node.FullName), v.visitNodes(node.Comment)) +} + +func (node *JSDocCallbackTag) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocCallbackTag(node.TagName, node.TypeExpression, node.FullName, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *JSDocCallbackTag) Name() *DeclarationName { return node.FullName } + +func IsJSDocCallbackTag(node *Node) bool { + return node.Kind == KindJSDocCallbackTag +} + +// JSDocOverloadTag +type JSDocOverloadTag struct { + JSDocTagBase + TypeExpression *TypeNode +} + +func (f *NodeFactory) NewJSDocOverloadTag(tagName *IdentifierNode, typeExpression *TypeNode, comment *NodeList) *Node { + data := &JSDocOverloadTag{} + data.TagName = tagName + data.TypeExpression = typeExpression + data.Comment = comment + return f.newNode(KindJSDocOverloadTag, data) +} + +func (f *NodeFactory) UpdateJSDocOverloadTag(node *JSDocOverloadTag, tagName *IdentifierNode, typeExpression *TypeNode, comment *NodeList) *Node { + if tagName != node.TagName || typeExpression != node.TypeExpression || comment != node.Comment { + return updateNode(f.NewJSDocOverloadTag(tagName, typeExpression, comment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocOverloadTag) ForEachChild(v Visitor) bool { + return visit(v, node.TagName) || visit(v, node.TypeExpression) || visitNodeList(v, node.Comment) +} + +func (node *JSDocOverloadTag) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocOverloadTag(node, v.visitNode(node.TagName), v.visitNode(node.TypeExpression), v.visitNodes(node.Comment)) +} + +func (node *JSDocOverloadTag) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocOverloadTag(node.TagName, node.TypeExpression, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) +} + +// JSDocTypedefTag +type JSDocTypedefTag struct { + JSDocTagBase + TypeExpression *Node + name *IdentifierNode +} + +func (f *NodeFactory) NewJSDocTypedefTag(tagName *IdentifierNode, typeExpression *Node, name *IdentifierNode, comment *NodeList) *Node { + data := &JSDocTypedefTag{} + data.TagName = tagName + data.TypeExpression = typeExpression + data.name = name + data.Comment = comment + return f.newNode(KindJSDocTypedefTag, data) +} + +func (f *NodeFactory) UpdateJSDocTypedefTag(node *JSDocTypedefTag, tagName *IdentifierNode, typeExpression *Node, fullName *IdentifierNode, comment *NodeList) *Node { + if tagName != node.TagName || typeExpression != node.TypeExpression || fullName != node.name || comment != node.Comment { + return updateNode(f.NewJSDocTypedefTag(tagName, typeExpression, fullName, comment), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocTypedefTag) ForEachChild(v Visitor) bool { + if node.TypeExpression != nil && node.TypeExpression.Kind == KindJSDocTypeLiteral { + return visit(v, node.TagName) || visit(v, node.name) || visit(v, node.TypeExpression) || visitNodeList(v, node.Comment) + } + return visit(v, node.TagName) || visit(v, node.TypeExpression) || visit(v, node.name) || visitNodeList(v, node.Comment) +} + +func (node *JSDocTypedefTag) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocTypedefTag(node, v.visitNode(node.TagName), v.visitNode(node.TypeExpression), v.visitNode(node.name), v.visitNodes(node.Comment)) +} + +func (node *JSDocTypedefTag) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocTypedefTag(node.TagName, node.TypeExpression, node.name, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *JSDocTypedefTag) Name() *DeclarationName { return node.name } + +func IsJSDocTypedefTag(node *Node) bool { + return node.Kind == KindJSDocTypedefTag +} + +// JSDocTypeLiteral +type JSDocTypeLiteral struct { + TypeNodeBase + DeclarationBase + JSDocPropertyTags []*Node + IsArrayType bool +} + +func (f *NodeFactory) NewJSDocTypeLiteral(jsdocPropertyTags []*Node, isArrayType bool) *Node { + data := &JSDocTypeLiteral{} + data.JSDocPropertyTags = jsdocPropertyTags + data.IsArrayType = isArrayType + return f.newNode(KindJSDocTypeLiteral, data) +} + +func (f *NodeFactory) UpdateJSDocTypeLiteral(node *JSDocTypeLiteral, jsdocPropertyTags []*Node, isArrayType bool) *Node { + if !core.Same(jsdocPropertyTags, node.JSDocPropertyTags) || isArrayType != node.IsArrayType { + return updateNode(f.NewJSDocTypeLiteral(jsdocPropertyTags, isArrayType), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocTypeLiteral) ForEachChild(v Visitor) bool { + return visitNodes(v, node.JSDocPropertyTags) +} + +func (node *JSDocTypeLiteral) VisitEachChild(v *NodeVisitor) *Node { + jsdocPropertyTags := core.SameMap(node.JSDocPropertyTags, func(n *Node) *Node { return v.visitNode(n) }) + return v.Factory.UpdateJSDocTypeLiteral(node, jsdocPropertyTags, node.IsArrayType) +} + +func (node *JSDocTypeLiteral) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocTypeLiteral(node.JSDocPropertyTags, node.IsArrayType), node.AsNode(), f.AsNodeFactory().hooks) +} + +// JSDocSignature +type JSDocSignature struct { + TypeNodeBase + FunctionLikeBase +} + +func (f *NodeFactory) NewJSDocSignature(typeParameters *NodeList, parameters *NodeList, typeNode *JSDocTag) *Node { + data := &JSDocSignature{} + data.TypeParameters = typeParameters + data.Parameters = parameters + data.Type = typeNode + return f.newNode(KindJSDocSignature, data) +} + +func (f *NodeFactory) UpdateJSDocSignature(node *JSDocSignature, typeParameters *NodeList, parameters *NodeList, typeNode *JSDocTag) *Node { + if typeParameters != node.TypeParameters || parameters != node.Parameters || typeNode != node.Type { + return updateNode(f.NewJSDocSignature(typeParameters, parameters, typeNode), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocSignature) ForEachChild(v Visitor) bool { + return visitNodeList(v, node.TypeParameters) || visitNodeList(v, node.Parameters) || visit(v, node.Type) +} + +func (node *JSDocSignature) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocSignature(node, v.visitNodes(node.TypeParameters), v.visitNodes(node.Parameters), v.visitNode(node.Type)) +} + +func (node *JSDocSignature) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocSignature(node.TypeParameters, node.Parameters, node.Type), node.AsNode(), f.AsNodeFactory().hooks) +} + +func IsJSDocSignature(node *Node) bool { + return node.Kind == KindJSDocSignature +} + +// JSDocNameReference +type JSDocNameReference struct { + TypeNodeBase + name *EntityName +} + +func (f *NodeFactory) NewJSDocNameReference(name *EntityName) *Node { + data := &JSDocNameReference{} + data.name = name + return f.newNode(KindJSDocNameReference, data) +} + +func (f *NodeFactory) UpdateJSDocNameReference(node *JSDocNameReference, name *EntityName) *Node { + if name != node.name { + return updateNode(f.NewJSDocNameReference(name), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *JSDocNameReference) ForEachChild(v Visitor) bool { + return visit(v, node.name) +} + +func (node *JSDocNameReference) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateJSDocNameReference(node, v.visitNode(node.name)) +} + +func (node *JSDocNameReference) Clone(f NodeFactoryCoercible) *Node { + return cloneNode(f.AsNodeFactory().NewJSDocNameReference(node.Name()), node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *JSDocNameReference) Name() *EntityName { return node.name } + +func IsJSDocNameReference(node *Node) bool { + return node.Kind == KindJSDocNameReference +} + +// PatternAmbientModule + +type PatternAmbientModule struct { + Pattern core.Pattern + Symbol *Symbol +} + +type CommentDirectiveKind int32 + +const ( + CommentDirectiveKindUnknown CommentDirectiveKind = iota + CommentDirectiveKindExpectError + CommentDirectiveKindIgnore +) + +type CommentDirective struct { + Loc core.TextRange + Kind CommentDirectiveKind +} + +// SourceFile + +type SourceFileMetaData struct { + PackageJsonType string + PackageJsonDirectory string + ImpliedNodeFormat core.ResolutionMode +} + +type CheckJsDirective struct { + Enabled bool + Range CommentRange +} + +type HasFileName interface { + FileName() string + Path() tspath.Path +} + +type SourceFile struct { + NodeBase + DeclarationBase + LocalsContainerBase + compositeNodeBase + + // Fields set by NewSourceFile + fileName string // For debugging convenience + parseOptions SourceFileParseOptions + text string + Statements *NodeList // NodeList[*Statement] + EndOfFileToken *TokenNode // TokenNode[*EndOfFileToken] + + // Fields set by parser + diagnostics []*Diagnostic + jsDiagnostics []*Diagnostic + jsdocDiagnostics []*Diagnostic + LanguageVariant core.LanguageVariant + ScriptKind core.ScriptKind + IsDeclarationFile bool + UsesUriStyleNodeCoreModules core.Tristate + Identifiers map[string]string + IdentifierCount int + imports []*LiteralLikeNode // []LiteralLikeNode + ModuleAugmentations []*ModuleName // []ModuleName + AmbientModuleNames []string + CommentDirectives []CommentDirective + jsdocCache map[*Node][]*Node + Pragmas []Pragma + ReferencedFiles []*FileReference + TypeReferenceDirectives []*FileReference + LibReferenceDirectives []*FileReference + CheckJsDirective *CheckJsDirective + NodeCount int + TextCount int + CommonJSModuleIndicator *Node + ExternalModuleIndicator *Node + + // Fields set by binder + + isBound atomic.Bool + bindOnce sync.Once + bindDiagnostics []*Diagnostic + BindSuggestionDiagnostics []*Diagnostic + EndFlowNode *FlowNode + SymbolCount int + ClassifiableNames collections.Set[string] + PatternAmbientModules []*PatternAmbientModule + + // Fields set by ECMALineMap + + ecmaLineMapMu sync.RWMutex + ecmaLineMap []core.TextPos + + // Fields set by language service + + tokenCacheMu sync.Mutex + tokenCache map[core.TextRange]*Node + declarationMapMu sync.Mutex + declarationMap map[string][]*Node +} + +func (f *NodeFactory) NewSourceFile(opts SourceFileParseOptions, text string, statements *NodeList, endOfFileToken *TokenNode) *Node { + if tspath.GetEncodedRootLength(opts.FileName) == 0 || opts.FileName != tspath.NormalizePath(opts.FileName) { + panic(fmt.Sprintf("fileName should be normalized and absolute: %q", opts.FileName)) + } + data := &SourceFile{} + data.fileName = opts.FileName + data.parseOptions = opts + data.text = text + data.Statements = statements + data.EndOfFileToken = endOfFileToken + return f.newNode(KindSourceFile, data) +} + +func (node *SourceFile) ParseOptions() SourceFileParseOptions { + return node.parseOptions +} + +func (node *SourceFile) Text() string { + return node.text +} + +func (node *SourceFile) FileName() string { + return node.parseOptions.FileName +} + +func (node *SourceFile) Path() tspath.Path { + return node.parseOptions.Path +} + +func (node *SourceFile) Imports() []*LiteralLikeNode { + return node.imports +} + +func (node *SourceFile) Diagnostics() []*Diagnostic { + return node.diagnostics +} + +func (node *SourceFile) SetDiagnostics(diags []*Diagnostic) { + node.diagnostics = diags +} + +func (node *SourceFile) JSDiagnostics() []*Diagnostic { + return node.jsDiagnostics +} + +func (node *SourceFile) SetJSDiagnostics(diags []*Diagnostic) { + node.jsDiagnostics = diags +} + +func (node *SourceFile) JSDocDiagnostics() []*Diagnostic { + return node.jsdocDiagnostics +} + +func (node *SourceFile) SetJSDocDiagnostics(diags []*Diagnostic) { + node.jsdocDiagnostics = diags +} + +func (node *SourceFile) JSDocCache() map[*Node][]*Node { + return node.jsdocCache +} + +func (node *SourceFile) SetJSDocCache(cache map[*Node][]*Node) { + node.jsdocCache = cache +} + +func (node *SourceFile) BindDiagnostics() []*Diagnostic { + return node.bindDiagnostics +} + +func (node *SourceFile) SetBindDiagnostics(diags []*Diagnostic) { + node.bindDiagnostics = diags +} + +func (node *SourceFile) ForEachChild(v Visitor) bool { + return visitNodeList(v, node.Statements) || visit(v, node.EndOfFileToken) +} + +func (node *SourceFile) VisitEachChild(v *NodeVisitor) *Node { + return v.Factory.UpdateSourceFile(node, v.visitTopLevelStatements(node.Statements), v.visitToken(node.EndOfFileToken)) +} + +func (node *SourceFile) IsJS() bool { + return IsSourceFileJS(node) +} + +func (node *SourceFile) copyFrom(other *SourceFile) { + // Do not copy fields set by NewSourceFile (Text, FileName, Path, or Statements) + node.LanguageVariant = other.LanguageVariant + node.ScriptKind = other.ScriptKind + node.IsDeclarationFile = other.IsDeclarationFile + node.UsesUriStyleNodeCoreModules = other.UsesUriStyleNodeCoreModules + node.Identifiers = other.Identifiers + node.imports = other.imports + node.ModuleAugmentations = other.ModuleAugmentations + node.AmbientModuleNames = other.AmbientModuleNames + node.CommentDirectives = other.CommentDirectives + node.Pragmas = other.Pragmas + node.ReferencedFiles = other.ReferencedFiles + node.TypeReferenceDirectives = other.TypeReferenceDirectives + node.LibReferenceDirectives = other.LibReferenceDirectives + node.CommonJSModuleIndicator = other.CommonJSModuleIndicator + node.ExternalModuleIndicator = other.ExternalModuleIndicator + node.Flags |= other.Flags +} + +func (node *SourceFile) Clone(f NodeFactoryCoercible) *Node { + updated := f.AsNodeFactory().NewSourceFile(node.parseOptions, node.text, node.Statements, node.EndOfFileToken) + newFile := updated.AsSourceFile() + newFile.copyFrom(node) + return cloneNode(updated, node.AsNode(), f.AsNodeFactory().hooks) +} + +func (node *SourceFile) computeSubtreeFacts() SubtreeFacts { + return propagateNodeListSubtreeFacts(node.Statements, propagateSubtreeFacts) +} + +func (f *NodeFactory) UpdateSourceFile(node *SourceFile, statements *StatementList, endOfFileToken *TokenNode) *Node { + if statements != node.Statements || endOfFileToken != node.EndOfFileToken { + updated := f.NewSourceFile(node.parseOptions, node.text, statements, endOfFileToken).AsSourceFile() + updated.copyFrom(node) + return updateNode(updated.AsNode(), node.AsNode(), f.hooks) + } + return node.AsNode() +} + +func (node *SourceFile) ECMALineMap() []core.TextPos { + node.ecmaLineMapMu.RLock() + lineMap := node.ecmaLineMap + node.ecmaLineMapMu.RUnlock() + if lineMap == nil { + node.ecmaLineMapMu.Lock() + defer node.ecmaLineMapMu.Unlock() + lineMap = node.ecmaLineMap + if lineMap == nil { + lineMap = core.ComputeECMALineStarts(node.Text()) + node.ecmaLineMap = lineMap + } + } + return lineMap +} + +func (node *SourceFile) IsBound() bool { + return node.isBound.Load() +} + +func (node *SourceFile) BindOnce(bind func()) { + node.bindOnce.Do(func() { + bind() + node.isBound.Store(true) + }) +} + +func (node *SourceFile) GetOrCreateToken( + kind Kind, + pos int, + end int, + parent *Node, +) *TokenNode { + node.tokenCacheMu.Lock() + defer node.tokenCacheMu.Unlock() + + loc := core.NewTextRange(pos, end) + if node.tokenCache == nil { + node.tokenCache = make(map[core.TextRange]*Node) + } else if token, ok := node.tokenCache[loc]; ok { + if token.Kind != kind { + panic(fmt.Sprintf("Token cache mismatch: %v != %v", token.Kind, kind)) + } + if token.Parent != parent { + panic(fmt.Sprintf("Token cache mismatch: parent. Expected parent of kind %v, got %v", token.Parent.Kind, parent.Kind)) + } + return token + } + + token := newNode(kind, &Token{}, NodeFactoryHooks{}) + token.Loc = loc + token.Parent = parent + node.tokenCache[loc] = token + return token +} + +func IsSourceFile(node *Node) bool { + return node.Kind == KindSourceFile +} + +func (node *SourceFile) GetDeclarationMap() map[string][]*Node { + node.declarationMapMu.Lock() + defer node.declarationMapMu.Unlock() + if node.declarationMap == nil { + node.declarationMap = node.computeDeclarationMap() + } + return node.declarationMap +} + +func (node *SourceFile) computeDeclarationMap() map[string][]*Node { + result := make(map[string][]*Node) + + addDeclaration := func(declaration *Node) { + name := getDeclarationName(declaration) + if name != "" { + result[name] = append(result[name], declaration) + } + } + + var visit func(*Node) bool + visit = func(node *Node) bool { + switch node.Kind { + case KindFunctionDeclaration, KindFunctionExpression, KindMethodDeclaration, KindMethodSignature: + declarationName := getDeclarationName(node) + if declarationName != "" { + declarations := result[declarationName] + var lastDeclaration *Node + if len(declarations) != 0 { + lastDeclaration = declarations[len(declarations)-1] + } + // Check whether this declaration belongs to an "overload group". + if lastDeclaration != nil && node.Parent == lastDeclaration.Parent && node.Symbol() == lastDeclaration.Symbol() { + // Overwrite the last declaration if it was an overload and this one is an implementation. + if node.Body() != nil && lastDeclaration.Body() == nil { + declarations[len(declarations)-1] = node + } + } else { + result[declarationName] = append(result[declarationName], node) + } + } + node.ForEachChild(visit) + case KindClassDeclaration, KindClassExpression, KindInterfaceDeclaration, KindTypeAliasDeclaration, KindEnumDeclaration, KindModuleDeclaration, + KindImportEqualsDeclaration, KindImportClause, KindNamespaceImport, KindGetAccessor, KindSetAccessor, KindTypeLiteral: + addDeclaration(node) + node.ForEachChild(visit) + case KindImportSpecifier, KindExportSpecifier: + if node.PropertyName() != nil { + addDeclaration(node) + } + case KindParameter: + // Only consider parameter properties + if !HasSyntacticModifier(node, ModifierFlagsParameterPropertyModifier) { + break + } + fallthrough + case KindVariableDeclaration, KindBindingElement: + name := node.Name() + if name != nil { + if IsBindingPattern(name) { + node.Name().ForEachChild(visit) + } else { + if node.Initializer() != nil { + visit(node.Initializer()) + } + addDeclaration(node) + } + } + case KindEnumMember, KindPropertyDeclaration, KindPropertySignature: + addDeclaration(node) + case KindExportDeclaration: + // Handle named exports case e.g.: + // export {a, b as B} from "mod"; + exportClause := node.AsExportDeclaration().ExportClause + if exportClause != nil { + if IsNamedExports(exportClause) { + for _, element := range exportClause.AsNamedExports().Elements.Nodes { + visit(element) + } + } else { + visit(exportClause.AsNamespaceExport().Name()) + } + } + case KindImportDeclaration: + importClause := node.AsImportDeclaration().ImportClause + if importClause != nil { + // Handle default import case e.g.: + // import d from "mod"; + if importClause.Name() != nil { + addDeclaration(importClause.Name()) + } + // Handle named bindings in imports e.g.: + // import * as NS from "mod"; + // import {a, b as B} from "mod"; + namedBindings := importClause.AsImportClause().NamedBindings + if namedBindings != nil { + if namedBindings.Kind == KindNamespaceImport { + addDeclaration(namedBindings) + } else { + for _, element := range namedBindings.AsNamedImports().Elements.Nodes { + visit(element) + } + } + } + } + default: + node.ForEachChild(visit) + } + return false + } + node.ForEachChild(visit) + return result +} + +func getDeclarationName(declaration *Node) string { + name := GetNonAssignedNameOfDeclaration(declaration) + if name != nil { + if IsComputedPropertyName(name) { + if IsStringOrNumericLiteralLike(name.Expression()) { + return name.Expression().Text() + } + if IsPropertyAccessExpression(name.Expression()) { + return name.Expression().Name().Text() + } + } else if IsPropertyName(name) { + return name.Text() + } + } + return "" +} + +type SourceFileLike interface { + Text() string + ECMALineMap() []core.TextPos +} + +type CommentRange struct { + core.TextRange + Kind Kind + HasTrailingNewLine bool +} + +func (f *NodeFactory) NewCommentRange(kind Kind, pos int, end int, hasTrailingNewLine bool) CommentRange { + return CommentRange{ + TextRange: core.NewTextRange(pos, end), + Kind: kind, + HasTrailingNewLine: hasTrailingNewLine, + } +} + +type FileReference struct { + core.TextRange + FileName string + ResolutionMode core.ResolutionMode + Preserve bool +} + +type PragmaArgument struct { + core.TextRange + Name string + Value string +} + +type Pragma struct { + CommentRange + Name string + Args map[string]PragmaArgument +} + +type PragmaKindFlags = uint8 + +const ( + PragmaKindTripleSlashXML PragmaKindFlags = 1 << iota + PragmaKindSingleLine + PragmaKindMultiLine + PragmaKindFlagsNone PragmaKindFlags = 0 + PragmaKindAll = PragmaKindTripleSlashXML | PragmaKindSingleLine | PragmaKindMultiLine + PragmaKindDefault = PragmaKindAll +) + +type PragmaArgumentSpecification struct { + Name string + Optional bool + CaptureSpan bool +} +type PragmaSpecification struct { + Args []PragmaArgumentSpecification + Kind PragmaKindFlags +} + +func (spec *PragmaSpecification) IsTripleSlash() bool { + return (spec.Kind & PragmaKindTripleSlashXML) > 0 +} diff --git a/kitcom/internal/tsgo/ast/checkflags.go b/kitcom/internal/tsgo/ast/checkflags.go new file mode 100644 index 0000000..5c86398 --- /dev/null +++ b/kitcom/internal/tsgo/ast/checkflags.go @@ -0,0 +1,35 @@ +package ast + +// CheckFlags + +type CheckFlags uint32 + +const ( + CheckFlagsNone CheckFlags = 0 + CheckFlagsInstantiated CheckFlags = 1 << 0 // Instantiated symbol + CheckFlagsSyntheticProperty CheckFlags = 1 << 1 // Property in union or intersection type + CheckFlagsSyntheticMethod CheckFlags = 1 << 2 // Method in union or intersection type + CheckFlagsReadonly CheckFlags = 1 << 3 // Readonly transient symbol + CheckFlagsReadPartial CheckFlags = 1 << 4 // Synthetic property present in some but not all constituents + CheckFlagsWritePartial CheckFlags = 1 << 5 // Synthetic property present in some but only satisfied by an index signature in others + CheckFlagsHasNonUniformType CheckFlags = 1 << 6 // Synthetic property with non-uniform type in constituents + CheckFlagsHasLiteralType CheckFlags = 1 << 7 // Synthetic property with at least one literal type in constituents + CheckFlagsContainsPublic CheckFlags = 1 << 8 // Synthetic property with public constituent(s) + CheckFlagsContainsProtected CheckFlags = 1 << 9 // Synthetic property with protected constituent(s) + CheckFlagsContainsPrivate CheckFlags = 1 << 10 // Synthetic property with private constituent(s) + CheckFlagsContainsStatic CheckFlags = 1 << 11 // Synthetic property with static constituent(s) + CheckFlagsLate CheckFlags = 1 << 12 // Late-bound symbol for a computed property with a dynamic name + CheckFlagsReverseMapped CheckFlags = 1 << 13 // Property of reverse-inferred homomorphic mapped type + CheckFlagsOptionalParameter CheckFlags = 1 << 14 // Optional parameter + CheckFlagsRestParameter CheckFlags = 1 << 15 // Rest parameter + CheckFlagsDeferredType CheckFlags = 1 << 16 // Calculation of the type of this symbol is deferred due to processing costs, should be fetched with `getTypeOfSymbolWithDeferredType` + CheckFlagsHasNeverType CheckFlags = 1 << 17 // Synthetic property with at least one never type in constituents + CheckFlagsMapped CheckFlags = 1 << 18 // Property of mapped type + CheckFlagsStripOptional CheckFlags = 1 << 19 // Strip optionality in mapped property + CheckFlagsUnresolved CheckFlags = 1 << 20 // Unresolved type alias symbol + CheckFlagsIsDiscriminantComputed CheckFlags = 1 << 21 // IsDiscriminant flags has been computed + CheckFlagsIsDiscriminant CheckFlags = 1 << 22 // Discriminant property + CheckFlagsSynthetic = CheckFlagsSyntheticProperty | CheckFlagsSyntheticMethod + CheckFlagsNonUniformAndLiteral = CheckFlagsHasNonUniformType | CheckFlagsHasLiteralType + CheckFlagsPartial = CheckFlagsReadPartial | CheckFlagsWritePartial +) diff --git a/kitcom/internal/tsgo/ast/deepclone.go b/kitcom/internal/tsgo/ast/deepclone.go new file mode 100644 index 0000000..f7f0890 --- /dev/null +++ b/kitcom/internal/tsgo/ast/deepclone.go @@ -0,0 +1,86 @@ +package ast + +import "efprojects.com/kitten-ipc/kitcom/internal/tsgo/core" + +// Ideally, this would get cached on the node factory so there's only ever one set of closures made per factory +func getDeepCloneVisitor(f *NodeFactory, syntheticLocation bool) *NodeVisitor { + var visitor *NodeVisitor + visitor = NewNodeVisitor( + func(node *Node) *Node { + visited := visitor.VisitEachChild(node) + if visited != node { + if syntheticLocation { + visited.Loc = core.NewTextRange(-1, -1) + } + return visited + } + c := node.Clone(f) // forcibly clone leaf nodes, which will then cascade new nodes/arrays upwards via `update` calls + // In strada, `factory.cloneNode` was dynamic and did _not_ clone positions for any "special cases", meanwhile + // Node.Clone in corsa reliably uses `Update` calls for all nodes and so copies locations by default. + // Deep clones are done to copy a node across files, so here, we explicitly make the location range synthetic on all cloned nodes + if syntheticLocation { + c.Loc = core.NewTextRange(-1, -1) + } + return c + }, + f, + NodeVisitorHooks{ + VisitNodes: func(nodes *NodeList, v *NodeVisitor) *NodeList { + if nodes == nil { + return nil + } + visited := v.VisitNodes(nodes) + var newList *NodeList + if visited != nodes { + newList = visited + } else { + newList = nodes.Clone(v.Factory) + } + if syntheticLocation { + newList.Loc = core.NewTextRange(-1, -1) + if nodes.HasTrailingComma() { + newList.Nodes[len(newList.Nodes)-1].Loc = core.NewTextRange(-2, -2) + } + } + return newList + }, + VisitModifiers: func(nodes *ModifierList, v *NodeVisitor) *ModifierList { + if nodes == nil { + return nil + } + visited := v.VisitModifiers(nodes) + var newList *ModifierList + if visited != nodes { + newList = visited + } else { + newList = nodes.Clone(v.Factory) + } + if syntheticLocation { + newList.Loc = core.NewTextRange(-1, -1) + if nodes.HasTrailingComma() { + newList.Nodes[len(newList.Nodes)-1].Loc = core.NewTextRange(-2, -2) + } + } + return newList + }, + }, + ) + return visitor +} + +func (f *NodeFactory) DeepCloneNode(node *Node) *Node { + return getDeepCloneVisitor(f, true /*syntheticLocation*/).VisitNode(node) +} + +func (f *NodeFactory) DeepCloneReparse(node *Node) *Node { + if node != nil { + node = getDeepCloneVisitor(f, false /*syntheticLocation*/).VisitNode(node) + SetParentInChildren(node) + node.Flags |= NodeFlagsReparsed + } + return node +} + +func (f *NodeFactory) DeepCloneReparseModifiers(modifiers *ModifierList) *ModifierList { + return getDeepCloneVisitor(f, false /*syntheticLocation*/).VisitModifiers(modifiers) +} diff --git a/kitcom/internal/tsgo/ast/deepclone_test.go b/kitcom/internal/tsgo/ast/deepclone_test.go new file mode 100644 index 0000000..3266dcf --- /dev/null +++ b/kitcom/internal/tsgo/ast/deepclone_test.go @@ -0,0 +1,599 @@ +package ast_test + +import ( + "testing" + + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/ast" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil/parsetestutil" + "gotest.tools/v3/assert" +) + +type NodeComparisonWorkItem struct { + original *ast.Node + copy *ast.Node +} + +func getChildren(node *ast.Node) []*ast.Node { + children := []*ast.Node{} + node.VisitEachChild(ast.NewNodeVisitor(func(node *ast.Node) *ast.Node { + children = append(children, node) + return node + }, nil, ast.NodeVisitorHooks{})) + return children +} + +func TestDeepCloneNodeSanityCheck(t *testing.T) { + t.Parallel() + data := []struct { + title string + input string + jsx bool + }{ + {title: "StringLiteral#1", input: `;"test"`}, + {title: "StringLiteral#2", input: `;'test'`}, + {title: "NumericLiteral", input: `0`}, + {title: "BigIntLiteral", input: `0n`}, + {title: "BooleanLiteral#1", input: `true`}, + {title: "BooleanLiteral#2", input: `false`}, + {title: "NoSubstitutionTemplateLiteral", input: "``"}, + {title: "RegularExpressionLiteral#1", input: `/a/`}, + {title: "RegularExpressionLiteral#2", input: `/a/g`}, + {title: "NullLiteral", input: `null`}, + {title: "ThisExpression", input: `this`}, + {title: "SuperExpression", input: `super()`}, + {title: "ImportExpression", input: `import()`}, + {title: "PropertyAccess#1", input: `a.b`}, + {title: "PropertyAccess#2", input: `a.#b`}, + {title: "PropertyAccess#3", input: `a?.b`}, + {title: "PropertyAccess#4", input: `a?.b.c`}, + {title: "PropertyAccess#5", input: `1..b`}, + {title: "PropertyAccess#6", input: `1.0.b`}, + {title: "PropertyAccess#7", input: `0x1.b`}, + {title: "PropertyAccess#8", input: `0b1.b`}, + {title: "PropertyAccess#9", input: `0o1.b`}, + {title: "PropertyAccess#10", input: `10e1.b`}, + {title: "PropertyAccess#11", input: `10E1.b`}, + {title: "ElementAccess#1", input: `a[b]`}, + {title: "ElementAccess#2", input: `a?.[b]`}, + {title: "ElementAccess#3", input: `a?.[b].c`}, + {title: "CallExpression#1", input: `a()`}, + {title: "CallExpression#2", input: `a()`}, + {title: "CallExpression#3", input: `a(b)`}, + {title: "CallExpression#4", input: `a(b)`}, + {title: "CallExpression#5", input: `a(b).c`}, + {title: "CallExpression#6", input: `a(b).c`}, + {title: "CallExpression#7", input: `a?.(b)`}, + {title: "CallExpression#8", input: `a?.(b)`}, + {title: "CallExpression#9", input: `a?.(b).c`}, + {title: "CallExpression#10", input: `a?.(b).c`}, + {title: "CallExpression#11", input: `a()`}, + {title: "CallExpression#12", input: `a()`}, + {title: "NewExpression#1", input: `new a`}, + {title: "NewExpression#2", input: `new a.b`}, + {title: "NewExpression#3", input: `new a()`}, + {title: "NewExpression#4", input: `new a.b()`}, + {title: "NewExpression#5", input: `new a()`}, + {title: "NewExpression#6", input: `new a.b()`}, + {title: "NewExpression#7", input: `new a(b)`}, + {title: "NewExpression#8", input: `new a.b(c)`}, + {title: "NewExpression#9", input: `new a(b)`}, + {title: "NewExpression#10", input: `new a.b(c)`}, + {title: "NewExpression#11", input: `new a(b).c`}, + {title: "NewExpression#12", input: `new a(b).c`}, + {title: "TaggedTemplateExpression#1", input: "tag``"}, + {title: "TaggedTemplateExpression#2", input: "tag``"}, + {title: "TypeAssertionExpression#1", input: `a`}, + {title: "FunctionExpression#1", input: `(function(){})`}, + {title: "FunctionExpression#2", input: `(function f(){})`}, + {title: "FunctionExpression#3", input: `(function*f(){})`}, + {title: "FunctionExpression#4", input: `(async function f(){})`}, + {title: "FunctionExpression#5", input: `(async function*f(){})`}, + {title: "FunctionExpression#6", input: `(function(){})`}, + {title: "FunctionExpression#7", input: `(function(a){})`}, + {title: "FunctionExpression#8", input: `(function():T{})`}, + {title: "ArrowFunction#1", input: `a=>{}`}, + {title: "ArrowFunction#2", input: `()=>{}`}, + {title: "ArrowFunction#3", input: `(a)=>{}`}, + {title: "ArrowFunction#4", input: `(a)=>{}`}, + {title: "ArrowFunction#5", input: `async a=>{}`}, + {title: "ArrowFunction#6", input: `async()=>{}`}, + {title: "ArrowFunction#7", input: `async()=>{}`}, + {title: "ArrowFunction#8", input: `():T=>{}`}, + {title: "ArrowFunction#9", input: `()=>a`}, + {title: "DeleteExpression", input: `delete a`}, + {title: "TypeOfExpression", input: `typeof a`}, + {title: "VoidExpression", input: `void a`}, + {title: "AwaitExpression", input: `await a`}, + {title: "PrefixUnaryExpression#1", input: `+a`}, + {title: "PrefixUnaryExpression#2", input: `++a`}, + {title: "PrefixUnaryExpression#3", input: `+ +a`}, + {title: "PrefixUnaryExpression#4", input: `+ ++a`}, + {title: "PrefixUnaryExpression#5", input: `-a`}, + {title: "PrefixUnaryExpression#6", input: `--a`}, + {title: "PrefixUnaryExpression#7", input: `- -a`}, + {title: "PrefixUnaryExpression#8", input: `- --a`}, + {title: "PrefixUnaryExpression#9", input: `+-a`}, + {title: "PrefixUnaryExpression#10", input: `+--a`}, + {title: "PrefixUnaryExpression#11", input: `-+a`}, + {title: "PrefixUnaryExpression#12", input: `-++a`}, + {title: "PrefixUnaryExpression#13", input: `~a`}, + {title: "PrefixUnaryExpression#14", input: `!a`}, + {title: "PostfixUnaryExpression#1", input: `a++`}, + {title: "PostfixUnaryExpression#2", input: `a--`}, + {title: "BinaryExpression#1", input: `a,b`}, + {title: "BinaryExpression#2", input: `a+b`}, + {title: "BinaryExpression#3", input: `a**b`}, + {title: "BinaryExpression#4", input: `a instanceof b`}, + {title: "BinaryExpression#5", input: `a in b`}, + {title: "ConditionalExpression", input: `a?b:c`}, + {title: "TemplateExpression#1", input: "`a${b}c`"}, + {title: "TemplateExpression#2", input: "`a${b}c${d}e`"}, + {title: "YieldExpression#1", input: `(function*() { yield })`}, + {title: "YieldExpression#2", input: `(function*() { yield a })`}, + {title: "YieldExpression#3", input: `(function*() { yield*a })`}, + {title: "SpreadElement", input: `[...a]`}, + {title: "ClassExpression#1", input: `(class {})`}, + {title: "ClassExpression#2", input: `(class a {})`}, + {title: "ClassExpression#3", input: `(class{})`}, + {title: "ClassExpression#4", input: `(class a{})`}, + {title: "ClassExpression#5", input: `(class extends b {})`}, + {title: "ClassExpression#6", input: `(class a extends b {})`}, + {title: "ClassExpression#7", input: `(class implements b {})`}, + {title: "ClassExpression#8", input: `(class a implements b {})`}, + {title: "ClassExpression#9", input: `(class implements b, c {})`}, + {title: "ClassExpression#10", input: `(class a implements b, c {})`}, + {title: "ClassExpression#11", input: `(class extends b implements c, d {})`}, + {title: "ClassExpression#12", input: `(class a extends b implements c, d {})`}, + {title: "ClassExpression#13", input: `(@a class {})`}, + {title: "OmittedExpression", input: `[,]`}, + {title: "ExpressionWithTypeArguments", input: `a`}, + {title: "AsExpression", input: `a as T`}, + {title: "SatisfiesExpression", input: `a satisfies T`}, + {title: "NonNullExpression", input: `a!`}, + {title: "MetaProperty#1", input: `new.target`}, + {title: "MetaProperty#2", input: `import.meta`}, + {title: "ArrayLiteralExpression#1", input: `[]`}, + {title: "ArrayLiteralExpression#2", input: `[a]`}, + {title: "ArrayLiteralExpression#3", input: `[a,]`}, + {title: "ArrayLiteralExpression#4", input: `[,a]`}, + {title: "ArrayLiteralExpression#5", input: `[...a]`}, + {title: "ObjectLiteralExpression#1", input: `({})`}, + {title: "ObjectLiteralExpression#2", input: `({a,})`}, + {title: "ShorthandPropertyAssignment", input: `({a})`}, + {title: "PropertyAssignment", input: `({a:b})`}, + {title: "SpreadAssignment", input: `({...a})`}, + {title: "Block", input: `{}`}, + {title: "VariableStatement#1", input: `var a`}, + {title: "VariableStatement#2", input: `let a`}, + {title: "VariableStatement#3", input: `const a = b`}, + {title: "VariableStatement#4", input: `using a = b`}, + {title: "VariableStatement#5", input: `await using a = b`}, + {title: "EmptyStatement", input: `;`}, + {title: "IfStatement#1", input: `if(a);`}, + {title: "IfStatement#2", input: `if(a);else;`}, + {title: "IfStatement#3", input: `if(a);else{}`}, + {title: "IfStatement#4", input: `if(a);else if(b);`}, + {title: "IfStatement#5", input: `if(a);else if(b) {}`}, + {title: "IfStatement#6", input: `if(a) {}`}, + {title: "IfStatement#7", input: `if(a) {} else;`}, + {title: "IfStatement#8", input: `if(a) {} else {}`}, + {title: "IfStatement#9", input: `if(a) {} else if(b);`}, + {title: "IfStatement#10", input: `if(a) {} else if(b){}`}, + {title: "DoStatement#1", input: `do;while(a);`}, + {title: "DoStatement#2", input: `do {} while(a);`}, + {title: "WhileStatement#1", input: `while(a);`}, + {title: "WhileStatement#2", input: `while(a) {}`}, + {title: "ForStatement#1", input: `for(;;);`}, + {title: "ForStatement#2", input: `for(a;;);`}, + {title: "ForStatement#3", input: `for(var a;;);`}, + {title: "ForStatement#4", input: `for(;a;);`}, + {title: "ForStatement#5", input: `for(;;a);`}, + {title: "ForStatement#6", input: `for(;;){}`}, + {title: "ForInStatement#1", input: `for(a in b);`}, + {title: "ForInStatement#2", input: `for(var a in b);`}, + {title: "ForInStatement#3", input: `for(a in b){}`}, + {title: "ForOfStatement#1", input: `for(a of b);`}, + {title: "ForOfStatement#2", input: `for(var a of b);`}, + {title: "ForOfStatement#3", input: `for(a of b){}`}, + {title: "ForOfStatement#4", input: `for await(a of b);`}, + {title: "ForOfStatement#5", input: `for await(var a of b);`}, + {title: "ForOfStatement#6", input: `for await(a of b){}`}, + {title: "ContinueStatement#1", input: `continue`}, + {title: "ContinueStatement#2", input: `continue a`}, + {title: "BreakStatement#1", input: `break`}, + {title: "BreakStatement#2", input: `break a`}, + {title: "ReturnStatement#1", input: `return`}, + {title: "ReturnStatement#2", input: `return a`}, + {title: "WithStatement#1", input: `with(a);`}, + {title: "WithStatement#2", input: `with(a){}`}, + {title: "SwitchStatement", input: `switch (a) {}`}, + {title: "CaseClause#1", input: `switch (a) {case b:}`}, + {title: "CaseClause#2", input: `switch (a) {case b:;}`}, + {title: "DefaultClause#1", input: `switch (a) {default:}`}, + {title: "DefaultClause#2", input: `switch (a) {default:;}`}, + {title: "LabeledStatement", input: `a:;`}, + {title: "ThrowStatement", input: `throw a`}, + {title: "TryStatement#1", input: `try {} catch {}`}, + {title: "TryStatement#2", input: `try {} finally {}`}, + {title: "TryStatement#3", input: `try {} catch {} finally {}`}, + {title: "DebuggerStatement", input: `debugger`}, + {title: "FunctionDeclaration#1", input: `export default function(){}`}, + {title: "FunctionDeclaration#2", input: `function f(){}`}, + {title: "FunctionDeclaration#3", input: `function*f(){}`}, + {title: "FunctionDeclaration#4", input: `async function f(){}`}, + {title: "FunctionDeclaration#5", input: `async function*f(){}`}, + {title: "FunctionDeclaration#6", input: `function f(){}`}, + {title: "FunctionDeclaration#7", input: `function f(a){}`}, + {title: "FunctionDeclaration#8", input: `function f():T{}`}, + {title: "FunctionDeclaration#9", input: `function f();`}, + {title: "ClassDeclaration#1", input: `class a {}`}, + {title: "ClassDeclaration#2", input: `class a{}`}, + {title: "ClassDeclaration#3", input: `class a extends b {}`}, + {title: "ClassDeclaration#4", input: `class a implements b {}`}, + {title: "ClassDeclaration#5", input: `class a implements b, c {}`}, + {title: "ClassDeclaration#6", input: `class a extends b implements c, d {}`}, + {title: "ClassDeclaration#7", input: `export default class {}`}, + {title: "ClassDeclaration#8", input: `export default class{}`}, + {title: "ClassDeclaration#9", input: `export default class extends b {}`}, + {title: "ClassDeclaration#10", input: `export default class implements b {}`}, + {title: "ClassDeclaration#11", input: `export default class implements b, c {}`}, + {title: "ClassDeclaration#12", input: `export default class extends b implements c, d {}`}, + {title: "ClassDeclaration#13", input: `@a class b {}`}, + {title: "ClassDeclaration#14", input: `@a export class b {}`}, + {title: "ClassDeclaration#15", input: `export @a class b {}`}, + {title: "InterfaceDeclaration#1", input: `interface a {}`}, + {title: "InterfaceDeclaration#2", input: `interface a{}`}, + {title: "InterfaceDeclaration#3", input: `interface a extends b {}`}, + {title: "InterfaceDeclaration#4", input: `interface a extends b, c {}`}, + {title: "TypeAliasDeclaration#1", input: `type a = b`}, + {title: "TypeAliasDeclaration#2", input: `type a = b`}, + {title: "EnumDeclaration#1", input: `enum a{}`}, + {title: "EnumDeclaration#2", input: `enum a{b}`}, + {title: "EnumDeclaration#3", input: `enum a{b=c}`}, + {title: "ModuleDeclaration#1", input: `module a{}`}, + {title: "ModuleDeclaration#2", input: `module a.b{}`}, + {title: "ModuleDeclaration#3", input: `module "a";`}, + {title: "ModuleDeclaration#4", input: `module "a"{}`}, + {title: "ModuleDeclaration#5", input: `namespace a{}`}, + {title: "ModuleDeclaration#6", input: `namespace a.b{}`}, + {title: "ModuleDeclaration#7", input: `global;`}, + {title: "ModuleDeclaration#8", input: `global{}`}, + {title: "ImportEqualsDeclaration#1", input: `import a = b`}, + {title: "ImportEqualsDeclaration#2", input: `import a = b.c`}, + {title: "ImportEqualsDeclaration#3", input: `import a = require("b")`}, + {title: "ImportEqualsDeclaration#4", input: `export import a = b`}, + {title: "ImportEqualsDeclaration#5", input: `export import a = require("b")`}, + {title: "ImportEqualsDeclaration#6", input: `import type a = b`}, + {title: "ImportEqualsDeclaration#7", input: `import type a = b.c`}, + {title: "ImportEqualsDeclaration#8", input: `import type a = require("b")`}, + {title: "ImportDeclaration#1", input: `import "a"`}, + {title: "ImportDeclaration#2", input: `import a from "b"`}, + {title: "ImportDeclaration#3", input: `import type a from "b"`}, + {title: "ImportDeclaration#4", input: `import * as a from "b"`}, + {title: "ImportDeclaration#5", input: `import type * as a from "b"`}, + {title: "ImportDeclaration#6", input: `import {} from "b"`}, + {title: "ImportDeclaration#7", input: `import type {} from "b"`}, + {title: "ImportDeclaration#8", input: `import { a } from "b"`}, + {title: "ImportDeclaration#9", input: `import type { a } from "b"`}, + {title: "ImportDeclaration#8", input: `import { a as b } from "c"`}, + {title: "ImportDeclaration#9", input: `import type { a as b } from "c"`}, + {title: "ImportDeclaration#10", input: `import { "a" as b } from "c"`}, + {title: "ImportDeclaration#11", input: `import type { "a" as b } from "c"`}, + {title: "ImportDeclaration#12", input: `import a, {} from "b"`}, + {title: "ImportDeclaration#13", input: `import a, * as b from "c"`}, + {title: "ImportDeclaration#14", input: `import {} from "a" with {}`}, + {title: "ImportDeclaration#15", input: `import {} from "a" with { b: "c" }`}, + {title: "ImportDeclaration#16", input: `import {} from "a" with { "b": "c" }`}, + {title: "ExportAssignment#1", input: `export = a`}, + {title: "ExportAssignment#2", input: `export default a`}, + {title: "NamespaceExportDeclaration", input: `export as namespace a`}, + {title: "ExportDeclaration#1", input: `export * from "a"`}, + {title: "ExportDeclaration#2", input: `export type * from "a"`}, + {title: "ExportDeclaration#3", input: `export * as a from "b"`}, + {title: "ExportDeclaration#4", input: `export type * as a from "b"`}, + {title: "ExportDeclaration#5", input: `export { } from "a"`}, + {title: "ExportDeclaration#6", input: `export type { } from "a"`}, + {title: "ExportDeclaration#7", input: `export { a } from "b"`}, + {title: "ExportDeclaration#8", input: `export { type a } from "b"`}, + {title: "ExportDeclaration#9", input: `export type { a } from "b"`}, + {title: "ExportDeclaration#10", input: `export { a as b } from "c"`}, + {title: "ExportDeclaration#11", input: `export { type a as b } from "c"`}, + {title: "ExportDeclaration#12", input: `export type { a as b } from "c"`}, + {title: "ExportDeclaration#13", input: `export { a as "b" } from "c"`}, + {title: "ExportDeclaration#14", input: `export { type a as "b" } from "c"`}, + {title: "ExportDeclaration#15", input: `export type { a as "b" } from "c"`}, + {title: "ExportDeclaration#16", input: `export { "a" } from "b"`}, + {title: "ExportDeclaration#17", input: `export { type "a" } from "b"`}, + {title: "ExportDeclaration#18", input: `export type { "a" } from "b"`}, + {title: "ExportDeclaration#19", input: `export { "a" as b } from "c"`}, + {title: "ExportDeclaration#20", input: `export { type "a" as b } from "c"`}, + {title: "ExportDeclaration#21", input: `export type { "a" as b } from "c"`}, + {title: "ExportDeclaration#22", input: `export { "a" as "b" } from "c"`}, + {title: "ExportDeclaration#23", input: `export { type "a" as "b" } from "c"`}, + {title: "ExportDeclaration#24", input: `export type { "a" as "b" } from "c"`}, + {title: "ExportDeclaration#25", input: `export { }`}, + {title: "ExportDeclaration#26", input: `export type { }`}, + {title: "ExportDeclaration#27", input: `export { a }`}, + {title: "ExportDeclaration#28", input: `export { type a }`}, + {title: "ExportDeclaration#29", input: `export type { a }`}, + {title: "ExportDeclaration#30", input: `export { a as b }`}, + {title: "ExportDeclaration#31", input: `export { type a as b }`}, + {title: "ExportDeclaration#32", input: `export type { a as b }`}, + {title: "ExportDeclaration#33", input: `export { a as "b" }`}, + {title: "ExportDeclaration#34", input: `export { type a as "b" }`}, + {title: "ExportDeclaration#35", input: `export type { a as "b" }`}, + {title: "ExportDeclaration#36", input: `export {} from "a" with {}`}, + {title: "ExportDeclaration#37", input: `export {} from "a" with { b: "c" }`}, + {title: "ExportDeclaration#38", input: `export {} from "a" with { "b": "c" }`}, + {title: "KeywordTypeNode#1", input: `type T = any`}, + {title: "KeywordTypeNode#2", input: `type T = unknown`}, + {title: "KeywordTypeNode#3", input: `type T = never`}, + {title: "KeywordTypeNode#4", input: `type T = void`}, + {title: "KeywordTypeNode#5", input: `type T = undefined`}, + {title: "KeywordTypeNode#6", input: `type T = null`}, + {title: "KeywordTypeNode#7", input: `type T = object`}, + {title: "KeywordTypeNode#8", input: `type T = string`}, + {title: "KeywordTypeNode#9", input: `type T = symbol`}, + {title: "KeywordTypeNode#10", input: `type T = number`}, + {title: "KeywordTypeNode#11", input: `type T = bigint`}, + {title: "KeywordTypeNode#12", input: `type T = boolean`}, + {title: "KeywordTypeNode#13", input: `type T = intrinsic`}, + {title: "TypePredicateNode#1", input: `function f(): asserts a`}, + {title: "TypePredicateNode#2", input: `function f(): asserts a is b`}, + {title: "TypePredicateNode#3", input: `function f(): asserts this`}, + {title: "TypePredicateNode#4", input: `function f(): asserts this is b`}, + {title: "TypeReferenceNode#1", input: `type T = a`}, + {title: "TypeReferenceNode#2", input: `type T = a.b`}, + {title: "TypeReferenceNode#3", input: `type T = a`}, + {title: "TypeReferenceNode#4", input: `type T = a.b`}, + {title: "FunctionTypeNode#1", input: `type T = () => a`}, + {title: "FunctionTypeNode#2", input: `type T = () => a`}, + {title: "FunctionTypeNode#3", input: `type T = (a) => b`}, + {title: "ConstructorTypeNode#1", input: `type T = new () => a`}, + {title: "ConstructorTypeNode#2", input: `type T = new () => a`}, + {title: "ConstructorTypeNode#3", input: `type T = new (a) => b`}, + {title: "ConstructorTypeNode#4", input: `type T = abstract new () => a`}, + {title: "TypeQueryNode#1", input: `type T = typeof a`}, + {title: "TypeQueryNode#2", input: `type T = typeof a.b`}, + {title: "TypeQueryNode#3", input: `type T = typeof a`}, + {title: "TypeLiteralNode#1", input: `type T = {}`}, + {title: "TypeLiteralNode#2", input: `type T = {a}`}, + {title: "ArrayTypeNode", input: `type T = a[]`}, + {title: "TupleTypeNode#1", input: `type T = []`}, + {title: "TupleTypeNode#2", input: `type T = [a]`}, + {title: "TupleTypeNode#3", input: `type T = [a,]`}, + {title: "RestTypeNode", input: `type T = [...a]`}, + {title: "OptionalTypeNode", input: `type T = [a?]`}, + {title: "NamedTupleMember#1", input: `type T = [a: b]`}, + {title: "NamedTupleMember#2", input: `type T = [a?: b]`}, + {title: "NamedTupleMember#3", input: `type T = [...a: b]`}, + {title: "UnionTypeNode#1", input: `type T = a | b`}, + {title: "UnionTypeNode#2", input: `type T = a | b | c`}, + {title: "UnionTypeNode#3", input: `type T = | a | b`}, + {title: "IntersectionTypeNode#1", input: `type T = a & b`}, + {title: "IntersectionTypeNode#2", input: `type T = a & b & c`}, + {title: "IntersectionTypeNode#3", input: `type T = & a & b`}, + {title: "ConditionalTypeNode", input: `type T = a extends b ? c : d`}, + {title: "InferTypeNode#1", input: `type T = a extends infer b ? c : d`}, + {title: "InferTypeNode#2", input: `type T = a extends infer b extends c ? d : e`}, + {title: "ParenthesizedTypeNode", input: `type T = (U)`}, + {title: "ThisTypeNode", input: `type T = this`}, + {title: "TypeOperatorNode#1", input: `type T = keyof U`}, + {title: "TypeOperatorNode#2", input: `type T = readonly U[]`}, + {title: "TypeOperatorNode#3", input: `type T = unique symbol`}, + {title: "IndexedAccessTypeNode", input: `type T = a[b]`}, + {title: "MappedTypeNode#1", input: `type T = { [a in b]: c }`}, + {title: "MappedTypeNode#2", input: `type T = { [a in b as c]: d }`}, + {title: "MappedTypeNode#3", input: `type T = { readonly [a in b]: c }`}, + {title: "MappedTypeNode#4", input: `type T = { +readonly [a in b]: c }`}, + {title: "MappedTypeNode#5", input: `type T = { -readonly [a in b]: c }`}, + {title: "MappedTypeNode#6", input: `type T = { [a in b]?: c }`}, + {title: "MappedTypeNode#7", input: `type T = { [a in b]+?: c }`}, + {title: "MappedTypeNode#8", input: `type T = { [a in b]-?: c }`}, + {title: "MappedTypeNode#9", input: `type T = { [a in b]: c; d }`}, + {title: "LiteralTypeNode#1", input: `type T = null`}, + {title: "LiteralTypeNode#2", input: `type T = true`}, + {title: "LiteralTypeNode#3", input: `type T = false`}, + {title: "LiteralTypeNode#4", input: `type T = ""`}, + {title: "LiteralTypeNode#5", input: "type T = ''"}, + {title: "LiteralTypeNode#6", input: "type T = ``"}, + {title: "LiteralTypeNode#7", input: `type T = 0`}, + {title: "LiteralTypeNode#8", input: `type T = 0n`}, + {title: "LiteralTypeNode#9", input: `type T = -0`}, + {title: "LiteralTypeNode#10", input: `type T = -0n`}, + {title: "TemplateTypeNode#1", input: "type T = `a${b}c`"}, + {title: "TemplateTypeNode#2", input: "type T = `a${b}c${d}e`"}, + {title: "ImportTypeNode#1", input: `type T = import(a)`}, + {title: "ImportTypeNode#2", input: `type T = import(a).b`}, + {title: "ImportTypeNode#3", input: `type T = import(a).b`}, + {title: "ImportTypeNode#4", input: `type T = typeof import(a)`}, + {title: "ImportTypeNode#5", input: `type T = typeof import(a).b`}, + {title: "ImportTypeNode#6", input: `type T = import(a, { with: { } })`}, + {title: "ImportTypeNode#6", input: `type T = import(a, { with: { b: "c" } })`}, + {title: "ImportTypeNode#7", input: `type T = import(a, { with: { "b": "c" } })`}, + {title: "PropertySignature#1", input: "interface I {a}"}, + {title: "PropertySignature#2", input: "interface I {readonly a}"}, + {title: "PropertySignature#3", input: "interface I {\"a\"}"}, + {title: "PropertySignature#4", input: "interface I {'a'}"}, + {title: "PropertySignature#5", input: "interface I {0}"}, + {title: "PropertySignature#6", input: "interface I {0n}"}, + {title: "PropertySignature#7", input: "interface I {[a]}"}, + {title: "PropertySignature#8", input: "interface I {a?}"}, + {title: "PropertySignature#9", input: "interface I {a: b}"}, + {title: "MethodSignature#1", input: "interface I {a()}"}, + {title: "MethodSignature#2", input: "interface I {\"a\"()}"}, + {title: "MethodSignature#3", input: "interface I {'a'()}"}, + {title: "MethodSignature#4", input: "interface I {0()}"}, + {title: "MethodSignature#5", input: "interface I {0n()}"}, + {title: "MethodSignature#6", input: "interface I {[a]()}"}, + {title: "MethodSignature#7", input: "interface I {a?()}"}, + {title: "MethodSignature#8", input: "interface I {a()}"}, + {title: "MethodSignature#9", input: "interface I {a(): b}"}, + {title: "MethodSignature#10", input: "interface I {a(b): c}"}, + {title: "CallSignature#1", input: "interface I {()}"}, + {title: "CallSignature#2", input: "interface I {():a}"}, + {title: "CallSignature#3", input: "interface I {(p)}"}, + {title: "CallSignature#4", input: "interface I {()}"}, + {title: "ConstructSignature#1", input: "interface I {new ()}"}, + {title: "ConstructSignature#2", input: "interface I {new ():a}"}, + {title: "ConstructSignature#3", input: "interface I {new (p)}"}, + {title: "ConstructSignature#4", input: "interface I {new ()}"}, + {title: "IndexSignatureDeclaration#1", input: "interface I {[a]}"}, + {title: "IndexSignatureDeclaration#2", input: "interface I {[a: b]}"}, + {title: "IndexSignatureDeclaration#3", input: "interface I {[a: b]: c}"}, + {title: "PropertyDeclaration#1", input: "class C {a}"}, + {title: "PropertyDeclaration#2", input: "class C {readonly a}"}, + {title: "PropertyDeclaration#3", input: "class C {static a}"}, + {title: "PropertyDeclaration#4", input: "class C {accessor a}"}, + {title: "PropertyDeclaration#5", input: "class C {\"a\"}"}, + {title: "PropertyDeclaration#6", input: "class C {'a'}"}, + {title: "PropertyDeclaration#7", input: "class C {0}"}, + {title: "PropertyDeclaration#8", input: "class C {0n}"}, + {title: "PropertyDeclaration#9", input: "class C {[a]}"}, + {title: "PropertyDeclaration#10", input: "class C {#a}"}, + {title: "PropertyDeclaration#11", input: "class C {a?}"}, + {title: "PropertyDeclaration#12", input: "class C {a!}"}, + {title: "PropertyDeclaration#13", input: "class C {a: b}"}, + {title: "PropertyDeclaration#14", input: "class C {a = b}"}, + {title: "PropertyDeclaration#15", input: "class C {@a b}"}, + {title: "MethodDeclaration#1", input: "class C {a()}"}, + {title: "MethodDeclaration#2", input: "class C {\"a\"()}"}, + {title: "MethodDeclaration#3", input: "class C {'a'()}"}, + {title: "MethodDeclaration#4", input: "class C {0()}"}, + {title: "MethodDeclaration#5", input: "class C {0n()}"}, + {title: "MethodDeclaration#6", input: "class C {[a]()}"}, + {title: "MethodDeclaration#7", input: "class C {#a()}"}, + {title: "MethodDeclaration#8", input: "class C {a?()}"}, + {title: "MethodDeclaration#9", input: "class C {a()}"}, + {title: "MethodDeclaration#10", input: "class C {a(): b}"}, + {title: "MethodDeclaration#11", input: "class C {a(b): c}"}, + {title: "MethodDeclaration#12", input: "class C {a() {} }"}, + {title: "MethodDeclaration#13", input: "class C {@a b() {} }"}, + {title: "MethodDeclaration#14", input: "class C {static a() {} }"}, + {title: "MethodDeclaration#15", input: "class C {async a() {} }"}, + {title: "GetAccessorDeclaration#1", input: "class C {get a()}"}, + {title: "GetAccessorDeclaration#2", input: "class C {get \"a\"()}"}, + {title: "GetAccessorDeclaration#3", input: "class C {get 'a'()}"}, + {title: "GetAccessorDeclaration#4", input: "class C {get 0()}"}, + {title: "GetAccessorDeclaration#5", input: "class C {get 0n()}"}, + {title: "GetAccessorDeclaration#6", input: "class C {get [a]()}"}, + {title: "GetAccessorDeclaration#7", input: "class C {get #a()}"}, + {title: "GetAccessorDeclaration#8", input: "class C {get a(): b}"}, + {title: "GetAccessorDeclaration#9", input: "class C {get a(b): c}"}, + {title: "GetAccessorDeclaration#10", input: "class C {get a() {} }"}, + {title: "GetAccessorDeclaration#11", input: "class C {@a get b() {} }"}, + {title: "GetAccessorDeclaration#12", input: "class C {static get a() {} }"}, + {title: "SetAccessorDeclaration#1", input: "class C {set a()}"}, + {title: "SetAccessorDeclaration#2", input: "class C {set \"a\"()}"}, + {title: "SetAccessorDeclaration#3", input: "class C {set 'a'()}"}, + {title: "SetAccessorDeclaration#4", input: "class C {set 0()}"}, + {title: "SetAccessorDeclaration#5", input: "class C {set 0n()}"}, + {title: "SetAccessorDeclaration#6", input: "class C {set [a]()}"}, + {title: "SetAccessorDeclaration#7", input: "class C {set #a()}"}, + {title: "SetAccessorDeclaration#8", input: "class C {set a(): b}"}, + {title: "SetAccessorDeclaration#9", input: "class C {set a(b): c}"}, + {title: "SetAccessorDeclaration#10", input: "class C {set a() {} }"}, + {title: "SetAccessorDeclaration#11", input: "class C {@a set b() {} }"}, + {title: "SetAccessorDeclaration#12", input: "class C {static set a() {} }"}, + {title: "ConstructorDeclaration#1", input: "class C {constructor()}"}, + {title: "ConstructorDeclaration#2", input: "class C {constructor(): b}"}, + {title: "ConstructorDeclaration#3", input: "class C {constructor(b): c}"}, + {title: "ConstructorDeclaration#4", input: "class C {constructor() {} }"}, + {title: "ConstructorDeclaration#5", input: "class C {@a constructor() {} }"}, + {title: "ConstructorDeclaration#6", input: "class C {private constructor() {} }"}, + {title: "ClassStaticBlockDeclaration", input: "class C {static { }}"}, + {title: "SemicolonClassElement#1", input: "class C {;}"}, + {title: "ParameterDeclaration#1", input: "function f(a)"}, + {title: "ParameterDeclaration#2", input: "function f(a: b)"}, + {title: "ParameterDeclaration#3", input: "function f(a = b)"}, + {title: "ParameterDeclaration#4", input: "function f(a?)"}, + {title: "ParameterDeclaration#5", input: "function f(...a)"}, + {title: "ParameterDeclaration#6", input: "function f(this)"}, + {title: "ParameterDeclaration#7", input: "function f(a,)"}, + {title: "ObjectBindingPattern#1", input: "function f({})"}, + {title: "ObjectBindingPattern#2", input: "function f({a})"}, + {title: "ObjectBindingPattern#3", input: "function f({a = b})"}, + {title: "ObjectBindingPattern#4", input: "function f({a: b})"}, + {title: "ObjectBindingPattern#5", input: "function f({a: b = c})"}, + {title: "ObjectBindingPattern#6", input: "function f({\"a\": b})"}, + {title: "ObjectBindingPattern#7", input: "function f({'a': b})"}, + {title: "ObjectBindingPattern#8", input: "function f({0: b})"}, + {title: "ObjectBindingPattern#9", input: "function f({[a]: b})"}, + {title: "ObjectBindingPattern#10", input: "function f({...a})"}, + {title: "ObjectBindingPattern#11", input: "function f({a: {}})"}, + {title: "ObjectBindingPattern#12", input: "function f({a: []})"}, + {title: "ArrayBindingPattern#1", input: "function f([])"}, + {title: "ArrayBindingPattern#2", input: "function f([,])"}, + {title: "ArrayBindingPattern#3", input: "function f([a])"}, + {title: "ArrayBindingPattern#4", input: "function f([a, b])"}, + {title: "ArrayBindingPattern#5", input: "function f([a, , b])"}, + {title: "ArrayBindingPattern#6", input: "function f([a = b])"}, + {title: "ArrayBindingPattern#7", input: "function f([...a])"}, + {title: "ArrayBindingPattern#8", input: "function f([{}])"}, + {title: "ArrayBindingPattern#9", input: "function f([[]])"}, + {title: "TypeParameterDeclaration#1", input: "function f();"}, + {title: "TypeParameterDeclaration#2", input: "function f();"}, + {title: "TypeParameterDeclaration#3", input: "function f();"}, + {title: "TypeParameterDeclaration#4", input: "function f();"}, + {title: "TypeParameterDeclaration#5", input: "function f();"}, + {title: "TypeParameterDeclaration#6", input: "function f();"}, + {title: "TypeParameterDeclaration#7", input: "function f();"}, + {title: "JsxElement1", input: ""}, + {title: "JsxElement2", input: ""}, + {title: "JsxElement3", input: ""}, + {title: "JsxElement4", input: ""}, + {title: "JsxElement5", input: ">"}, + {title: "JsxElement6", input: ""}, + {title: "JsxElement7", input: "b"}, + {title: "JsxElement8", input: "{b}"}, + {title: "JsxElement9", input: ""}, + {title: "JsxElement10", input: ""}, + {title: "JsxElement11", input: "<>"}, + {title: "JsxSelfClosingElement1", input: ""}, + {title: "JsxSelfClosingElement2", input: ""}, + {title: "JsxSelfClosingElement3", input: ""}, + {title: "JsxSelfClosingElement4", input: ""}, + {title: "JsxSelfClosingElement5", input: " />"}, + {title: "JsxSelfClosingElement6", input: ""}, + {title: "JsxFragment1", input: "<>"}, + {title: "JsxFragment2", input: "<>b"}, + {title: "JsxFragment3", input: "<>{b}"}, + {title: "JsxFragment4", input: "<>"}, + {title: "JsxFragment5", input: "<>"}, + {title: "JsxFragment6", input: "<><>"}, + {title: "JsxAttribute1", input: ""}, + {title: "JsxAttribute2", input: ""}, + {title: "JsxAttribute3", input: ""}, + {title: "JsxAttribute4", input: ""}, + {title: "JsxAttribute5", input: ""}, + {title: "JsxAttribute6", input: "/>"}, + {title: "JsxAttribute7", input: "/>"}, + {title: "JsxAttribute8", input: "/>"}, + {title: "JsxSpreadAttribute", input: ""}, + } + for _, rec := range data { + t.Run("Clone "+rec.title, func(t *testing.T) { + t.Parallel() + + factory := &ast.NodeFactory{} + file := parsetestutil.ParseTypeScript(rec.input, false).AsNode() + clone := factory.DeepCloneNode(file.AsNode()).AsNode() + + work := []NodeComparisonWorkItem{{file, clone}} + + for len(work) > 0 { + nextWork := []NodeComparisonWorkItem{} + for _, item := range work { + assert.Assert(t, item.original != item.copy) + originalChildren := getChildren(item.original) + copyChildren := getChildren(item.copy) + assert.Equal(t, len(originalChildren), len(copyChildren)) + for i, child := range originalChildren { + nextWork = append(nextWork, NodeComparisonWorkItem{child, copyChildren[i]}) + } + } + work = nextWork + } + }) + } +} diff --git a/kitcom/internal/tsgo/ast/diagnostic.go b/kitcom/internal/tsgo/ast/diagnostic.go new file mode 100644 index 0000000..de3009b --- /dev/null +++ b/kitcom/internal/tsgo/ast/diagnostic.go @@ -0,0 +1,272 @@ +package ast + +import ( + "maps" + "slices" + "strings" + + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/core" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/diagnostics" +) + +// Diagnostic + +type Diagnostic struct { + file *SourceFile + loc core.TextRange + code int32 + category diagnostics.Category + message string + messageChain []*Diagnostic + relatedInformation []*Diagnostic + reportsUnnecessary bool + reportsDeprecated bool + skippedOnNoEmit bool +} + +func (d *Diagnostic) File() *SourceFile { return d.file } +func (d *Diagnostic) Pos() int { return d.loc.Pos() } +func (d *Diagnostic) End() int { return d.loc.End() } +func (d *Diagnostic) Len() int { return d.loc.Len() } +func (d *Diagnostic) Loc() core.TextRange { return d.loc } +func (d *Diagnostic) Code() int32 { return d.code } +func (d *Diagnostic) Category() diagnostics.Category { return d.category } +func (d *Diagnostic) Message() string { return d.message } +func (d *Diagnostic) MessageChain() []*Diagnostic { return d.messageChain } +func (d *Diagnostic) RelatedInformation() []*Diagnostic { return d.relatedInformation } +func (d *Diagnostic) ReportsUnnecessary() bool { return d.reportsUnnecessary } +func (d *Diagnostic) ReportsDeprecated() bool { return d.reportsDeprecated } +func (d *Diagnostic) SkippedOnNoEmit() bool { return d.skippedOnNoEmit } + +func (d *Diagnostic) SetFile(file *SourceFile) { d.file = file } +func (d *Diagnostic) SetLocation(loc core.TextRange) { d.loc = loc } +func (d *Diagnostic) SetCategory(category diagnostics.Category) { d.category = category } +func (d *Diagnostic) SetSkippedOnNoEmit() { d.skippedOnNoEmit = true } + +func (d *Diagnostic) SetMessageChain(messageChain []*Diagnostic) *Diagnostic { + d.messageChain = messageChain + return d +} + +func (d *Diagnostic) AddMessageChain(messageChain *Diagnostic) *Diagnostic { + if messageChain != nil { + d.messageChain = append(d.messageChain, messageChain) + } + return d +} + +func (d *Diagnostic) SetRelatedInfo(relatedInformation []*Diagnostic) *Diagnostic { + d.relatedInformation = relatedInformation + return d +} + +func (d *Diagnostic) AddRelatedInfo(relatedInformation *Diagnostic) *Diagnostic { + if relatedInformation != nil { + d.relatedInformation = append(d.relatedInformation, relatedInformation) + } + return d +} + +func (d *Diagnostic) Clone() *Diagnostic { + result := *d + return &result +} + +func NewDiagnosticWith( + file *SourceFile, + loc core.TextRange, + code int32, + category diagnostics.Category, + message string, + messageChain []*Diagnostic, + relatedInformation []*Diagnostic, + reportsUnnecessary bool, + reportsDeprecated bool, + skippedOnNoEmit bool, +) *Diagnostic { + return &Diagnostic{ + file: file, + loc: loc, + code: code, + category: category, + message: message, + messageChain: messageChain, + relatedInformation: relatedInformation, + reportsUnnecessary: reportsUnnecessary, + reportsDeprecated: reportsDeprecated, + skippedOnNoEmit: skippedOnNoEmit, + } +} + +func NewDiagnostic(file *SourceFile, loc core.TextRange, message *diagnostics.Message, args ...any) *Diagnostic { + return &Diagnostic{ + file: file, + loc: loc, + code: message.Code(), + category: message.Category(), + message: message.Format(args...), + reportsUnnecessary: message.ReportsUnnecessary(), + reportsDeprecated: message.ReportsDeprecated(), + } +} + +func NewDiagnosticChain(chain *Diagnostic, message *diagnostics.Message, args ...any) *Diagnostic { + if chain != nil { + return NewDiagnostic(chain.file, chain.loc, message, args...).AddMessageChain(chain).SetRelatedInfo(chain.relatedInformation) + } + return NewDiagnostic(nil, core.TextRange{}, message, args...) +} + +func NewCompilerDiagnostic(message *diagnostics.Message, args ...any) *Diagnostic { + return NewDiagnostic(nil, core.UndefinedTextRange(), message, args...) +} + +type DiagnosticsCollection struct { + fileDiagnostics map[string][]*Diagnostic + nonFileDiagnostics []*Diagnostic +} + +func (c *DiagnosticsCollection) Add(diagnostic *Diagnostic) { + if diagnostic.File() != nil { + fileName := diagnostic.File().FileName() + if c.fileDiagnostics == nil { + c.fileDiagnostics = make(map[string][]*Diagnostic) + } + c.fileDiagnostics[fileName] = core.InsertSorted(c.fileDiagnostics[fileName], diagnostic, CompareDiagnostics) + } else { + c.nonFileDiagnostics = core.InsertSorted(c.nonFileDiagnostics, diagnostic, CompareDiagnostics) + } +} + +func (c *DiagnosticsCollection) Lookup(diagnostic *Diagnostic) *Diagnostic { + var diagnostics []*Diagnostic + if diagnostic.File() != nil { + diagnostics = c.fileDiagnostics[diagnostic.File().FileName()] + } else { + diagnostics = c.nonFileDiagnostics + } + if i, ok := slices.BinarySearchFunc(diagnostics, diagnostic, CompareDiagnostics); ok { + return diagnostics[i] + } + return nil +} + +func (c *DiagnosticsCollection) GetGlobalDiagnostics() []*Diagnostic { + return c.nonFileDiagnostics +} + +func (c *DiagnosticsCollection) GetDiagnosticsForFile(fileName string) []*Diagnostic { + return c.fileDiagnostics[fileName] +} + +func (c *DiagnosticsCollection) GetDiagnostics() []*Diagnostic { + fileNames := slices.Collect(maps.Keys(c.fileDiagnostics)) + slices.Sort(fileNames) + diagnostics := slices.Clip(c.nonFileDiagnostics) + for _, fileName := range fileNames { + diagnostics = append(diagnostics, c.fileDiagnostics[fileName]...) + } + return diagnostics +} + +func getDiagnosticPath(d *Diagnostic) string { + if d.File() != nil { + return d.File().FileName() + } + return "" +} + +func EqualDiagnostics(d1, d2 *Diagnostic) bool { + return EqualDiagnosticsNoRelatedInfo(d1, d2) && + slices.EqualFunc(d1.RelatedInformation(), d2.RelatedInformation(), EqualDiagnostics) +} + +func EqualDiagnosticsNoRelatedInfo(d1, d2 *Diagnostic) bool { + return getDiagnosticPath(d1) == getDiagnosticPath(d2) && + d1.Loc() == d2.Loc() && + d1.Code() == d2.Code() && + d1.Message() == d2.Message() && + slices.EqualFunc(d1.MessageChain(), d2.MessageChain(), equalMessageChain) +} + +func equalMessageChain(c1, c2 *Diagnostic) bool { + return c1.Code() == c2.Code() && + c1.Message() == c2.Message() && + slices.EqualFunc(c1.MessageChain(), c2.MessageChain(), equalMessageChain) +} + +func compareMessageChainSize(c1, c2 []*Diagnostic) int { + c := len(c2) - len(c1) + if c != 0 { + return c + } + for i := range c1 { + c = compareMessageChainSize(c1[i].MessageChain(), c2[i].MessageChain()) + if c != 0 { + return c + } + } + return 0 +} + +func compareMessageChainContent(c1, c2 []*Diagnostic) int { + for i := range c1 { + c := strings.Compare(c1[i].Message(), c2[i].Message()) + if c != 0 { + return c + } + if c1[i].MessageChain() != nil { + c = compareMessageChainContent(c1[i].MessageChain(), c2[i].MessageChain()) + if c != 0 { + return c + } + } + } + return 0 +} + +func compareRelatedInfo(r1, r2 []*Diagnostic) int { + c := len(r2) - len(r1) + if c != 0 { + return c + } + for i := range r1 { + c = CompareDiagnostics(r1[i], r2[i]) + if c != 0 { + return c + } + } + return 0 +} + +func CompareDiagnostics(d1, d2 *Diagnostic) int { + c := strings.Compare(getDiagnosticPath(d1), getDiagnosticPath(d2)) + if c != 0 { + return c + } + c = d1.Loc().Pos() - d2.Loc().Pos() + if c != 0 { + return c + } + c = d1.Loc().End() - d2.Loc().End() + if c != 0 { + return c + } + c = int(d1.Code()) - int(d2.Code()) + if c != 0 { + return c + } + c = strings.Compare(d1.Message(), d2.Message()) + if c != 0 { + return c + } + c = compareMessageChainSize(d1.MessageChain(), d2.MessageChain()) + if c != 0 { + return c + } + c = compareMessageChainContent(d1.MessageChain(), d2.MessageChain()) + if c != 0 { + return c + } + return compareRelatedInfo(d1.RelatedInformation(), d2.RelatedInformation()) +} diff --git a/kitcom/internal/tsgo/ast/flow.go b/kitcom/internal/tsgo/ast/flow.go new file mode 100644 index 0000000..274a92f --- /dev/null +++ b/kitcom/internal/tsgo/ast/flow.go @@ -0,0 +1,75 @@ +package ast + +// FlowFlags + +type FlowFlags uint32 + +const ( + FlowFlagsUnreachable FlowFlags = 1 << 0 // Unreachable code + FlowFlagsStart FlowFlags = 1 << 1 // Start of flow graph + FlowFlagsBranchLabel FlowFlags = 1 << 2 // Non-looping junction + FlowFlagsLoopLabel FlowFlags = 1 << 3 // Looping junction + FlowFlagsAssignment FlowFlags = 1 << 4 // Assignment + FlowFlagsTrueCondition FlowFlags = 1 << 5 // Condition known to be true + FlowFlagsFalseCondition FlowFlags = 1 << 6 // Condition known to be false + FlowFlagsSwitchClause FlowFlags = 1 << 7 // Switch statement clause + FlowFlagsArrayMutation FlowFlags = 1 << 8 // Potential array mutation + FlowFlagsCall FlowFlags = 1 << 9 // Potential assertion call + FlowFlagsReduceLabel FlowFlags = 1 << 10 // Temporarily reduce antecedents of label + FlowFlagsReferenced FlowFlags = 1 << 11 // Referenced as antecedent once + FlowFlagsShared FlowFlags = 1 << 12 // Referenced as antecedent more than once + FlowFlagsLabel = FlowFlagsBranchLabel | FlowFlagsLoopLabel + FlowFlagsCondition = FlowFlagsTrueCondition | FlowFlagsFalseCondition +) + +// FlowNode + +type FlowNode struct { + Flags FlowFlags + Node *Node // Associated AST node + Antecedent *FlowNode // Antecedent for all but FlowLabel + Antecedents *FlowList // Linked list of antecedents for FlowLabel +} + +type FlowList struct { + Flow *FlowNode + Next *FlowList +} + +type FlowLabel = FlowNode + +// FlowSwitchClauseData (synthetic AST node for FlowFlagsSwitchClause) + +type FlowSwitchClauseData struct { + NodeBase + SwitchStatement *Node + ClauseStart int32 // Start index of case/default clause range + ClauseEnd int32 // End index of case/default clause range +} + +func NewFlowSwitchClauseData(switchStatement *Node, clauseStart int, clauseEnd int) *Node { + node := &FlowSwitchClauseData{} + node.SwitchStatement = switchStatement + node.ClauseStart = int32(clauseStart) + node.ClauseEnd = int32(clauseEnd) + return newNode(KindUnknown, node, NodeFactoryHooks{}) +} + +func (node *FlowSwitchClauseData) IsEmpty() bool { + return node.ClauseStart == node.ClauseEnd +} + +// FlowReduceLabelData (synthetic AST node for FlowFlagsReduceLabel) + +type FlowReduceLabelData struct { + NodeBase + Target *FlowLabel // Target label + Antecedents *FlowList // Temporary antecedent list +} + +func NewFlowReduceLabelData(target *FlowLabel, antecedents *FlowList) *Node { + node := &FlowReduceLabelData{} + node.Target = target + node.Antecedents = antecedents + return newNode(KindUnknown, node, NodeFactoryHooks{}) +} diff --git a/kitcom/internal/tsgo/ast/ids.go b/kitcom/internal/tsgo/ast/ids.go new file mode 100644 index 0000000..63e415d --- /dev/null +++ b/kitcom/internal/tsgo/ast/ids.go @@ -0,0 +1,6 @@ +package ast + +type ( + NodeId uint64 + SymbolId uint64 +) diff --git a/kitcom/internal/tsgo/ast/kind.go b/kitcom/internal/tsgo/ast/kind.go new file mode 100644 index 0000000..57cdaf6 --- /dev/null +++ b/kitcom/internal/tsgo/ast/kind.go @@ -0,0 +1,430 @@ +package ast + +//go:generate go tool golang.org/x/tools/cmd/stringer -type=Kind -output=kind_stringer_generated.go +//go:generate go tool mvdan.cc/gofumpt -w kind_stringer_generated.go + +type Kind int16 + +const ( + KindUnknown Kind = iota + KindEndOfFile + KindSingleLineCommentTrivia + KindMultiLineCommentTrivia + KindNewLineTrivia + KindWhitespaceTrivia + KindConflictMarkerTrivia + KindNonTextFileMarkerTrivia + KindNumericLiteral + KindBigIntLiteral + KindStringLiteral + KindJsxText + KindJsxTextAllWhiteSpaces + KindRegularExpressionLiteral + KindNoSubstitutionTemplateLiteral + // Pseudo-literals + KindTemplateHead + KindTemplateMiddle + KindTemplateTail + // Punctuation + KindOpenBraceToken + KindCloseBraceToken + KindOpenParenToken + KindCloseParenToken + KindOpenBracketToken + KindCloseBracketToken + KindDotToken + KindDotDotDotToken + KindSemicolonToken + KindCommaToken + KindQuestionDotToken + KindLessThanToken + KindLessThanSlashToken + KindGreaterThanToken + KindLessThanEqualsToken + KindGreaterThanEqualsToken + KindEqualsEqualsToken + KindExclamationEqualsToken + KindEqualsEqualsEqualsToken + KindExclamationEqualsEqualsToken + KindEqualsGreaterThanToken + KindPlusToken + KindMinusToken + KindAsteriskToken + KindAsteriskAsteriskToken + KindSlashToken + KindPercentToken + KindPlusPlusToken + KindMinusMinusToken + KindLessThanLessThanToken + KindGreaterThanGreaterThanToken + KindGreaterThanGreaterThanGreaterThanToken + KindAmpersandToken + KindBarToken + KindCaretToken + KindExclamationToken + KindTildeToken + KindAmpersandAmpersandToken + KindBarBarToken + KindQuestionToken + KindColonToken + KindAtToken + KindQuestionQuestionToken + /** Only the JSDoc scanner produces BacktickToken. The normal scanner produces NoSubstitutionTemplateLiteral and related kinds. */ + KindBacktickToken + /** Only the JSDoc scanner produces HashToken. The normal scanner produces PrivateIdentifier. */ + KindHashToken + // Assignments + KindEqualsToken + KindPlusEqualsToken + KindMinusEqualsToken + KindAsteriskEqualsToken + KindAsteriskAsteriskEqualsToken + KindSlashEqualsToken + KindPercentEqualsToken + KindLessThanLessThanEqualsToken + KindGreaterThanGreaterThanEqualsToken + KindGreaterThanGreaterThanGreaterThanEqualsToken + KindAmpersandEqualsToken + KindBarEqualsToken + KindBarBarEqualsToken + KindAmpersandAmpersandEqualsToken + KindQuestionQuestionEqualsToken + KindCaretEqualsToken + // Identifiers and PrivateIdentifier + KindIdentifier + KindPrivateIdentifier + KindJSDocCommentTextToken + // Reserved words + KindBreakKeyword + KindCaseKeyword + KindCatchKeyword + KindClassKeyword + KindConstKeyword + KindContinueKeyword + KindDebuggerKeyword + KindDefaultKeyword + KindDeleteKeyword + KindDoKeyword + KindElseKeyword + KindEnumKeyword + KindExportKeyword + KindExtendsKeyword + KindFalseKeyword + KindFinallyKeyword + KindForKeyword + KindFunctionKeyword + KindIfKeyword + KindImportKeyword + KindInKeyword + KindInstanceOfKeyword + KindNewKeyword + KindNullKeyword + KindReturnKeyword + KindSuperKeyword + KindSwitchKeyword + KindThisKeyword + KindThrowKeyword + KindTrueKeyword + KindTryKeyword + KindTypeOfKeyword + KindVarKeyword + KindVoidKeyword + KindWhileKeyword + KindWithKeyword + // Strict mode reserved words + KindImplementsKeyword + KindInterfaceKeyword + KindLetKeyword + KindPackageKeyword + KindPrivateKeyword + KindProtectedKeyword + KindPublicKeyword + KindStaticKeyword + KindYieldKeyword + // Contextual keywords + KindAbstractKeyword + KindAccessorKeyword + KindAsKeyword + KindAssertsKeyword + KindAssertKeyword + KindAnyKeyword + KindAsyncKeyword + KindAwaitKeyword + KindBooleanKeyword + KindConstructorKeyword + KindDeclareKeyword + KindGetKeyword + KindImmediateKeyword + KindInferKeyword + KindIntrinsicKeyword + KindIsKeyword + KindKeyOfKeyword + KindModuleKeyword + KindNamespaceKeyword + KindNeverKeyword + KindOutKeyword + KindReadonlyKeyword + KindRequireKeyword + KindNumberKeyword + KindObjectKeyword + KindSatisfiesKeyword + KindSetKeyword + KindStringKeyword + KindSymbolKeyword + KindTypeKeyword + KindUndefinedKeyword + KindUniqueKeyword + KindUnknownKeyword + KindUsingKeyword + KindFromKeyword + KindGlobalKeyword + KindBigIntKeyword + KindOverrideKeyword + KindOfKeyword + KindDeferKeyword // LastKeyword and LastToken and LastContextualKeyword + // Parse tree nodes + // Names + KindQualifiedName + KindComputedPropertyName + // Signature elements + KindTypeParameter + KindParameter + KindDecorator + // TypeMember + KindPropertySignature + KindPropertyDeclaration + KindMethodSignature + KindMethodDeclaration + KindClassStaticBlockDeclaration + KindConstructor + KindGetAccessor + KindSetAccessor + KindCallSignature + KindConstructSignature + KindIndexSignature + // Type + KindTypePredicate + KindTypeReference + KindFunctionType + KindConstructorType + KindTypeQuery + KindTypeLiteral + KindArrayType + KindTupleType + KindOptionalType + KindRestType + KindUnionType + KindIntersectionType + KindConditionalType + KindInferType + KindParenthesizedType + KindThisType + KindTypeOperator + KindIndexedAccessType + KindMappedType + KindLiteralType + KindNamedTupleMember + KindTemplateLiteralType + KindTemplateLiteralTypeSpan + KindImportType + // Binding patterns + KindObjectBindingPattern + KindArrayBindingPattern + KindBindingElement + // Expression + KindArrayLiteralExpression + KindObjectLiteralExpression + KindPropertyAccessExpression + KindElementAccessExpression + KindCallExpression + KindNewExpression + KindTaggedTemplateExpression + KindTypeAssertionExpression + KindParenthesizedExpression + KindFunctionExpression + KindArrowFunction + KindDeleteExpression + KindTypeOfExpression + KindVoidExpression + KindAwaitExpression + KindPrefixUnaryExpression + KindPostfixUnaryExpression + KindBinaryExpression + KindConditionalExpression + KindTemplateExpression + KindYieldExpression + KindSpreadElement + KindClassExpression + KindOmittedExpression + KindExpressionWithTypeArguments + KindAsExpression + KindNonNullExpression + KindMetaProperty + KindSyntheticExpression + KindSatisfiesExpression + // Misc + KindTemplateSpan + KindSemicolonClassElement + // Element + KindBlock + KindEmptyStatement + KindVariableStatement + KindExpressionStatement + KindIfStatement + KindDoStatement + KindWhileStatement + KindForStatement + KindForInStatement + KindForOfStatement + KindContinueStatement + KindBreakStatement + KindReturnStatement + KindWithStatement + KindSwitchStatement + KindLabeledStatement + KindThrowStatement + KindTryStatement + KindDebuggerStatement + KindVariableDeclaration + KindVariableDeclarationList + KindFunctionDeclaration + KindClassDeclaration + KindInterfaceDeclaration + KindTypeAliasDeclaration + KindEnumDeclaration + KindModuleDeclaration + KindModuleBlock + KindCaseBlock + KindNamespaceExportDeclaration + KindImportEqualsDeclaration + KindImportDeclaration + KindImportClause + KindNamespaceImport + KindNamedImports + KindImportSpecifier + KindExportAssignment + KindExportDeclaration + KindNamedExports + KindNamespaceExport + KindExportSpecifier + KindMissingDeclaration + // Module references + KindExternalModuleReference + // JSX + KindJsxElement + KindJsxSelfClosingElement + KindJsxOpeningElement + KindJsxClosingElement + KindJsxFragment + KindJsxOpeningFragment + KindJsxClosingFragment + KindJsxAttribute + KindJsxAttributes + KindJsxSpreadAttribute + KindJsxExpression + KindJsxNamespacedName + // Clauses + KindCaseClause + KindDefaultClause + KindHeritageClause + KindCatchClause + // Import attributes + KindImportAttributes + KindImportAttribute + // Property assignments + KindPropertyAssignment + KindShorthandPropertyAssignment + KindSpreadAssignment + // Enum + KindEnumMember + // Top-level nodes + KindSourceFile + KindBundle + // JSDoc nodes + KindJSDocTypeExpression + KindJSDocNameReference + KindJSDocMemberName // C#p + KindJSDocAllType // The * type + KindJSDocNullableType + KindJSDocNonNullableType + KindJSDocOptionalType + KindJSDocVariadicType + KindJSDoc + KindJSDocText + KindJSDocTypeLiteral + KindJSDocSignature + KindJSDocLink + KindJSDocLinkCode + KindJSDocLinkPlain + KindJSDocTag + KindJSDocAugmentsTag + KindJSDocImplementsTag + KindJSDocDeprecatedTag + KindJSDocPublicTag + KindJSDocPrivateTag + KindJSDocProtectedTag + KindJSDocReadonlyTag + KindJSDocOverrideTag + KindJSDocCallbackTag + KindJSDocOverloadTag + KindJSDocParameterTag + KindJSDocReturnTag + KindJSDocThisTag + KindJSDocTypeTag + KindJSDocTemplateTag + KindJSDocTypedefTag + KindJSDocSeeTag + KindJSDocPropertyTag + KindJSDocSatisfiesTag + KindJSDocImportTag + // Synthesized list + KindSyntaxList + // Reparsed JS nodes + KindJSTypeAliasDeclaration + KindJSExportAssignment + KindCommonJSExport + KindJSImportDeclaration + // Transformation nodes + KindNotEmittedStatement + KindPartiallyEmittedExpression + KindCommaListExpression + KindSyntheticReferenceExpression + KindNotEmittedTypeElement + // Enum value count + KindCount + // Markers + KindFirstAssignment = KindEqualsToken + KindLastAssignment = KindCaretEqualsToken + KindFirstCompoundAssignment = KindPlusEqualsToken + KindLastCompoundAssignment = KindCaretEqualsToken + KindFirstReservedWord = KindBreakKeyword + KindLastReservedWord = KindWithKeyword + KindFirstKeyword = KindBreakKeyword + KindLastKeyword = KindDeferKeyword + KindFirstFutureReservedWord = KindImplementsKeyword + KindLastFutureReservedWord = KindYieldKeyword + KindFirstTypeNode = KindTypePredicate + KindLastTypeNode = KindImportType + KindFirstPunctuation = KindOpenBraceToken + KindLastPunctuation = KindCaretEqualsToken + KindFirstToken = KindUnknown + KindLastToken = KindLastKeyword + KindFirstLiteralToken = KindNumericLiteral + KindLastLiteralToken = KindNoSubstitutionTemplateLiteral + KindFirstTemplateToken = KindNoSubstitutionTemplateLiteral + KindLastTemplateToken = KindTemplateTail + KindFirstBinaryOperator = KindLessThanToken + KindLastBinaryOperator = KindCaretEqualsToken + KindFirstStatement = KindVariableStatement + KindLastStatement = KindDebuggerStatement + KindFirstNode = KindQualifiedName + KindFirstJSDocNode = KindJSDocTypeExpression + KindLastJSDocNode = KindJSDocImportTag + KindFirstJSDocTagNode = KindJSDocTag + KindLastJSDocTagNode = KindJSDocImportTag + KindFirstContextualKeyword = KindAbstractKeyword + KindLastContextualKeyword = KindDeferKeyword + KindComment = KindSingleLineCommentTrivia | KindMultiLineCommentTrivia + KindFirstTriviaToken = KindSingleLineCommentTrivia + KindLastTriviaToken = KindConflictMarkerTrivia +) diff --git a/kitcom/internal/tsgo/ast/kind_stringer_generated.go b/kitcom/internal/tsgo/ast/kind_stringer_generated.go new file mode 100644 index 0000000..ac4a204 --- /dev/null +++ b/kitcom/internal/tsgo/ast/kind_stringer_generated.go @@ -0,0 +1,378 @@ +// Code generated by "stringer -type=Kind -output=kind_stringer_generated.go"; DO NOT EDIT. + +package ast + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[KindUnknown-0] + _ = x[KindEndOfFile-1] + _ = x[KindSingleLineCommentTrivia-2] + _ = x[KindMultiLineCommentTrivia-3] + _ = x[KindNewLineTrivia-4] + _ = x[KindWhitespaceTrivia-5] + _ = x[KindConflictMarkerTrivia-6] + _ = x[KindNonTextFileMarkerTrivia-7] + _ = x[KindNumericLiteral-8] + _ = x[KindBigIntLiteral-9] + _ = x[KindStringLiteral-10] + _ = x[KindJsxText-11] + _ = x[KindJsxTextAllWhiteSpaces-12] + _ = x[KindRegularExpressionLiteral-13] + _ = x[KindNoSubstitutionTemplateLiteral-14] + _ = x[KindTemplateHead-15] + _ = x[KindTemplateMiddle-16] + _ = x[KindTemplateTail-17] + _ = x[KindOpenBraceToken-18] + _ = x[KindCloseBraceToken-19] + _ = x[KindOpenParenToken-20] + _ = x[KindCloseParenToken-21] + _ = x[KindOpenBracketToken-22] + _ = x[KindCloseBracketToken-23] + _ = x[KindDotToken-24] + _ = x[KindDotDotDotToken-25] + _ = x[KindSemicolonToken-26] + _ = x[KindCommaToken-27] + _ = x[KindQuestionDotToken-28] + _ = x[KindLessThanToken-29] + _ = x[KindLessThanSlashToken-30] + _ = x[KindGreaterThanToken-31] + _ = x[KindLessThanEqualsToken-32] + _ = x[KindGreaterThanEqualsToken-33] + _ = x[KindEqualsEqualsToken-34] + _ = x[KindExclamationEqualsToken-35] + _ = x[KindEqualsEqualsEqualsToken-36] + _ = x[KindExclamationEqualsEqualsToken-37] + _ = x[KindEqualsGreaterThanToken-38] + _ = x[KindPlusToken-39] + _ = x[KindMinusToken-40] + _ = x[KindAsteriskToken-41] + _ = x[KindAsteriskAsteriskToken-42] + _ = x[KindSlashToken-43] + _ = x[KindPercentToken-44] + _ = x[KindPlusPlusToken-45] + _ = x[KindMinusMinusToken-46] + _ = x[KindLessThanLessThanToken-47] + _ = x[KindGreaterThanGreaterThanToken-48] + _ = x[KindGreaterThanGreaterThanGreaterThanToken-49] + _ = x[KindAmpersandToken-50] + _ = x[KindBarToken-51] + _ = x[KindCaretToken-52] + _ = x[KindExclamationToken-53] + _ = x[KindTildeToken-54] + _ = x[KindAmpersandAmpersandToken-55] + _ = x[KindBarBarToken-56] + _ = x[KindQuestionToken-57] + _ = x[KindColonToken-58] + _ = x[KindAtToken-59] + _ = x[KindQuestionQuestionToken-60] + _ = x[KindBacktickToken-61] + _ = x[KindHashToken-62] + _ = x[KindEqualsToken-63] + _ = x[KindPlusEqualsToken-64] + _ = x[KindMinusEqualsToken-65] + _ = x[KindAsteriskEqualsToken-66] + _ = x[KindAsteriskAsteriskEqualsToken-67] + _ = x[KindSlashEqualsToken-68] + _ = x[KindPercentEqualsToken-69] + _ = x[KindLessThanLessThanEqualsToken-70] + _ = x[KindGreaterThanGreaterThanEqualsToken-71] + _ = x[KindGreaterThanGreaterThanGreaterThanEqualsToken-72] + _ = x[KindAmpersandEqualsToken-73] + _ = x[KindBarEqualsToken-74] + _ = x[KindBarBarEqualsToken-75] + _ = x[KindAmpersandAmpersandEqualsToken-76] + _ = x[KindQuestionQuestionEqualsToken-77] + _ = x[KindCaretEqualsToken-78] + _ = x[KindIdentifier-79] + _ = x[KindPrivateIdentifier-80] + _ = x[KindJSDocCommentTextToken-81] + _ = x[KindBreakKeyword-82] + _ = x[KindCaseKeyword-83] + _ = x[KindCatchKeyword-84] + _ = x[KindClassKeyword-85] + _ = x[KindConstKeyword-86] + _ = x[KindContinueKeyword-87] + _ = x[KindDebuggerKeyword-88] + _ = x[KindDefaultKeyword-89] + _ = x[KindDeleteKeyword-90] + _ = x[KindDoKeyword-91] + _ = x[KindElseKeyword-92] + _ = x[KindEnumKeyword-93] + _ = x[KindExportKeyword-94] + _ = x[KindExtendsKeyword-95] + _ = x[KindFalseKeyword-96] + _ = x[KindFinallyKeyword-97] + _ = x[KindForKeyword-98] + _ = x[KindFunctionKeyword-99] + _ = x[KindIfKeyword-100] + _ = x[KindImportKeyword-101] + _ = x[KindInKeyword-102] + _ = x[KindInstanceOfKeyword-103] + _ = x[KindNewKeyword-104] + _ = x[KindNullKeyword-105] + _ = x[KindReturnKeyword-106] + _ = x[KindSuperKeyword-107] + _ = x[KindSwitchKeyword-108] + _ = x[KindThisKeyword-109] + _ = x[KindThrowKeyword-110] + _ = x[KindTrueKeyword-111] + _ = x[KindTryKeyword-112] + _ = x[KindTypeOfKeyword-113] + _ = x[KindVarKeyword-114] + _ = x[KindVoidKeyword-115] + _ = x[KindWhileKeyword-116] + _ = x[KindWithKeyword-117] + _ = x[KindImplementsKeyword-118] + _ = x[KindInterfaceKeyword-119] + _ = x[KindLetKeyword-120] + _ = x[KindPackageKeyword-121] + _ = x[KindPrivateKeyword-122] + _ = x[KindProtectedKeyword-123] + _ = x[KindPublicKeyword-124] + _ = x[KindStaticKeyword-125] + _ = x[KindYieldKeyword-126] + _ = x[KindAbstractKeyword-127] + _ = x[KindAccessorKeyword-128] + _ = x[KindAsKeyword-129] + _ = x[KindAssertsKeyword-130] + _ = x[KindAssertKeyword-131] + _ = x[KindAnyKeyword-132] + _ = x[KindAsyncKeyword-133] + _ = x[KindAwaitKeyword-134] + _ = x[KindBooleanKeyword-135] + _ = x[KindConstructorKeyword-136] + _ = x[KindDeclareKeyword-137] + _ = x[KindGetKeyword-138] + _ = x[KindImmediateKeyword-139] + _ = x[KindInferKeyword-140] + _ = x[KindIntrinsicKeyword-141] + _ = x[KindIsKeyword-142] + _ = x[KindKeyOfKeyword-143] + _ = x[KindModuleKeyword-144] + _ = x[KindNamespaceKeyword-145] + _ = x[KindNeverKeyword-146] + _ = x[KindOutKeyword-147] + _ = x[KindReadonlyKeyword-148] + _ = x[KindRequireKeyword-149] + _ = x[KindNumberKeyword-150] + _ = x[KindObjectKeyword-151] + _ = x[KindSatisfiesKeyword-152] + _ = x[KindSetKeyword-153] + _ = x[KindStringKeyword-154] + _ = x[KindSymbolKeyword-155] + _ = x[KindTypeKeyword-156] + _ = x[KindUndefinedKeyword-157] + _ = x[KindUniqueKeyword-158] + _ = x[KindUnknownKeyword-159] + _ = x[KindUsingKeyword-160] + _ = x[KindFromKeyword-161] + _ = x[KindGlobalKeyword-162] + _ = x[KindBigIntKeyword-163] + _ = x[KindOverrideKeyword-164] + _ = x[KindOfKeyword-165] + _ = x[KindDeferKeyword-166] + _ = x[KindQualifiedName-167] + _ = x[KindComputedPropertyName-168] + _ = x[KindTypeParameter-169] + _ = x[KindParameter-170] + _ = x[KindDecorator-171] + _ = x[KindPropertySignature-172] + _ = x[KindPropertyDeclaration-173] + _ = x[KindMethodSignature-174] + _ = x[KindMethodDeclaration-175] + _ = x[KindClassStaticBlockDeclaration-176] + _ = x[KindConstructor-177] + _ = x[KindGetAccessor-178] + _ = x[KindSetAccessor-179] + _ = x[KindCallSignature-180] + _ = x[KindConstructSignature-181] + _ = x[KindIndexSignature-182] + _ = x[KindTypePredicate-183] + _ = x[KindTypeReference-184] + _ = x[KindFunctionType-185] + _ = x[KindConstructorType-186] + _ = x[KindTypeQuery-187] + _ = x[KindTypeLiteral-188] + _ = x[KindArrayType-189] + _ = x[KindTupleType-190] + _ = x[KindOptionalType-191] + _ = x[KindRestType-192] + _ = x[KindUnionType-193] + _ = x[KindIntersectionType-194] + _ = x[KindConditionalType-195] + _ = x[KindInferType-196] + _ = x[KindParenthesizedType-197] + _ = x[KindThisType-198] + _ = x[KindTypeOperator-199] + _ = x[KindIndexedAccessType-200] + _ = x[KindMappedType-201] + _ = x[KindLiteralType-202] + _ = x[KindNamedTupleMember-203] + _ = x[KindTemplateLiteralType-204] + _ = x[KindTemplateLiteralTypeSpan-205] + _ = x[KindImportType-206] + _ = x[KindObjectBindingPattern-207] + _ = x[KindArrayBindingPattern-208] + _ = x[KindBindingElement-209] + _ = x[KindArrayLiteralExpression-210] + _ = x[KindObjectLiteralExpression-211] + _ = x[KindPropertyAccessExpression-212] + _ = x[KindElementAccessExpression-213] + _ = x[KindCallExpression-214] + _ = x[KindNewExpression-215] + _ = x[KindTaggedTemplateExpression-216] + _ = x[KindTypeAssertionExpression-217] + _ = x[KindParenthesizedExpression-218] + _ = x[KindFunctionExpression-219] + _ = x[KindArrowFunction-220] + _ = x[KindDeleteExpression-221] + _ = x[KindTypeOfExpression-222] + _ = x[KindVoidExpression-223] + _ = x[KindAwaitExpression-224] + _ = x[KindPrefixUnaryExpression-225] + _ = x[KindPostfixUnaryExpression-226] + _ = x[KindBinaryExpression-227] + _ = x[KindConditionalExpression-228] + _ = x[KindTemplateExpression-229] + _ = x[KindYieldExpression-230] + _ = x[KindSpreadElement-231] + _ = x[KindClassExpression-232] + _ = x[KindOmittedExpression-233] + _ = x[KindExpressionWithTypeArguments-234] + _ = x[KindAsExpression-235] + _ = x[KindNonNullExpression-236] + _ = x[KindMetaProperty-237] + _ = x[KindSyntheticExpression-238] + _ = x[KindSatisfiesExpression-239] + _ = x[KindTemplateSpan-240] + _ = x[KindSemicolonClassElement-241] + _ = x[KindBlock-242] + _ = x[KindEmptyStatement-243] + _ = x[KindVariableStatement-244] + _ = x[KindExpressionStatement-245] + _ = x[KindIfStatement-246] + _ = x[KindDoStatement-247] + _ = x[KindWhileStatement-248] + _ = x[KindForStatement-249] + _ = x[KindForInStatement-250] + _ = x[KindForOfStatement-251] + _ = x[KindContinueStatement-252] + _ = x[KindBreakStatement-253] + _ = x[KindReturnStatement-254] + _ = x[KindWithStatement-255] + _ = x[KindSwitchStatement-256] + _ = x[KindLabeledStatement-257] + _ = x[KindThrowStatement-258] + _ = x[KindTryStatement-259] + _ = x[KindDebuggerStatement-260] + _ = x[KindVariableDeclaration-261] + _ = x[KindVariableDeclarationList-262] + _ = x[KindFunctionDeclaration-263] + _ = x[KindClassDeclaration-264] + _ = x[KindInterfaceDeclaration-265] + _ = x[KindTypeAliasDeclaration-266] + _ = x[KindEnumDeclaration-267] + _ = x[KindModuleDeclaration-268] + _ = x[KindModuleBlock-269] + _ = x[KindCaseBlock-270] + _ = x[KindNamespaceExportDeclaration-271] + _ = x[KindImportEqualsDeclaration-272] + _ = x[KindImportDeclaration-273] + _ = x[KindImportClause-274] + _ = x[KindNamespaceImport-275] + _ = x[KindNamedImports-276] + _ = x[KindImportSpecifier-277] + _ = x[KindExportAssignment-278] + _ = x[KindExportDeclaration-279] + _ = x[KindNamedExports-280] + _ = x[KindNamespaceExport-281] + _ = x[KindExportSpecifier-282] + _ = x[KindMissingDeclaration-283] + _ = x[KindExternalModuleReference-284] + _ = x[KindJsxElement-285] + _ = x[KindJsxSelfClosingElement-286] + _ = x[KindJsxOpeningElement-287] + _ = x[KindJsxClosingElement-288] + _ = x[KindJsxFragment-289] + _ = x[KindJsxOpeningFragment-290] + _ = x[KindJsxClosingFragment-291] + _ = x[KindJsxAttribute-292] + _ = x[KindJsxAttributes-293] + _ = x[KindJsxSpreadAttribute-294] + _ = x[KindJsxExpression-295] + _ = x[KindJsxNamespacedName-296] + _ = x[KindCaseClause-297] + _ = x[KindDefaultClause-298] + _ = x[KindHeritageClause-299] + _ = x[KindCatchClause-300] + _ = x[KindImportAttributes-301] + _ = x[KindImportAttribute-302] + _ = x[KindPropertyAssignment-303] + _ = x[KindShorthandPropertyAssignment-304] + _ = x[KindSpreadAssignment-305] + _ = x[KindEnumMember-306] + _ = x[KindSourceFile-307] + _ = x[KindBundle-308] + _ = x[KindJSDocTypeExpression-309] + _ = x[KindJSDocNameReference-310] + _ = x[KindJSDocMemberName-311] + _ = x[KindJSDocAllType-312] + _ = x[KindJSDocNullableType-313] + _ = x[KindJSDocNonNullableType-314] + _ = x[KindJSDocOptionalType-315] + _ = x[KindJSDocVariadicType-316] + _ = x[KindJSDoc-317] + _ = x[KindJSDocText-318] + _ = x[KindJSDocTypeLiteral-319] + _ = x[KindJSDocSignature-320] + _ = x[KindJSDocLink-321] + _ = x[KindJSDocLinkCode-322] + _ = x[KindJSDocLinkPlain-323] + _ = x[KindJSDocTag-324] + _ = x[KindJSDocAugmentsTag-325] + _ = x[KindJSDocImplementsTag-326] + _ = x[KindJSDocDeprecatedTag-327] + _ = x[KindJSDocPublicTag-328] + _ = x[KindJSDocPrivateTag-329] + _ = x[KindJSDocProtectedTag-330] + _ = x[KindJSDocReadonlyTag-331] + _ = x[KindJSDocOverrideTag-332] + _ = x[KindJSDocCallbackTag-333] + _ = x[KindJSDocOverloadTag-334] + _ = x[KindJSDocParameterTag-335] + _ = x[KindJSDocReturnTag-336] + _ = x[KindJSDocThisTag-337] + _ = x[KindJSDocTypeTag-338] + _ = x[KindJSDocTemplateTag-339] + _ = x[KindJSDocTypedefTag-340] + _ = x[KindJSDocSeeTag-341] + _ = x[KindJSDocPropertyTag-342] + _ = x[KindJSDocSatisfiesTag-343] + _ = x[KindJSDocImportTag-344] + _ = x[KindSyntaxList-345] + _ = x[KindJSTypeAliasDeclaration-346] + _ = x[KindJSExportAssignment-347] + _ = x[KindCommonJSExport-348] + _ = x[KindJSImportDeclaration-349] + _ = x[KindNotEmittedStatement-350] + _ = x[KindPartiallyEmittedExpression-351] + _ = x[KindCommaListExpression-352] + _ = x[KindSyntheticReferenceExpression-353] + _ = x[KindNotEmittedTypeElement-354] + _ = x[KindCount-355] +} + +const _Kind_name = "KindUnknownKindEndOfFileKindSingleLineCommentTriviaKindMultiLineCommentTriviaKindNewLineTriviaKindWhitespaceTriviaKindConflictMarkerTriviaKindNonTextFileMarkerTriviaKindNumericLiteralKindBigIntLiteralKindStringLiteralKindJsxTextKindJsxTextAllWhiteSpacesKindRegularExpressionLiteralKindNoSubstitutionTemplateLiteralKindTemplateHeadKindTemplateMiddleKindTemplateTailKindOpenBraceTokenKindCloseBraceTokenKindOpenParenTokenKindCloseParenTokenKindOpenBracketTokenKindCloseBracketTokenKindDotTokenKindDotDotDotTokenKindSemicolonTokenKindCommaTokenKindQuestionDotTokenKindLessThanTokenKindLessThanSlashTokenKindGreaterThanTokenKindLessThanEqualsTokenKindGreaterThanEqualsTokenKindEqualsEqualsTokenKindExclamationEqualsTokenKindEqualsEqualsEqualsTokenKindExclamationEqualsEqualsTokenKindEqualsGreaterThanTokenKindPlusTokenKindMinusTokenKindAsteriskTokenKindAsteriskAsteriskTokenKindSlashTokenKindPercentTokenKindPlusPlusTokenKindMinusMinusTokenKindLessThanLessThanTokenKindGreaterThanGreaterThanTokenKindGreaterThanGreaterThanGreaterThanTokenKindAmpersandTokenKindBarTokenKindCaretTokenKindExclamationTokenKindTildeTokenKindAmpersandAmpersandTokenKindBarBarTokenKindQuestionTokenKindColonTokenKindAtTokenKindQuestionQuestionTokenKindBacktickTokenKindHashTokenKindEqualsTokenKindPlusEqualsTokenKindMinusEqualsTokenKindAsteriskEqualsTokenKindAsteriskAsteriskEqualsTokenKindSlashEqualsTokenKindPercentEqualsTokenKindLessThanLessThanEqualsTokenKindGreaterThanGreaterThanEqualsTokenKindGreaterThanGreaterThanGreaterThanEqualsTokenKindAmpersandEqualsTokenKindBarEqualsTokenKindBarBarEqualsTokenKindAmpersandAmpersandEqualsTokenKindQuestionQuestionEqualsTokenKindCaretEqualsTokenKindIdentifierKindPrivateIdentifierKindJSDocCommentTextTokenKindBreakKeywordKindCaseKeywordKindCatchKeywordKindClassKeywordKindConstKeywordKindContinueKeywordKindDebuggerKeywordKindDefaultKeywordKindDeleteKeywordKindDoKeywordKindElseKeywordKindEnumKeywordKindExportKeywordKindExtendsKeywordKindFalseKeywordKindFinallyKeywordKindForKeywordKindFunctionKeywordKindIfKeywordKindImportKeywordKindInKeywordKindInstanceOfKeywordKindNewKeywordKindNullKeywordKindReturnKeywordKindSuperKeywordKindSwitchKeywordKindThisKeywordKindThrowKeywordKindTrueKeywordKindTryKeywordKindTypeOfKeywordKindVarKeywordKindVoidKeywordKindWhileKeywordKindWithKeywordKindImplementsKeywordKindInterfaceKeywordKindLetKeywordKindPackageKeywordKindPrivateKeywordKindProtectedKeywordKindPublicKeywordKindStaticKeywordKindYieldKeywordKindAbstractKeywordKindAccessorKeywordKindAsKeywordKindAssertsKeywordKindAssertKeywordKindAnyKeywordKindAsyncKeywordKindAwaitKeywordKindBooleanKeywordKindConstructorKeywordKindDeclareKeywordKindGetKeywordKindImmediateKeywordKindInferKeywordKindIntrinsicKeywordKindIsKeywordKindKeyOfKeywordKindModuleKeywordKindNamespaceKeywordKindNeverKeywordKindOutKeywordKindReadonlyKeywordKindRequireKeywordKindNumberKeywordKindObjectKeywordKindSatisfiesKeywordKindSetKeywordKindStringKeywordKindSymbolKeywordKindTypeKeywordKindUndefinedKeywordKindUniqueKeywordKindUnknownKeywordKindUsingKeywordKindFromKeywordKindGlobalKeywordKindBigIntKeywordKindOverrideKeywordKindOfKeywordKindDeferKeywordKindQualifiedNameKindComputedPropertyNameKindTypeParameterKindParameterKindDecoratorKindPropertySignatureKindPropertyDeclarationKindMethodSignatureKindMethodDeclarationKindClassStaticBlockDeclarationKindConstructorKindGetAccessorKindSetAccessorKindCallSignatureKindConstructSignatureKindIndexSignatureKindTypePredicateKindTypeReferenceKindFunctionTypeKindConstructorTypeKindTypeQueryKindTypeLiteralKindArrayTypeKindTupleTypeKindOptionalTypeKindRestTypeKindUnionTypeKindIntersectionTypeKindConditionalTypeKindInferTypeKindParenthesizedTypeKindThisTypeKindTypeOperatorKindIndexedAccessTypeKindMappedTypeKindLiteralTypeKindNamedTupleMemberKindTemplateLiteralTypeKindTemplateLiteralTypeSpanKindImportTypeKindObjectBindingPatternKindArrayBindingPatternKindBindingElementKindArrayLiteralExpressionKindObjectLiteralExpressionKindPropertyAccessExpressionKindElementAccessExpressionKindCallExpressionKindNewExpressionKindTaggedTemplateExpressionKindTypeAssertionExpressionKindParenthesizedExpressionKindFunctionExpressionKindArrowFunctionKindDeleteExpressionKindTypeOfExpressionKindVoidExpressionKindAwaitExpressionKindPrefixUnaryExpressionKindPostfixUnaryExpressionKindBinaryExpressionKindConditionalExpressionKindTemplateExpressionKindYieldExpressionKindSpreadElementKindClassExpressionKindOmittedExpressionKindExpressionWithTypeArgumentsKindAsExpressionKindNonNullExpressionKindMetaPropertyKindSyntheticExpressionKindSatisfiesExpressionKindTemplateSpanKindSemicolonClassElementKindBlockKindEmptyStatementKindVariableStatementKindExpressionStatementKindIfStatementKindDoStatementKindWhileStatementKindForStatementKindForInStatementKindForOfStatementKindContinueStatementKindBreakStatementKindReturnStatementKindWithStatementKindSwitchStatementKindLabeledStatementKindThrowStatementKindTryStatementKindDebuggerStatementKindVariableDeclarationKindVariableDeclarationListKindFunctionDeclarationKindClassDeclarationKindInterfaceDeclarationKindTypeAliasDeclarationKindEnumDeclarationKindModuleDeclarationKindModuleBlockKindCaseBlockKindNamespaceExportDeclarationKindImportEqualsDeclarationKindImportDeclarationKindImportClauseKindNamespaceImportKindNamedImportsKindImportSpecifierKindExportAssignmentKindExportDeclarationKindNamedExportsKindNamespaceExportKindExportSpecifierKindMissingDeclarationKindExternalModuleReferenceKindJsxElementKindJsxSelfClosingElementKindJsxOpeningElementKindJsxClosingElementKindJsxFragmentKindJsxOpeningFragmentKindJsxClosingFragmentKindJsxAttributeKindJsxAttributesKindJsxSpreadAttributeKindJsxExpressionKindJsxNamespacedNameKindCaseClauseKindDefaultClauseKindHeritageClauseKindCatchClauseKindImportAttributesKindImportAttributeKindPropertyAssignmentKindShorthandPropertyAssignmentKindSpreadAssignmentKindEnumMemberKindSourceFileKindBundleKindJSDocTypeExpressionKindJSDocNameReferenceKindJSDocMemberNameKindJSDocAllTypeKindJSDocNullableTypeKindJSDocNonNullableTypeKindJSDocOptionalTypeKindJSDocVariadicTypeKindJSDocKindJSDocTextKindJSDocTypeLiteralKindJSDocSignatureKindJSDocLinkKindJSDocLinkCodeKindJSDocLinkPlainKindJSDocTagKindJSDocAugmentsTagKindJSDocImplementsTagKindJSDocDeprecatedTagKindJSDocPublicTagKindJSDocPrivateTagKindJSDocProtectedTagKindJSDocReadonlyTagKindJSDocOverrideTagKindJSDocCallbackTagKindJSDocOverloadTagKindJSDocParameterTagKindJSDocReturnTagKindJSDocThisTagKindJSDocTypeTagKindJSDocTemplateTagKindJSDocTypedefTagKindJSDocSeeTagKindJSDocPropertyTagKindJSDocSatisfiesTagKindJSDocImportTagKindSyntaxListKindJSTypeAliasDeclarationKindJSExportAssignmentKindCommonJSExportKindJSImportDeclarationKindNotEmittedStatementKindPartiallyEmittedExpressionKindCommaListExpressionKindSyntheticReferenceExpressionKindNotEmittedTypeElementKindCount" + +var _Kind_index = [...]uint16{0, 11, 24, 51, 77, 94, 114, 138, 165, 183, 200, 217, 228, 253, 281, 314, 330, 348, 364, 382, 401, 419, 438, 458, 479, 491, 509, 527, 541, 561, 578, 600, 620, 643, 669, 690, 716, 743, 775, 801, 814, 828, 845, 870, 884, 900, 917, 936, 961, 992, 1034, 1052, 1064, 1078, 1098, 1112, 1139, 1154, 1171, 1185, 1196, 1221, 1238, 1251, 1266, 1285, 1305, 1328, 1359, 1379, 1401, 1432, 1469, 1517, 1541, 1559, 1580, 1613, 1644, 1664, 1678, 1699, 1724, 1740, 1755, 1771, 1787, 1803, 1822, 1841, 1859, 1876, 1889, 1904, 1919, 1936, 1954, 1970, 1988, 2002, 2021, 2034, 2051, 2064, 2085, 2099, 2114, 2131, 2147, 2164, 2179, 2195, 2210, 2224, 2241, 2255, 2270, 2286, 2301, 2322, 2342, 2356, 2374, 2392, 2412, 2429, 2446, 2462, 2481, 2500, 2513, 2531, 2548, 2562, 2578, 2594, 2612, 2634, 2652, 2666, 2686, 2702, 2722, 2735, 2751, 2768, 2788, 2804, 2818, 2837, 2855, 2872, 2889, 2909, 2923, 2940, 2957, 2972, 2992, 3009, 3027, 3043, 3058, 3075, 3092, 3111, 3124, 3140, 3157, 3181, 3198, 3211, 3224, 3245, 3268, 3287, 3308, 3339, 3354, 3369, 3384, 3401, 3423, 3441, 3458, 3475, 3491, 3510, 3523, 3538, 3551, 3564, 3580, 3592, 3605, 3625, 3644, 3657, 3678, 3690, 3706, 3727, 3741, 3756, 3776, 3799, 3826, 3840, 3864, 3887, 3905, 3931, 3958, 3986, 4013, 4031, 4048, 4076, 4103, 4130, 4152, 4169, 4189, 4209, 4227, 4246, 4271, 4297, 4317, 4342, 4364, 4383, 4400, 4419, 4440, 4471, 4487, 4508, 4524, 4547, 4570, 4586, 4611, 4620, 4638, 4659, 4682, 4697, 4712, 4730, 4746, 4764, 4782, 4803, 4821, 4840, 4857, 4876, 4896, 4914, 4930, 4951, 4974, 5001, 5024, 5044, 5068, 5092, 5111, 5132, 5147, 5160, 5190, 5217, 5238, 5254, 5273, 5289, 5308, 5328, 5349, 5365, 5384, 5403, 5425, 5452, 5466, 5491, 5512, 5533, 5548, 5570, 5592, 5608, 5625, 5647, 5664, 5685, 5699, 5716, 5734, 5749, 5769, 5788, 5810, 5841, 5861, 5875, 5889, 5899, 5922, 5944, 5963, 5979, 6000, 6024, 6045, 6066, 6075, 6088, 6108, 6126, 6139, 6156, 6174, 6186, 6206, 6228, 6250, 6268, 6287, 6308, 6328, 6348, 6368, 6388, 6409, 6427, 6443, 6459, 6479, 6498, 6513, 6533, 6554, 6572, 6586, 6612, 6634, 6652, 6675, 6698, 6728, 6751, 6783, 6808, 6817} + +func (i Kind) String() string { + if i < 0 || i >= Kind(len(_Kind_index)-1) { + return "Kind(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _Kind_name[_Kind_index[i]:_Kind_index[i+1]] +} diff --git a/kitcom/internal/tsgo/ast/modifierflags.go b/kitcom/internal/tsgo/ast/modifierflags.go new file mode 100644 index 0000000..dfc4c21 --- /dev/null +++ b/kitcom/internal/tsgo/ast/modifierflags.go @@ -0,0 +1,53 @@ +package ast + +type ModifierFlags uint32 + +const ( + ModifierFlagsNone ModifierFlags = 0 + // Syntactic/JSDoc modifiers + ModifierFlagsPublic ModifierFlags = 1 << 0 // Property/Method + ModifierFlagsPrivate ModifierFlags = 1 << 1 // Property/Method + ModifierFlagsProtected ModifierFlags = 1 << 2 // Property/Method + ModifierFlagsReadonly ModifierFlags = 1 << 3 // Property/Method + ModifierFlagsOverride ModifierFlags = 1 << 4 // Override method + // Syntactic-only modifiers + ModifierFlagsExport ModifierFlags = 1 << 5 // Declarations + ModifierFlagsAbstract ModifierFlags = 1 << 6 // Class/Method/ConstructSignature + ModifierFlagsAmbient ModifierFlags = 1 << 7 // Declarations (declare keyword) + ModifierFlagsStatic ModifierFlags = 1 << 8 // Property/Method + ModifierFlagsAccessor ModifierFlags = 1 << 9 // Property + ModifierFlagsAsync ModifierFlags = 1 << 10 // Property/Method/Function + ModifierFlagsDefault ModifierFlags = 1 << 11 // Function/Class (export default declaration) + ModifierFlagsConst ModifierFlags = 1 << 12 // Const enum + ModifierFlagsIn ModifierFlags = 1 << 13 // Contravariance modifier + ModifierFlagsOut ModifierFlags = 1 << 14 // Covariance modifier + ModifierFlagsDecorator ModifierFlags = 1 << 15 // Contains a decorator + // JSDoc-only modifiers + ModifierFlagsDeprecated ModifierFlags = 1 << 16 // Deprecated tag + // Cache-only JSDoc-modifiers. Should match order of Syntactic/JSDoc modifiers, above. + ModifierFlagsJSDocPublic ModifierFlags = 1 << 23 // if this value changes, `selectEffectiveModifierFlags` must change accordingly + ModifierFlagsJSDocPrivate ModifierFlags = 1 << 24 + ModifierFlagsJSDocProtected ModifierFlags = 1 << 25 + ModifierFlagsJSDocReadonly ModifierFlags = 1 << 26 + ModifierFlagsJSDocOverride ModifierFlags = 1 << 27 + ModifierFlagsHasComputedJSDocModifiers ModifierFlags = 1 << 28 // Indicates the computed modifier flags include modifiers from JSDoc. + ModifierFlagsHasComputedFlags ModifierFlags = 1 << 29 // Modifier flags have been computed + + ModifierFlagsSyntacticOrJSDocModifiers = ModifierFlagsPublic | ModifierFlagsPrivate | ModifierFlagsProtected | ModifierFlagsReadonly | ModifierFlagsOverride + ModifierFlagsSyntacticOnlyModifiers = ModifierFlagsExport | ModifierFlagsAmbient | ModifierFlagsAbstract | ModifierFlagsStatic | ModifierFlagsAccessor | ModifierFlagsAsync | ModifierFlagsDefault | ModifierFlagsConst | ModifierFlagsIn | ModifierFlagsOut | ModifierFlagsDecorator + ModifierFlagsSyntacticModifiers = ModifierFlagsSyntacticOrJSDocModifiers | ModifierFlagsSyntacticOnlyModifiers + ModifierFlagsJSDocCacheOnlyModifiers = ModifierFlagsJSDocPublic | ModifierFlagsJSDocPrivate | ModifierFlagsJSDocProtected | ModifierFlagsJSDocReadonly | ModifierFlagsJSDocOverride + ModifierFlagsJSDocOnlyModifiers = ModifierFlagsDeprecated + ModifierFlagsNonCacheOnlyModifiers = ModifierFlagsSyntacticOrJSDocModifiers | ModifierFlagsSyntacticOnlyModifiers | ModifierFlagsJSDocOnlyModifiers + + ModifierFlagsAccessibilityModifier = ModifierFlagsPublic | ModifierFlagsPrivate | ModifierFlagsProtected + // Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property. + ModifierFlagsParameterPropertyModifier = ModifierFlagsAccessibilityModifier | ModifierFlagsReadonly | ModifierFlagsOverride + ModifierFlagsNonPublicAccessibilityModifier = ModifierFlagsPrivate | ModifierFlagsProtected + + ModifierFlagsTypeScriptModifier = ModifierFlagsAmbient | ModifierFlagsPublic | ModifierFlagsPrivate | ModifierFlagsProtected | ModifierFlagsReadonly | ModifierFlagsAbstract | ModifierFlagsConst | ModifierFlagsOverride | ModifierFlagsIn | ModifierFlagsOut + ModifierFlagsExportDefault = ModifierFlagsExport | ModifierFlagsDefault + ModifierFlagsAll = ModifierFlagsExport | ModifierFlagsAmbient | ModifierFlagsPublic | ModifierFlagsPrivate | ModifierFlagsProtected | ModifierFlagsStatic | ModifierFlagsReadonly | ModifierFlagsAbstract | ModifierFlagsAccessor | ModifierFlagsAsync | ModifierFlagsDefault | ModifierFlagsConst | ModifierFlagsDeprecated | ModifierFlagsOverride | ModifierFlagsIn | ModifierFlagsOut | ModifierFlagsDecorator + ModifierFlagsModifier = ModifierFlagsAll & ^ModifierFlagsDecorator + ModifierFlagsJavaScript = ModifierFlagsExport | ModifierFlagsStatic | ModifierFlagsAccessor | ModifierFlagsAsync | ModifierFlagsDefault +) diff --git a/kitcom/internal/tsgo/ast/nodeflags.go b/kitcom/internal/tsgo/ast/nodeflags.go new file mode 100644 index 0000000..2feb4f2 --- /dev/null +++ b/kitcom/internal/tsgo/ast/nodeflags.go @@ -0,0 +1,65 @@ +package ast + +type NodeFlags uint32 + +const ( + NodeFlagsNone NodeFlags = 0 + NodeFlagsLet NodeFlags = 1 << 0 // Variable declaration + NodeFlagsConst NodeFlags = 1 << 1 // Variable declaration + NodeFlagsUsing NodeFlags = 1 << 2 // Variable declaration + NodeFlagsReparsed NodeFlags = 1 << 3 // Node was synthesized during parsing + NodeFlagsSynthesized NodeFlags = 1 << 4 // Node was synthesized during transformation + NodeFlagsOptionalChain NodeFlags = 1 << 5 // Chained MemberExpression rooted to a pseudo-OptionalExpression + NodeFlagsExportContext NodeFlags = 1 << 6 // Export context (initialized by binding) + NodeFlagsContainsThis NodeFlags = 1 << 7 // Interface contains references to "this" + NodeFlagsHasImplicitReturn NodeFlags = 1 << 8 // If function implicitly returns on one of codepaths (initialized by binding) + NodeFlagsHasExplicitReturn NodeFlags = 1 << 9 // If function has explicit reachable return on one of codepaths (initialized by binding) + NodeFlagsDisallowInContext NodeFlags = 1 << 10 // If node was parsed in a context where 'in-expressions' are not allowed + NodeFlagsYieldContext NodeFlags = 1 << 11 // If node was parsed in the 'yield' context created when parsing a generator + NodeFlagsDecoratorContext NodeFlags = 1 << 12 // If node was parsed as part of a decorator + NodeFlagsAwaitContext NodeFlags = 1 << 13 // If node was parsed in the 'await' context created when parsing an async function + NodeFlagsDisallowConditionalTypesContext NodeFlags = 1 << 14 // If node was parsed in a context where conditional types are not allowed + NodeFlagsThisNodeHasError NodeFlags = 1 << 15 // If the parser encountered an error when parsing the code that created this node + NodeFlagsJavaScriptFile NodeFlags = 1 << 16 // If node was parsed in a JavaScript + NodeFlagsThisNodeOrAnySubNodesHasError NodeFlags = 1 << 17 // If this node or any of its children had an error + NodeFlagsHasAggregatedChildData NodeFlags = 1 << 18 // If we've computed data from children and cached it in this node + + // These flags will be set when the parser encounters a dynamic import expression or 'import.meta' to avoid + // walking the tree if the flags are not set. However, these flags are just a approximation + // (hence why it's named "PossiblyContainsDynamicImport") because once set, the flags never get cleared. + // During editing, if a dynamic import is removed, incremental parsing will *NOT* clear this flag. + // This means that the tree will always be traversed during module resolution, or when looking for external module indicators. + // However, the removal operation should not occur often and in the case of the + // removal, it is likely that users will add the import anyway. + // The advantage of this approach is its simplicity. For the case of batch compilation, + // we guarantee that users won't have to pay the price of walking the tree if a dynamic import isn't used. + NodeFlagsPossiblyContainsDynamicImport NodeFlags = 1 << 19 + NodeFlagsPossiblyContainsImportMeta NodeFlags = 1 << 20 + + NodeFlagsHasJSDoc NodeFlags = 1 << 21 // If node has preceding JSDoc comment(s) + NodeFlagsJSDoc NodeFlags = 1 << 22 // If node was parsed inside jsdoc + NodeFlagsAmbient NodeFlags = 1 << 23 // If node was inside an ambient context -- a declaration file, or inside something with the `declare` modifier. + NodeFlagsInWithStatement NodeFlags = 1 << 24 // If any ancestor of node was the `statement` of a WithStatement (not the `expression`) + NodeFlagsJsonFile NodeFlags = 1 << 25 // If node was parsed in a Json + NodeFlagsDeprecated NodeFlags = 1 << 26 // If has '@deprecated' JSDoc tag + + NodeFlagsBlockScoped = NodeFlagsLet | NodeFlagsConst | NodeFlagsUsing + NodeFlagsConstant = NodeFlagsConst | NodeFlagsUsing + NodeFlagsAwaitUsing = NodeFlagsConst | NodeFlagsUsing // Variable declaration (NOTE: on a single node these flags would otherwise be mutually exclusive) + + NodeFlagsReachabilityCheckFlags = NodeFlagsHasImplicitReturn | NodeFlagsHasExplicitReturn + + // Parsing context flags + NodeFlagsContextFlags NodeFlags = NodeFlagsDisallowInContext | NodeFlagsDisallowConditionalTypesContext | NodeFlagsYieldContext | NodeFlagsDecoratorContext | NodeFlagsAwaitContext | NodeFlagsJavaScriptFile | NodeFlagsInWithStatement | NodeFlagsAmbient + + // Exclude these flags when parsing a Type + NodeFlagsTypeExcludesFlags NodeFlags = NodeFlagsYieldContext | NodeFlagsAwaitContext + + // Represents all flags that are potentially set once and + // never cleared on SourceFiles which get re-used in between incremental parses. + // See the comment above on `PossiblyContainsDynamicImport` and `PossiblyContainsImportMeta`. + NodeFlagsPermanentlySetIncrementalFlags NodeFlags = NodeFlagsPossiblyContainsDynamicImport | NodeFlagsPossiblyContainsImportMeta + + // The following flags repurpose other NodeFlags as different meanings for Identifier nodes + NodeFlagsIdentifierHasExtendedUnicodeEscape NodeFlags = NodeFlagsContainsThis // Indicates whether the identifier contains an extended unicode escape sequence +) diff --git a/kitcom/internal/tsgo/ast/parseoptions.go b/kitcom/internal/tsgo/ast/parseoptions.go new file mode 100644 index 0000000..c1ed4ec --- /dev/null +++ b/kitcom/internal/tsgo/ast/parseoptions.go @@ -0,0 +1,168 @@ +package ast + +import ( + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/core" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/tspath" +) + +type JSDocParsingMode int + +const ( + JSDocParsingModeParseAll JSDocParsingMode = iota + JSDocParsingModeParseNone + JSDocParsingModeParseForTypeErrors + JSDocParsingModeParseForTypeInfo +) + +type SourceFileParseOptions struct { + FileName string + Path tspath.Path + CompilerOptions core.SourceFileAffectingCompilerOptions + ExternalModuleIndicatorOptions ExternalModuleIndicatorOptions + JSDocParsingMode JSDocParsingMode +} + +func GetSourceFileAffectingCompilerOptions(fileName string, options *core.CompilerOptions) core.SourceFileAffectingCompilerOptions { + // Declaration files are not parsed/bound differently depending on compiler options. + if tspath.IsDeclarationFileName(fileName) { + return core.SourceFileAffectingCompilerOptions{} + } + return options.SourceFileAffecting() +} + +type ExternalModuleIndicatorOptions struct { + jsx bool + force bool +} + +func GetExternalModuleIndicatorOptions(fileName string, options *core.CompilerOptions, metadata SourceFileMetaData) ExternalModuleIndicatorOptions { + if tspath.IsDeclarationFileName(fileName) { + return ExternalModuleIndicatorOptions{} + } + + switch options.GetEmitModuleDetectionKind() { + case core.ModuleDetectionKindForce: + // All non-declaration files are modules, declaration files still do the usual isFileProbablyExternalModule + return ExternalModuleIndicatorOptions{force: true} + case core.ModuleDetectionKindLegacy: + // Files are modules if they have imports, exports, or import.meta + return ExternalModuleIndicatorOptions{} + case core.ModuleDetectionKindAuto: + // If module is nodenext or node16, all esm format files are modules + // If jsx is react-jsx or react-jsxdev then jsx tags force module-ness + // otherwise, the presence of import or export statments (or import.meta) implies module-ness + return ExternalModuleIndicatorOptions{ + jsx: options.Jsx == core.JsxEmitReactJSX || options.Jsx == core.JsxEmitReactJSXDev, + force: isFileForcedToBeModuleByFormat(fileName, options, metadata), + } + default: + return ExternalModuleIndicatorOptions{} + } +} + +var isFileForcedToBeModuleByFormatExtensions = []string{tspath.ExtensionCjs, tspath.ExtensionCts, tspath.ExtensionMjs, tspath.ExtensionMts} + +func isFileForcedToBeModuleByFormat(fileName string, options *core.CompilerOptions, metadata SourceFileMetaData) bool { + // Excludes declaration files - they still require an explicit `export {}` or the like + // for back compat purposes. The only non-declaration files _not_ forced to be a module are `.js` files + // that aren't esm-mode (meaning not in a `type: module` scope). + if GetImpliedNodeFormatForEmitWorker(fileName, options.GetEmitModuleKind(), metadata) == core.ModuleKindESNext || tspath.FileExtensionIsOneOf(fileName, isFileForcedToBeModuleByFormatExtensions) { + return true + } + return false +} + +func SetExternalModuleIndicator(file *SourceFile, opts ExternalModuleIndicatorOptions) { + file.ExternalModuleIndicator = getExternalModuleIndicator(file, opts) +} + +func getExternalModuleIndicator(file *SourceFile, opts ExternalModuleIndicatorOptions) *Node { + if file.ScriptKind == core.ScriptKindJSON { + return nil + } + + if node := isFileProbablyExternalModule(file); node != nil { + return node + } + + if file.IsDeclarationFile { + return nil + } + + if opts.jsx { + if node := isFileModuleFromUsingJSXTag(file); node != nil { + return node + } + } + + if opts.force { + return file.AsNode() + } + + return nil +} + +func isFileProbablyExternalModule(sourceFile *SourceFile) *Node { + for _, statement := range sourceFile.Statements.Nodes { + if isAnExternalModuleIndicatorNode(statement) { + return statement + } + } + return getImportMetaIfNecessary(sourceFile) +} + +func isAnExternalModuleIndicatorNode(node *Node) bool { + return HasSyntacticModifier(node, ModifierFlagsExport) || + IsImportEqualsDeclaration(node) && IsExternalModuleReference(node.AsImportEqualsDeclaration().ModuleReference) || + IsImportDeclaration(node) || IsExportAssignment(node) || IsExportDeclaration(node) +} + +func getImportMetaIfNecessary(sourceFile *SourceFile) *Node { + if sourceFile.AsNode().Flags&NodeFlagsPossiblyContainsImportMeta != 0 { + return findChildNode(sourceFile.AsNode(), IsImportMeta) + } + return nil +} + +func findChildNode(root *Node, check func(*Node) bool) *Node { + var result *Node + var visit func(*Node) bool + visit = func(node *Node) bool { + if check(node) { + result = node + return true + } + return node.ForEachChild(visit) + } + visit(root) + return result +} + +func isFileModuleFromUsingJSXTag(file *SourceFile) *Node { + return walkTreeForJSXTags(file.AsNode()) +} + +// This is a somewhat unavoidable full tree walk to locate a JSX tag - `import.meta` requires the same, +// but we avoid that walk (or parts of it) if at all possible using the `PossiblyContainsImportMeta` node flag. +// Unfortunately, there's no `NodeFlag` space to do the same for JSX. +func walkTreeForJSXTags(node *Node) *Node { + var found *Node + + var visitor func(node *Node) bool + visitor = func(node *Node) bool { + if found != nil { + return true + } + if node.SubtreeFacts()&SubtreeContainsJsx == 0 { + return false + } + if IsJsxOpeningElement(node) || IsJsxFragment(node) { + found = node + return true + } + return node.ForEachChild(visitor) + } + visitor(node) + + return found +} diff --git a/kitcom/internal/tsgo/ast/precedence.go b/kitcom/internal/tsgo/ast/precedence.go new file mode 100644 index 0000000..e23d527 --- /dev/null +++ b/kitcom/internal/tsgo/ast/precedence.go @@ -0,0 +1,714 @@ +package ast + +import ( + "fmt" +) + +type OperatorPrecedence int + +const ( + // Expression: + // AssignmentExpression + // Expression `,` AssignmentExpression + OperatorPrecedenceComma OperatorPrecedence = iota + // NOTE: `Spread` is higher than `Comma` due to how it is parsed in |ElementList| + // SpreadElement: + // `...` AssignmentExpression + OperatorPrecedenceSpread + // AssignmentExpression: + // ConditionalExpression + // YieldExpression + // ArrowFunction + // AsyncArrowFunction + // LeftHandSideExpression `=` AssignmentExpression + // LeftHandSideExpression AssignmentOperator AssignmentExpression + // + // NOTE: AssignmentExpression is broken down into several precedences due to the requirements + // of the parenthesizer rules. + // AssignmentExpression: YieldExpression + // YieldExpression: + // `yield` + // `yield` AssignmentExpression + // `yield` `*` AssignmentExpression + OperatorPrecedenceYield + // AssignmentExpression: LeftHandSideExpression `=` AssignmentExpression + // AssignmentExpression: LeftHandSideExpression AssignmentOperator AssignmentExpression + // AssignmentOperator: one of + // `*=` `/=` `%=` `+=` `-=` `<<=` `>>=` `>>>=` `&=` `^=` `|=` `**=` + OperatorPrecedenceAssignment + // NOTE: `Conditional` is considered higher than `Assignment` here, but in reality they have + // the same precedence. + // AssignmentExpression: ConditionalExpression + // ConditionalExpression: + // ShortCircuitExpression + // ShortCircuitExpression `?` AssignmentExpression `:` AssignmentExpression + OperatorPrecedenceConditional + // LogicalORExpression: + // LogicalANDExpression + // LogicalORExpression `||` LogicalANDExpression + OperatorPrecedenceLogicalOR + // LogicalANDExpression: + // BitwiseORExpression + // LogicalANDExprerssion `&&` BitwiseORExpression + OperatorPrecedenceLogicalAND + // BitwiseORExpression: + // BitwiseXORExpression + // BitwiseORExpression `|` BitwiseXORExpression + OperatorPrecedenceBitwiseOR + // BitwiseXORExpression: + // BitwiseANDExpression + // BitwiseXORExpression `^` BitwiseANDExpression + OperatorPrecedenceBitwiseXOR + // BitwiseANDExpression: + // EqualityExpression + // BitwiseANDExpression `&` EqualityExpression + OperatorPrecedenceBitwiseAND + // EqualityExpression: + // RelationalExpression + // EqualityExpression `==` RelationalExpression + // EqualityExpression `!=` RelationalExpression + // EqualityExpression `===` RelationalExpression + // EqualityExpression `!==` RelationalExpression + OperatorPrecedenceEquality + // RelationalExpression: + // ShiftExpression + // RelationalExpression `<` ShiftExpression + // RelationalExpression `>` ShiftExpression + // RelationalExpression `<=` ShiftExpression + // RelationalExpression `>=` ShiftExpression + // RelationalExpression `instanceof` ShiftExpression + // RelationalExpression `in` ShiftExpression + // [+TypeScript] RelationalExpression `as` Type + OperatorPrecedenceRelational + // ShiftExpression: + // AdditiveExpression + // ShiftExpression `<<` AdditiveExpression + // ShiftExpression `>>` AdditiveExpression + // ShiftExpression `>>>` AdditiveExpression + OperatorPrecedenceShift + // AdditiveExpression: + // MultiplicativeExpression + // AdditiveExpression `+` MultiplicativeExpression + // AdditiveExpression `-` MultiplicativeExpression + OperatorPrecedenceAdditive + // MultiplicativeExpression: + // ExponentiationExpression + // MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + // MultiplicativeOperator: one of `*`, `/`, `%` + OperatorPrecedenceMultiplicative + // ExponentiationExpression: + // UnaryExpression + // UpdateExpression `**` ExponentiationExpression + OperatorPrecedenceExponentiation + // UnaryExpression: + // UpdateExpression + // `delete` UnaryExpression + // `void` UnaryExpression + // `typeof` UnaryExpression + // `+` UnaryExpression + // `-` UnaryExpression + // `~` UnaryExpression + // `!` UnaryExpression + // AwaitExpression + // UpdateExpression: // TODO: Do we need to investigate the precedence here? + // `++` UnaryExpression + // `--` UnaryExpression + OperatorPrecedenceUnary + // UpdateExpression: + // LeftHandSideExpression + // LeftHandSideExpression `++` + // LeftHandSideExpression `--` + OperatorPrecedenceUpdate + // LeftHandSideExpression: + // NewExpression + // NewExpression: + // MemberExpression + // `new` NewExpression + OperatorPrecedenceLeftHandSide + // LeftHandSideExpression: + // OptionalExpression + // OptionalExpression: + // MemberExpression OptionalChain + // CallExpression OptionalChain + // OptionalExpression OptionalChain + OperatorPrecedenceOptionalChain + // LeftHandSideExpression: + // CallExpression + // CallExpression: + // CoverCallExpressionAndAsyncArrowHead + // SuperCall + // ImportCall + // CallExpression Arguments + // CallExpression `[` Expression `]` + // CallExpression `.` IdentifierName + // CallExpression TemplateLiteral + // MemberExpression: + // PrimaryExpression + // MemberExpression `[` Expression `]` + // MemberExpression `.` IdentifierName + // MemberExpression TemplateLiteral + // SuperProperty + // MetaProperty + // `new` MemberExpression Arguments + OperatorPrecedenceMember + // TODO: JSXElement? + // PrimaryExpression: + // `this` + // IdentifierReference + // Literal + // ArrayLiteral + // ObjectLiteral + // FunctionExpression + // ClassExpression + // GeneratorExpression + // AsyncFunctionExpression + // AsyncGeneratorExpression + // RegularExpressionLiteral + // TemplateLiteral + OperatorPrecedencePrimary + // PrimaryExpression: + // CoverParenthesizedExpressionAndArrowParameterList + OperatorPrecedenceParentheses + OperatorPrecedenceLowest = OperatorPrecedenceComma + OperatorPrecedenceHighest = OperatorPrecedenceParentheses + OperatorPrecedenceDisallowComma = OperatorPrecedenceYield + // ShortCircuitExpression: + // LogicalORExpression + // CoalesceExpression + // CoalesceExpression: + // CoalesceExpressionHead `??` BitwiseORExpression + // CoalesceExpressionHead: + // CoalesceExpression + // BitwiseORExpression + OperatorPrecedenceCoalesce = OperatorPrecedenceLogicalOR + // -1 is lower than all other precedences. Returning it will cause binary expression + // parsing to stop. + OperatorPrecedenceInvalid OperatorPrecedence = -1 +) + +func getOperator(expression *Expression) Kind { + switch expression.Kind { + case KindBinaryExpression: + return expression.AsBinaryExpression().OperatorToken.Kind + case KindPrefixUnaryExpression: + return expression.AsPrefixUnaryExpression().Operator + case KindPostfixUnaryExpression: + return expression.AsPostfixUnaryExpression().Operator + default: + return expression.Kind + } +} + +// Gets the precedence of an expression +func GetExpressionPrecedence(expression *Expression) OperatorPrecedence { + operator := getOperator(expression) + var flags OperatorPrecedenceFlags + if expression.Kind == KindNewExpression && expression.AsNewExpression().Arguments == nil { + flags = OperatorPrecedenceFlagsNewWithoutArguments + } else if IsOptionalChain(expression) { + flags = OperatorPrecedenceFlagsOptionalChain + } + return GetOperatorPrecedence(expression.Kind, operator, flags) +} + +type OperatorPrecedenceFlags int + +const ( + OperatorPrecedenceFlagsNone OperatorPrecedenceFlags = 0 + OperatorPrecedenceFlagsNewWithoutArguments OperatorPrecedenceFlags = 1 << 0 + OperatorPrecedenceFlagsOptionalChain OperatorPrecedenceFlags = 1 << 1 +) + +// Gets the precedence of an operator +func GetOperatorPrecedence(nodeKind Kind, operatorKind Kind, flags OperatorPrecedenceFlags) OperatorPrecedence { + switch nodeKind { + case KindCommaListExpression: + return OperatorPrecedenceComma + case KindSpreadElement: + return OperatorPrecedenceSpread + case KindYieldExpression: + return OperatorPrecedenceYield + // !!! By necessity, this differs from the old compiler to better align with ParenthesizerRules. consider backporting + case KindArrowFunction: + return OperatorPrecedenceAssignment + case KindConditionalExpression: + return OperatorPrecedenceConditional + case KindBinaryExpression: + switch operatorKind { + case KindCommaToken: + return OperatorPrecedenceComma + + case KindEqualsToken, + KindPlusEqualsToken, + KindMinusEqualsToken, + KindAsteriskAsteriskEqualsToken, + KindAsteriskEqualsToken, + KindSlashEqualsToken, + KindPercentEqualsToken, + KindLessThanLessThanEqualsToken, + KindGreaterThanGreaterThanEqualsToken, + KindGreaterThanGreaterThanGreaterThanEqualsToken, + KindAmpersandEqualsToken, + KindCaretEqualsToken, + KindBarEqualsToken, + KindBarBarEqualsToken, + KindAmpersandAmpersandEqualsToken, + KindQuestionQuestionEqualsToken: + return OperatorPrecedenceAssignment + + default: + return GetBinaryOperatorPrecedence(operatorKind) + } + // TODO: Should prefix `++` and `--` be moved to the `Update` precedence? + case KindTypeAssertionExpression, + KindNonNullExpression, + KindPrefixUnaryExpression, + KindTypeOfExpression, + KindVoidExpression, + KindDeleteExpression, + KindAwaitExpression: + return OperatorPrecedenceUnary + + case KindPostfixUnaryExpression: + return OperatorPrecedenceUpdate + + // !!! By necessity, this differs from the old compiler to better align with ParenthesizerRules. consider backporting + case KindPropertyAccessExpression, KindElementAccessExpression: + if flags&OperatorPrecedenceFlagsOptionalChain != 0 { + return OperatorPrecedenceOptionalChain + } + return OperatorPrecedenceMember + + case KindCallExpression: + if flags&OperatorPrecedenceFlagsOptionalChain != 0 { + return OperatorPrecedenceOptionalChain + } + return OperatorPrecedenceMember + + // !!! By necessity, this differs from the old compiler to better align with ParenthesizerRules. consider backporting + case KindNewExpression: + if flags&OperatorPrecedenceFlagsNewWithoutArguments != 0 { + return OperatorPrecedenceLeftHandSide + } + return OperatorPrecedenceMember + + // !!! By necessity, this differs from the old compiler to better align with ParenthesizerRules. consider backporting + case KindTaggedTemplateExpression, KindMetaProperty, KindExpressionWithTypeArguments: + return OperatorPrecedenceMember + + case KindAsExpression, + KindSatisfiesExpression: + return OperatorPrecedenceRelational + + case KindThisKeyword, + KindSuperKeyword, + KindImportKeyword, + KindIdentifier, + KindPrivateIdentifier, + KindNullKeyword, + KindTrueKeyword, + KindFalseKeyword, + KindNumericLiteral, + KindBigIntLiteral, + KindStringLiteral, + KindArrayLiteralExpression, + KindObjectLiteralExpression, + KindFunctionExpression, + KindClassExpression, + KindRegularExpressionLiteral, + KindNoSubstitutionTemplateLiteral, + KindTemplateExpression, + KindOmittedExpression, + KindJsxElement, + KindJsxSelfClosingElement, + KindJsxFragment: + return OperatorPrecedencePrimary + + // !!! By necessity, this differs from the old compiler to support emit. consider backporting + case KindParenthesizedExpression: + return OperatorPrecedenceParentheses + + default: + return OperatorPrecedenceInvalid + } +} + +// Gets the precedence of a binary operator +func GetBinaryOperatorPrecedence(operatorKind Kind) OperatorPrecedence { + switch operatorKind { + case KindQuestionQuestionToken: + return OperatorPrecedenceCoalesce + case KindBarBarToken: + return OperatorPrecedenceLogicalOR + case KindAmpersandAmpersandToken: + return OperatorPrecedenceLogicalAND + case KindBarToken: + return OperatorPrecedenceBitwiseOR + case KindCaretToken: + return OperatorPrecedenceBitwiseXOR + case KindAmpersandToken: + return OperatorPrecedenceBitwiseAND + case KindEqualsEqualsToken, KindExclamationEqualsToken, KindEqualsEqualsEqualsToken, KindExclamationEqualsEqualsToken: + return OperatorPrecedenceEquality + case KindLessThanToken, KindGreaterThanToken, KindLessThanEqualsToken, KindGreaterThanEqualsToken, + KindInstanceOfKeyword, KindInKeyword, KindAsKeyword, KindSatisfiesKeyword: + return OperatorPrecedenceRelational + case KindLessThanLessThanToken, KindGreaterThanGreaterThanToken, KindGreaterThanGreaterThanGreaterThanToken: + return OperatorPrecedenceShift + case KindPlusToken, KindMinusToken: + return OperatorPrecedenceAdditive + case KindAsteriskToken, KindSlashToken, KindPercentToken: + return OperatorPrecedenceMultiplicative + case KindAsteriskAsteriskToken: + return OperatorPrecedenceExponentiation + } + // -1 is lower than all other precedences. Returning it will cause binary expression + // parsing to stop. + return OperatorPrecedenceInvalid +} + +// Gets the leftmost expression of an expression, e.g. `a` in `a.b`, `a[b]`, `a++`, `a+b`, `a?b:c`, `a as B`, etc. +func GetLeftmostExpression(node *Expression, stopAtCallExpressions bool) *Expression { + for { + switch node.Kind { + case KindPostfixUnaryExpression: + node = node.AsPostfixUnaryExpression().Operand + continue + case KindBinaryExpression: + node = node.AsBinaryExpression().Left + continue + case KindConditionalExpression: + node = node.AsConditionalExpression().Condition + continue + case KindTaggedTemplateExpression: + node = node.AsTaggedTemplateExpression().Tag + continue + case KindCallExpression: + if stopAtCallExpressions { + return node + } + fallthrough + case KindAsExpression, + KindElementAccessExpression, + KindPropertyAccessExpression, + KindNonNullExpression, + KindPartiallyEmittedExpression, + KindSatisfiesExpression: + node = node.Expression() + continue + } + return node + } +} + +type TypePrecedence int32 + +const ( + // Conditional precedence (lowest) + // + // Type[Extends]: + // ConditionalType[?Extends] + // + // ConditionalType[Extends]: + // [~Extends] UnionType `extends` Type[+Extends] `?` Type[~Extends] `:` Type[~Extends] + // + TypePrecedenceConditional TypePrecedence = iota + + // JSDoc precedence (optional and variadic types) + // + // JSDocType: + // `...`? Type `=`? + TypePrecedenceJSDoc + + // Function precedence + // + // Type[Extends]: + // ConditionalType[?Extends] + // FunctionType[?Extends] + // ConstructorType[?Extends] + // + // ConditionalType[Extends]: + // UnionType + // + // FunctionType[Extends]: + // TypeParameters? ArrowParameters `=>` Type[?Extends] + // + // ConstructorType[Extends]: + // `abstract`? TypeParameters? ArrowParameters `=>` Type[?Extends] + // + TypePrecedenceFunction + + // Union precedence + // + // UnionType: + // `|`? UnionTypeNoBar + // + // UnionTypeNoBar: + // IntersectionType + // UnionTypeNoBar `|` IntersectionType + // + TypePrecedenceUnion + + // Intersection precedence + // + // IntersectionType: + // `&`? IntersectionTypeNoAmpersand + // + // IntersectionTypeNoAmpersand: + // TypeOperator + // IntersectionTypeNoAmpersand `&` TypeOperator + // + TypePrecedenceIntersection + + // TypeOperator precedence + // + // TypeOperator: + // PostfixType + // InferType + // `keyof` TypeOperator + // `unique` TypeOperator + // `readonly` PostfixType + // + // InferType: + // `infer` BindingIdentifier + // `infer` BindingIdentifier `extends` Type[+Extends] + // + TypePrecedenceTypeOperator + + // Postfix precedence + // + // PostfixType: + // NonArrayType + // OptionalType + // ArrayType + // IndexedAccessType + // + // OptionalType: + // PostfixType `?` + // + // ArrayType: + // PostfixType `[` `]` + // + // IndexedAccessType: + // PostfixType `[` Type[~Extends] `]` + // + TypePrecedencePostfix + + // NonArray precedence (highest) + // + // NonArrayType: + // KeywordType + // LiteralType + // ThisType + // ImportType + // TypeQuery + // MappedType + // TypeLiteral + // TupleType + // ParenthesizedType + // TypePredicate + // TypeReference + // TemplateType + // + // KeywordType: one of + // `any` `unknown` `string` `number` `bigint` + // `symbol` `boolean` `undefined` `never` `object` + // `intrinsic` `void` + // + // LiteralType: + // StringLiteral + // NoSubstitutionTemplateLiteral + // NumericLiteral + // BigIntLiteral + // `-` NumericLiteral + // `-` BigIntLiteral + // `true` + // `false` + // `null` + // + // ThisType: + // `this` + // + // ImportType: + // `typeof`? `import` `(` Type[~Extends] `,`? `)` ImportTypeQualifier? TypeArguments? + // `typeof`? `import` `(` Type[~Extends] `,` ImportTypeAttributes `,`? `)` ImportTypeQualifier? TypeArguments? + // + // ImportTypeQualifier: + // `.` EntityName + // + // ImportTypeAttributes: + // `{` `with` `:` ImportAttributes `,`? `}` + // + // TypeQuery: + // + // MappedType: + // `{` MappedTypePrefix? MappedTypePropertyName MappedTypeSuffix? `:` Type[~Extends] `;` `}` + // + // MappedTypePrefix: + // `readonly` + // `+` `readonly` + // `-` `readonly` + // + // MappedTypePropertyName: + // `[` BindingIdentifier `in` Type[~Extends] `]` + // `[` BindingIdentifier `in` Type[~Extends] `as` Type[~Extends] `]` + // + // MappedTypeSuffix: + // `?` + // `+` `?` + // `-` `?` + // + // TypeLiteral: + // `{` TypeElementList `}` + // + // TypeElementList: + // [empty] + // TypeElementList TypeElement + // + // TypeElement: + // PropertySignature + // MethodSignature + // IndexSignature + // CallSignature + // ConstructSignature + // + // PropertySignature: + // PropertyName `?`? TypeAnnotation? `;` + // + // MethodSignature: + // PropertyName `?`? TypeParameters? `(` FormalParameterList `)` TypeAnnotation? `;` + // `get` PropertyName TypeParameters? `(` FormalParameterList `)` TypeAnnotation? `;` // GetAccessor + // `set` PropertyName TypeParameters? `(` FormalParameterList `)` TypeAnnotation? `;` // SetAccessor + // + // IndexSignature: + // `[` IdentifierName`]` TypeAnnotation `;` + // + // CallSignature: + // TypeParameters? `(` FormalParameterList `)` TypeAnnotation? `;` + // + // ConstructSignature: + // `new` TypeParameters? `(` FormalParameterList `)` TypeAnnotation? `;` + // + // TupleType: + // `[` `]` + // `[` NamedTupleElementTypes `,`? `]` + // `[` TupleElementTypes `,`? `]` + // + // NamedTupleElementTypes: + // NamedTupleMember + // NamedTupleElementTypes `,` NamedTupleMember + // + // NamedTupleMember: + // IdentifierName `?`? `:` Type[~Extends] + // `...` IdentifierName `:` Type[~Extends] + // + // TupleElementTypes: + // TupleElementType + // TupleElementTypes `,` TupleElementType + // + // TupleElementType: + // Type[~Extends] + // OptionalType + // RestType + // + // RestType: + // `...` Type[~Extends] + // + // ParenthesizedType: + // `(` Type[~Extends] `)` + // + // TypePredicate: + // `asserts`? TypePredicateParameterName + // `asserts`? TypePredicateParameterName `is` Type[~Extends] + // + // TypePredicateParameterName: + // `this` + // IdentifierReference + // + // TypeReference: + // EntityName TypeArguments? + // + // TemplateType: + // TemplateHead Type[~Extends] TemplateTypeSpans + // + // TemplateTypeSpans: + // TemplateTail + // TemplateTypeMiddleList TemplateTail + // + // TemplateTypeMiddleList: + // TemplateMiddle Type[~Extends] + // TemplateTypeMiddleList TemplateMiddle Type[~Extends] + // + // TypeArguments: + // `<` TypeArgumentList `,`? `>` + // + // TypeArgumentList: + // Type[~Extends] + // TypeArgumentList `,` Type[~Extends] + // + TypePrecedenceNonArray + + TypePrecedenceLowest = TypePrecedenceConditional + TypePrecedenceHighest = TypePrecedenceNonArray +) + +// Gets the precedence of a TypeNode +func GetTypeNodePrecedence(n *TypeNode) TypePrecedence { + switch n.Kind { + case KindConditionalType: + return TypePrecedenceConditional + case KindJSDocOptionalType, KindJSDocVariadicType: + return TypePrecedenceJSDoc + case KindFunctionType, KindConstructorType: + return TypePrecedenceFunction + case KindUnionType: + return TypePrecedenceUnion + case KindIntersectionType: + return TypePrecedenceIntersection + case KindTypeOperator: + return TypePrecedenceTypeOperator + case KindInferType: + if n.AsInferTypeNode().TypeParameter.AsTypeParameter().Constraint != nil { + // `infer T extends U` must be treated as FunctionType precedence as the `extends` clause eagerly consumes + // TypeNode + return TypePrecedenceFunction + } + return TypePrecedenceTypeOperator + case KindIndexedAccessType, KindArrayType, KindOptionalType: + return TypePrecedencePostfix + case KindTypeQuery: + // TypeQuery is actually a NonArrayType, but we treat it as the same + // precedence as PostfixType + return TypePrecedencePostfix + case KindAnyKeyword, + KindUnknownKeyword, + KindStringKeyword, + KindNumberKeyword, + KindBigIntKeyword, + KindSymbolKeyword, + KindBooleanKeyword, + KindUndefinedKeyword, + KindNeverKeyword, + KindObjectKeyword, + KindIntrinsicKeyword, + KindVoidKeyword, + KindJSDocAllType, + KindJSDocNullableType, + KindJSDocNonNullableType, + KindLiteralType, + KindTypePredicate, + KindTypeReference, + KindTypeLiteral, + KindTupleType, + KindRestType, + KindParenthesizedType, + KindThisType, + KindMappedType, + KindNamedTupleMember, + KindTemplateLiteralType, + KindImportType: + return TypePrecedenceNonArray + default: + panic(fmt.Sprintf("unhandled TypeNode: %v", n.Kind)) + } +} diff --git a/kitcom/internal/tsgo/ast/subtreefacts.go b/kitcom/internal/tsgo/ast/subtreefacts.go new file mode 100644 index 0000000..db0be91 --- /dev/null +++ b/kitcom/internal/tsgo/ast/subtreefacts.go @@ -0,0 +1,131 @@ +package ast + +import ( + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/core" +) + +type SubtreeFacts int32 + +const ( + // Facts + // - Flags used to indicate that a node or subtree contains syntax relevant to a specific transform + + SubtreeContainsTypeScript SubtreeFacts = 1 << iota + SubtreeContainsJsx + SubtreeContainsESDecorators + SubtreeContainsUsing + SubtreeContainsClassStaticBlocks + SubtreeContainsESClassFields + SubtreeContainsLogicalAssignments + SubtreeContainsNullishCoalescing + SubtreeContainsOptionalChaining + SubtreeContainsMissingCatchClauseVariable + SubtreeContainsESObjectRestOrSpread // subtree has a `...` somewhere inside it, never cleared + SubtreeContainsForAwaitOrAsyncGenerator + SubtreeContainsAnyAwait + SubtreeContainsExponentiationOperator + + // Markers + // - Flags used to indicate that a node or subtree contains a particular kind of syntax. + + SubtreeContainsLexicalThis + SubtreeContainsLexicalSuper + SubtreeContainsRestOrSpread // marker on any `...` - cleared on binding pattern exit + SubtreeContainsObjectRestOrSpread // marker on any `{...x}` - cleared on most scope exits + SubtreeContainsAwait + SubtreeContainsDynamicImport + SubtreeContainsClassFields + SubtreeContainsDecorators + SubtreeContainsIdentifier + + SubtreeFactsComputed // NOTE: This should always be last + SubtreeFactsNone SubtreeFacts = 0 + + // Aliases (unused, for documentation purposes only - correspond to combinations in transformers/estransforms/definitions.go) + + SubtreeContainsESNext = SubtreeContainsESDecorators | SubtreeContainsUsing + SubtreeContainsES2022 = SubtreeContainsClassStaticBlocks | SubtreeContainsESClassFields + SubtreeContainsES2021 = SubtreeContainsLogicalAssignments + SubtreeContainsES2020 = SubtreeContainsNullishCoalescing | SubtreeContainsOptionalChaining + SubtreeContainsES2019 = SubtreeContainsMissingCatchClauseVariable + SubtreeContainsES2018 = SubtreeContainsESObjectRestOrSpread | SubtreeContainsForAwaitOrAsyncGenerator + SubtreeContainsES2017 = SubtreeContainsAnyAwait + SubtreeContainsES2016 = SubtreeContainsExponentiationOperator + + // Scope Exclusions + // - Bitmasks that exclude flags from propagating out of a specific context + // into the subtree flags of their container. + + SubtreeExclusionsNode = SubtreeFactsComputed + SubtreeExclusionsEraseable = ^SubtreeContainsTypeScript + SubtreeExclusionsOuterExpression = SubtreeExclusionsNode + SubtreeExclusionsPropertyAccess = SubtreeExclusionsNode + SubtreeExclusionsElementAccess = SubtreeExclusionsNode + SubtreeExclusionsArrowFunction = SubtreeExclusionsNode | SubtreeContainsAwait | SubtreeContainsObjectRestOrSpread + SubtreeExclusionsFunction = SubtreeExclusionsNode | SubtreeContainsLexicalThis | SubtreeContainsLexicalSuper | SubtreeContainsAwait | SubtreeContainsObjectRestOrSpread + SubtreeExclusionsConstructor = SubtreeExclusionsNode | SubtreeContainsLexicalThis | SubtreeContainsLexicalSuper | SubtreeContainsAwait | SubtreeContainsObjectRestOrSpread + SubtreeExclusionsMethod = SubtreeExclusionsNode | SubtreeContainsLexicalThis | SubtreeContainsLexicalSuper | SubtreeContainsAwait | SubtreeContainsObjectRestOrSpread + SubtreeExclusionsAccessor = SubtreeExclusionsNode | SubtreeContainsLexicalThis | SubtreeContainsLexicalSuper | SubtreeContainsAwait | SubtreeContainsObjectRestOrSpread + SubtreeExclusionsProperty = SubtreeExclusionsNode | SubtreeContainsLexicalThis | SubtreeContainsLexicalSuper + SubtreeExclusionsClass = SubtreeExclusionsNode + SubtreeExclusionsModule = SubtreeExclusionsNode | SubtreeContainsLexicalThis | SubtreeContainsLexicalSuper + SubtreeExclusionsObjectLiteral = SubtreeExclusionsNode | SubtreeContainsObjectRestOrSpread + SubtreeExclusionsArrayLiteral = SubtreeExclusionsNode + SubtreeExclusionsCall = SubtreeExclusionsNode + SubtreeExclusionsNew = SubtreeExclusionsNode + SubtreeExclusionsVariableDeclarationList = SubtreeExclusionsNode | SubtreeContainsObjectRestOrSpread + SubtreeExclusionsParameter = SubtreeExclusionsNode + SubtreeExclusionsCatchClause = SubtreeExclusionsNode | SubtreeContainsObjectRestOrSpread + SubtreeExclusionsBindingPattern = SubtreeExclusionsNode | SubtreeContainsRestOrSpread + + // Masks + // - Additional bitmasks + + SubtreeContainsLexicalThisOrSuper = SubtreeContainsLexicalThis | SubtreeContainsLexicalSuper +) + +func propagateEraseableSyntaxListSubtreeFacts(children *TypeArgumentList) SubtreeFacts { + return core.IfElse(children != nil, SubtreeContainsTypeScript, SubtreeFactsNone) +} + +func propagateEraseableSyntaxSubtreeFacts(child *TypeNode) SubtreeFacts { + return core.IfElse(child != nil, SubtreeContainsTypeScript, SubtreeFactsNone) +} + +func propagateObjectBindingElementSubtreeFacts(child *BindingElementNode) SubtreeFacts { + facts := propagateSubtreeFacts(child) + if facts&SubtreeContainsRestOrSpread != 0 { + facts &= ^SubtreeContainsRestOrSpread + facts |= SubtreeContainsObjectRestOrSpread | SubtreeContainsESObjectRestOrSpread + } + return facts +} + +func propagateBindingElementSubtreeFacts(child *BindingElementNode) SubtreeFacts { + return propagateSubtreeFacts(child) & ^SubtreeContainsRestOrSpread +} + +func propagateSubtreeFacts(child *Node) SubtreeFacts { + if child == nil { + return SubtreeFactsNone + } + return child.propagateSubtreeFacts() +} + +func propagateNodeListSubtreeFacts(children *NodeList, propagate func(*Node) SubtreeFacts) SubtreeFacts { + if children == nil { + return SubtreeFactsNone + } + facts := SubtreeFactsNone + for _, child := range children.Nodes { + facts |= propagate(child) + } + return facts +} + +func propagateModifierListSubtreeFacts(children *ModifierList) SubtreeFacts { + if children == nil { + return SubtreeFactsNone + } + return propagateNodeListSubtreeFacts(&children.NodeList, propagateSubtreeFacts) +} diff --git a/kitcom/internal/tsgo/ast/symbol.go b/kitcom/internal/tsgo/ast/symbol.go new file mode 100644 index 0000000..691c628 --- /dev/null +++ b/kitcom/internal/tsgo/ast/symbol.go @@ -0,0 +1,60 @@ +package ast + +import ( + "sync/atomic" + + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/collections" +) + +// Symbol + +type Symbol struct { + Flags SymbolFlags + CheckFlags CheckFlags // Non-zero only in transient symbols created by Checker + Name string + Declarations []*Node + ValueDeclaration *Node + Members SymbolTable + Exports SymbolTable + id atomic.Uint64 + Parent *Symbol + ExportSymbol *Symbol + AssignmentDeclarationMembers collections.Set[*Node] // Set of detected assignment declarations + GlobalExports SymbolTable // Conditional global UMD exports +} + +// SymbolTable + +type SymbolTable map[string]*Symbol + +const InternalSymbolNamePrefix = "\xFE" // Invalid UTF8 sequence, will never occur as IdentifierName + +const ( + InternalSymbolNameCall = InternalSymbolNamePrefix + "call" // Call signatures + InternalSymbolNameConstructor = InternalSymbolNamePrefix + "constructor" // Constructor implementations + InternalSymbolNameNew = InternalSymbolNamePrefix + "new" // Constructor signatures + InternalSymbolNameIndex = InternalSymbolNamePrefix + "index" // Index signatures + InternalSymbolNameExportStar = InternalSymbolNamePrefix + "export" // Module export * declarations + InternalSymbolNameGlobal = InternalSymbolNamePrefix + "global" // Global self-reference + InternalSymbolNameMissing = InternalSymbolNamePrefix + "missing" // Indicates missing symbol + InternalSymbolNameType = InternalSymbolNamePrefix + "type" // Anonymous type literal symbol + InternalSymbolNameObject = InternalSymbolNamePrefix + "object" // Anonymous object literal declaration + InternalSymbolNameJSXAttributes = InternalSymbolNamePrefix + "jsxAttributes" // Anonymous JSX attributes object literal declaration + InternalSymbolNameClass = InternalSymbolNamePrefix + "class" // Unnamed class expression + InternalSymbolNameFunction = InternalSymbolNamePrefix + "function" // Unnamed function expression + InternalSymbolNameComputed = InternalSymbolNamePrefix + "computed" // Computed property name declaration with dynamic name + InternalSymbolNameResolving = InternalSymbolNamePrefix + "resolving" // Indicator symbol used to mark partially resolved type aliases + InternalSymbolNameInstantiationExpression = InternalSymbolNamePrefix + "instantiationExpression" // Instantiation expressions + InternalSymbolNameImportAttributes = InternalSymbolNamePrefix + "importAttributes" + InternalSymbolNameExportEquals = "export=" // Export assignment symbol + InternalSymbolNameDefault = "default" // Default export symbol (technically not wholly internal, but included here for usability) + InternalSymbolNameThis = "this" + InternalSymbolNameModuleExports = "module.exports" +) + +func SymbolName(symbol *Symbol) string { + if symbol.ValueDeclaration != nil && IsPrivateIdentifierClassElementDeclaration(symbol.ValueDeclaration) { + return symbol.ValueDeclaration.Name().Text() + } + return symbol.Name +} diff --git a/kitcom/internal/tsgo/ast/symbolflags.go b/kitcom/internal/tsgo/ast/symbolflags.go new file mode 100644 index 0000000..9f65726 --- /dev/null +++ b/kitcom/internal/tsgo/ast/symbolflags.go @@ -0,0 +1,86 @@ +package ast + +// SymbolFlags + +type SymbolFlags uint32 + +const ( + SymbolFlagsNone SymbolFlags = 0 + SymbolFlagsFunctionScopedVariable SymbolFlags = 1 << 0 // Variable (var) or parameter + SymbolFlagsBlockScopedVariable SymbolFlags = 1 << 1 // A block-scoped variable (let or const) + SymbolFlagsProperty SymbolFlags = 1 << 2 // Property or enum member + SymbolFlagsEnumMember SymbolFlags = 1 << 3 // Enum member + SymbolFlagsFunction SymbolFlags = 1 << 4 // Function + SymbolFlagsClass SymbolFlags = 1 << 5 // Class + SymbolFlagsInterface SymbolFlags = 1 << 6 // Interface + SymbolFlagsConstEnum SymbolFlags = 1 << 7 // Const enum + SymbolFlagsRegularEnum SymbolFlags = 1 << 8 // Enum + SymbolFlagsValueModule SymbolFlags = 1 << 9 // Instantiated module + SymbolFlagsNamespaceModule SymbolFlags = 1 << 10 // Uninstantiated module + SymbolFlagsTypeLiteral SymbolFlags = 1 << 11 // Type Literal or mapped type + SymbolFlagsObjectLiteral SymbolFlags = 1 << 12 // Object Literal + SymbolFlagsMethod SymbolFlags = 1 << 13 // Method + SymbolFlagsConstructor SymbolFlags = 1 << 14 // Constructor + SymbolFlagsGetAccessor SymbolFlags = 1 << 15 // Get accessor + SymbolFlagsSetAccessor SymbolFlags = 1 << 16 // Set accessor + SymbolFlagsSignature SymbolFlags = 1 << 17 // Call, construct, or index signature + SymbolFlagsTypeParameter SymbolFlags = 1 << 18 // Type parameter + SymbolFlagsTypeAlias SymbolFlags = 1 << 19 // Type alias + SymbolFlagsExportValue SymbolFlags = 1 << 20 // Exported value marker (see comment in declareModuleMember in binder) + SymbolFlagsAlias SymbolFlags = 1 << 21 // An alias for another symbol (see comment in isAliasSymbolDeclaration in checker) + SymbolFlagsPrototype SymbolFlags = 1 << 22 // Prototype property (no source representation) + SymbolFlagsExportStar SymbolFlags = 1 << 23 // Export * declaration + SymbolFlagsOptional SymbolFlags = 1 << 24 // Optional property + SymbolFlagsTransient SymbolFlags = 1 << 25 // Transient symbol (created during type check) + SymbolFlagsAssignment SymbolFlags = 1 << 26 // Assignment to property on function acting as declaration (eg `func.prop = 1`) + SymbolFlagsModuleExports SymbolFlags = 1 << 27 // Symbol for CommonJS `module` of `module.exports` + SymbolFlagsConstEnumOnlyModule SymbolFlags = 1 << 28 // Module contains only const enums or other modules with only const enums + SymbolFlagsReplaceableByMethod SymbolFlags = 1 << 29 + SymbolFlagsGlobalLookup SymbolFlags = 1 << 30 // Flag to signal this is a global lookup + SymbolFlagsAll SymbolFlags = 1<<30 - 1 // All flags except SymbolFlagsGlobalLookup + + SymbolFlagsEnum = SymbolFlagsRegularEnum | SymbolFlagsConstEnum + SymbolFlagsVariable = SymbolFlagsFunctionScopedVariable | SymbolFlagsBlockScopedVariable + SymbolFlagsValue = SymbolFlagsVariable | SymbolFlagsProperty | SymbolFlagsEnumMember | SymbolFlagsObjectLiteral | SymbolFlagsFunction | SymbolFlagsClass | SymbolFlagsEnum | SymbolFlagsValueModule | SymbolFlagsMethod | SymbolFlagsGetAccessor | SymbolFlagsSetAccessor + SymbolFlagsType = SymbolFlagsClass | SymbolFlagsInterface | SymbolFlagsEnum | SymbolFlagsEnumMember | SymbolFlagsTypeLiteral | SymbolFlagsTypeParameter | SymbolFlagsTypeAlias + SymbolFlagsNamespace = SymbolFlagsValueModule | SymbolFlagsNamespaceModule | SymbolFlagsEnum + SymbolFlagsModule = SymbolFlagsValueModule | SymbolFlagsNamespaceModule + SymbolFlagsAccessor = SymbolFlagsGetAccessor | SymbolFlagsSetAccessor + + // Variables can be redeclared, but can not redeclare a block-scoped declaration with the + // same name, or any other value that is not a variable, e.g. ValueModule or Class + SymbolFlagsFunctionScopedVariableExcludes = SymbolFlagsValue & ^SymbolFlagsFunctionScopedVariable + + // Block-scoped declarations are not allowed to be re-declared + // they can not merge with anything in the value space + SymbolFlagsBlockScopedVariableExcludes = SymbolFlagsValue + + SymbolFlagsParameterExcludes = SymbolFlagsValue + SymbolFlagsPropertyExcludes = SymbolFlagsValue & ^SymbolFlagsProperty + SymbolFlagsEnumMemberExcludes = SymbolFlagsValue | SymbolFlagsType + SymbolFlagsFunctionExcludes = SymbolFlagsValue & ^(SymbolFlagsFunction | SymbolFlagsValueModule | SymbolFlagsClass) + SymbolFlagsClassExcludes = (SymbolFlagsValue | SymbolFlagsType) & ^(SymbolFlagsValueModule | SymbolFlagsInterface | SymbolFlagsFunction) // class-interface mergability done in checker.ts + SymbolFlagsInterfaceExcludes = SymbolFlagsType & ^(SymbolFlagsInterface | SymbolFlagsClass) + SymbolFlagsRegularEnumExcludes = (SymbolFlagsValue | SymbolFlagsType) & ^(SymbolFlagsRegularEnum | SymbolFlagsValueModule) // regular enums merge only with regular enums and modules + SymbolFlagsConstEnumExcludes = (SymbolFlagsValue | SymbolFlagsType) & ^SymbolFlagsConstEnum // const enums merge only with const enums + SymbolFlagsValueModuleExcludes = SymbolFlagsValue & ^(SymbolFlagsFunction | SymbolFlagsClass | SymbolFlagsRegularEnum | SymbolFlagsValueModule) + SymbolFlagsNamespaceModuleExcludes = SymbolFlagsNone + SymbolFlagsMethodExcludes = SymbolFlagsValue & ^SymbolFlagsMethod + SymbolFlagsGetAccessorExcludes = SymbolFlagsValue & ^SymbolFlagsSetAccessor + SymbolFlagsSetAccessorExcludes = SymbolFlagsValue & ^SymbolFlagsGetAccessor + SymbolFlagsAccessorExcludes = SymbolFlagsValue + SymbolFlagsTypeParameterExcludes = SymbolFlagsType & ^SymbolFlagsTypeParameter + SymbolFlagsTypeAliasExcludes = SymbolFlagsType + SymbolFlagsAliasExcludes = SymbolFlagsAlias + SymbolFlagsModuleMember = SymbolFlagsVariable | SymbolFlagsFunction | SymbolFlagsClass | SymbolFlagsInterface | SymbolFlagsEnum | SymbolFlagsModule | SymbolFlagsTypeAlias | SymbolFlagsAlias + SymbolFlagsExportHasLocal = SymbolFlagsFunction | SymbolFlagsClass | SymbolFlagsEnum | SymbolFlagsValueModule + SymbolFlagsBlockScoped = SymbolFlagsBlockScopedVariable | SymbolFlagsClass | SymbolFlagsEnum + SymbolFlagsPropertyOrAccessor = SymbolFlagsProperty | SymbolFlagsAccessor + SymbolFlagsClassMember = SymbolFlagsMethod | SymbolFlagsAccessor | SymbolFlagsProperty + SymbolFlagsExportSupportsDefaultModifier = SymbolFlagsClass | SymbolFlagsFunction | SymbolFlagsInterface + SymbolFlagsExportDoesNotSupportDefaultModifier = ^SymbolFlagsExportSupportsDefaultModifier + // The set of things we consider semantically classifiable. Used to speed up the LS during + // classification. + SymbolFlagsClassifiable = SymbolFlagsClass | SymbolFlagsEnum | SymbolFlagsTypeAlias | SymbolFlagsInterface | SymbolFlagsTypeParameter | SymbolFlagsModule | SymbolFlagsAlias + SymbolFlagsLateBindingContainer = SymbolFlagsClass | SymbolFlagsInterface | SymbolFlagsTypeLiteral | SymbolFlagsObjectLiteral | SymbolFlagsFunction +) diff --git a/kitcom/internal/tsgo/ast/tokenflags.go b/kitcom/internal/tsgo/ast/tokenflags.go new file mode 100644 index 0000000..d30cf49 --- /dev/null +++ b/kitcom/internal/tsgo/ast/tokenflags.go @@ -0,0 +1,31 @@ +package ast + +type TokenFlags int32 + +const ( + TokenFlagsNone TokenFlags = 0 + TokenFlagsPrecedingLineBreak TokenFlags = 1 << 0 + TokenFlagsPrecedingJSDocComment TokenFlags = 1 << 1 + TokenFlagsUnterminated TokenFlags = 1 << 2 + TokenFlagsExtendedUnicodeEscape TokenFlags = 1 << 3 // e.g. `\u{10ffff}` + TokenFlagsScientific TokenFlags = 1 << 4 // e.g. `10e2` + TokenFlagsOctal TokenFlags = 1 << 5 // e.g. `0777` + TokenFlagsHexSpecifier TokenFlags = 1 << 6 // e.g. `0x00000000` + TokenFlagsBinarySpecifier TokenFlags = 1 << 7 // e.g. `0b0110010000000000` + TokenFlagsOctalSpecifier TokenFlags = 1 << 8 // e.g. `0o777` + TokenFlagsContainsSeparator TokenFlags = 1 << 9 // e.g. `0b1100_0101` + TokenFlagsUnicodeEscape TokenFlags = 1 << 10 // e.g. `\u00a0` + TokenFlagsContainsInvalidEscape TokenFlags = 1 << 11 // e.g. `\uhello` + TokenFlagsHexEscape TokenFlags = 1 << 12 // e.g. `\xa0` + TokenFlagsContainsLeadingZero TokenFlags = 1 << 13 // e.g. `0888` + TokenFlagsContainsInvalidSeparator TokenFlags = 1 << 14 // e.g. `0_1` + TokenFlagsPrecedingJSDocLeadingAsterisks TokenFlags = 1 << 15 + TokenFlagsSingleQuote TokenFlags = 1 << 16 // e.g. `'abc'` + TokenFlagsBinaryOrOctalSpecifier TokenFlags = TokenFlagsBinarySpecifier | TokenFlagsOctalSpecifier + TokenFlagsWithSpecifier TokenFlags = TokenFlagsHexSpecifier | TokenFlagsBinaryOrOctalSpecifier + TokenFlagsStringLiteralFlags TokenFlags = TokenFlagsUnterminated | TokenFlagsHexEscape | TokenFlagsUnicodeEscape | TokenFlagsExtendedUnicodeEscape | TokenFlagsContainsInvalidEscape | TokenFlagsSingleQuote + TokenFlagsNumericLiteralFlags TokenFlags = TokenFlagsScientific | TokenFlagsOctal | TokenFlagsContainsLeadingZero | TokenFlagsWithSpecifier | TokenFlagsContainsSeparator | TokenFlagsContainsInvalidSeparator + TokenFlagsTemplateLiteralLikeFlags TokenFlags = TokenFlagsUnterminated | TokenFlagsHexEscape | TokenFlagsUnicodeEscape | TokenFlagsExtendedUnicodeEscape | TokenFlagsContainsInvalidEscape + TokenFlagsRegularExpressionLiteralFlags TokenFlags = TokenFlagsUnterminated + TokenFlagsIsInvalid TokenFlags = TokenFlagsOctal | TokenFlagsContainsLeadingZero | TokenFlagsContainsInvalidSeparator | TokenFlagsContainsInvalidEscape +) diff --git a/kitcom/internal/tsgo/ast/utilities.go b/kitcom/internal/tsgo/ast/utilities.go new file mode 100644 index 0000000..94cc458 --- /dev/null +++ b/kitcom/internal/tsgo/ast/utilities.go @@ -0,0 +1,3892 @@ +package ast + +import ( + "fmt" + "slices" + "strings" + "sync" + "sync/atomic" + + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/core" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/debug" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/tspath" +) + +// Atomic ids + +var ( + nextNodeId atomic.Uint64 + nextSymbolId atomic.Uint64 +) + +func GetNodeId(node *Node) NodeId { + id := node.id.Load() + if id == 0 { + // Worst case, we burn a few ids if we have to CAS. + id = nextNodeId.Add(1) + if !node.id.CompareAndSwap(0, id) { + id = node.id.Load() + } + } + return NodeId(id) +} + +func GetSymbolId(symbol *Symbol) SymbolId { + id := symbol.id.Load() + if id == 0 { + // Worst case, we burn a few ids if we have to CAS. + id = nextSymbolId.Add(1) + if !symbol.id.CompareAndSwap(0, id) { + id = symbol.id.Load() + } + } + return SymbolId(id) +} + +func GetSymbolTable(data *SymbolTable) SymbolTable { + if *data == nil { + *data = make(SymbolTable) + } + return *data +} + +func GetMembers(symbol *Symbol) SymbolTable { + return GetSymbolTable(&symbol.Members) +} + +func GetExports(symbol *Symbol) SymbolTable { + return GetSymbolTable(&symbol.Exports) +} + +func GetLocals(container *Node) SymbolTable { + return GetSymbolTable(&container.LocalsContainerData().Locals) +} + +// Determines if a node is missing (either `nil` or empty) +func NodeIsMissing(node *Node) bool { + return node == nil || node.Loc.Pos() == node.Loc.End() && node.Loc.Pos() >= 0 && node.Kind != KindEndOfFile +} + +// Determines if a node is present +func NodeIsPresent(node *Node) bool { + return !NodeIsMissing(node) +} + +// Determines if a node contains synthetic positions +func NodeIsSynthesized(node *Node) bool { + return PositionIsSynthesized(node.Loc.Pos()) || PositionIsSynthesized(node.Loc.End()) +} + +func RangeIsSynthesized(loc core.TextRange) bool { + return PositionIsSynthesized(loc.Pos()) || PositionIsSynthesized(loc.End()) +} + +// Determines whether a position is synthetic +func PositionIsSynthesized(pos int) bool { + return pos < 0 +} + +func FindLastVisibleNode(nodes []*Node) *Node { + fromEnd := 1 + for fromEnd <= len(nodes) && nodes[len(nodes)-fromEnd].Flags&NodeFlagsReparsed != 0 { + fromEnd++ + } + if fromEnd <= len(nodes) { + return nodes[len(nodes)-fromEnd] + } + return nil +} + +func NodeKindIs(node *Node, kinds ...Kind) bool { + return slices.Contains(kinds, node.Kind) +} + +func IsModifierKind(token Kind) bool { + switch token { + case KindAbstractKeyword, + KindAccessorKeyword, + KindAsyncKeyword, + KindConstKeyword, + KindDeclareKeyword, + KindDefaultKeyword, + KindExportKeyword, + KindInKeyword, + KindPublicKeyword, + KindPrivateKeyword, + KindProtectedKeyword, + KindReadonlyKeyword, + KindStaticKeyword, + KindOutKeyword, + KindOverrideKeyword: + return true + } + return false +} + +func IsModifier(node *Node) bool { + return IsModifierKind(node.Kind) +} + +func IsModifierLike(node *Node) bool { + return IsModifier(node) || IsDecorator(node) +} + +func IsKeywordKind(token Kind) bool { + return KindFirstKeyword <= token && token <= KindLastKeyword +} + +func IsPunctuationKind(token Kind) bool { + return KindFirstPunctuation <= token && token <= KindLastPunctuation +} + +func IsAssignmentOperator(token Kind) bool { + return token >= KindFirstAssignment && token <= KindLastAssignment +} + +func IsAssignmentExpression(node *Node, excludeCompoundAssignment bool) bool { + if node.Kind == KindBinaryExpression { + expr := node.AsBinaryExpression() + return (expr.OperatorToken.Kind == KindEqualsToken || !excludeCompoundAssignment && IsAssignmentOperator(expr.OperatorToken.Kind)) && + IsLeftHandSideExpression(expr.Left) + } + return false +} + +func GetRightMostAssignedExpression(node *Node) *Node { + for IsAssignmentExpression(node, true /*excludeCompoundAssignment*/) { + node = node.AsBinaryExpression().Right + } + return node +} + +func IsDestructuringAssignment(node *Node) bool { + if IsAssignmentExpression(node, true /*excludeCompoundAssignment*/) { + kind := node.AsBinaryExpression().Left.Kind + return kind == KindObjectLiteralExpression || kind == KindArrayLiteralExpression + } + return false +} + +// A node is an assignment target if it is on the left hand side of an '=' token, if it is parented by a property +// assignment in an object literal that is an assignment target, or if it is parented by an array literal that is +// an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ a }] = xxx'. +// (Note that `p` is not a target in the above examples, only `a`.) +func IsAssignmentTarget(node *Node) bool { + return GetAssignmentTarget(node) != nil +} + +// Returns the BinaryExpression, PrefixUnaryExpression, PostfixUnaryExpression, or ForInOrOfStatement that references +// the given node as an assignment target +func GetAssignmentTarget(node *Node) *Node { + for { + parent := node.Parent + switch parent.Kind { + case KindBinaryExpression: + if IsAssignmentOperator(parent.AsBinaryExpression().OperatorToken.Kind) && parent.AsBinaryExpression().Left == node { + return parent + } + return nil + case KindPrefixUnaryExpression: + if parent.AsPrefixUnaryExpression().Operator == KindPlusPlusToken || parent.AsPrefixUnaryExpression().Operator == KindMinusMinusToken { + return parent + } + return nil + case KindPostfixUnaryExpression: + if parent.AsPostfixUnaryExpression().Operator == KindPlusPlusToken || parent.AsPostfixUnaryExpression().Operator == KindMinusMinusToken { + return parent + } + return nil + case KindForInStatement, KindForOfStatement: + if parent.AsForInOrOfStatement().Initializer == node { + return parent + } + return nil + case KindParenthesizedExpression, KindArrayLiteralExpression, KindSpreadElement, KindNonNullExpression: + node = parent + case KindSpreadAssignment: + node = parent.Parent + case KindShorthandPropertyAssignment: + if parent.AsShorthandPropertyAssignment().Name() != node { + return nil + } + node = parent.Parent + case KindPropertyAssignment: + if parent.AsPropertyAssignment().Name() == node { + return nil + } + node = parent.Parent + default: + return nil + } + } +} + +func IsLogicalBinaryOperator(token Kind) bool { + return token == KindBarBarToken || token == KindAmpersandAmpersandToken +} + +func IsLogicalOrCoalescingBinaryOperator(token Kind) bool { + return IsLogicalBinaryOperator(token) || token == KindQuestionQuestionToken +} + +func IsLogicalOrCoalescingBinaryExpression(expr *Node) bool { + return IsBinaryExpression(expr) && IsLogicalOrCoalescingBinaryOperator(expr.AsBinaryExpression().OperatorToken.Kind) +} + +func IsLogicalOrCoalescingAssignmentOperator(token Kind) bool { + return token == KindBarBarEqualsToken || token == KindAmpersandAmpersandEqualsToken || token == KindQuestionQuestionEqualsToken +} + +func IsLogicalOrCoalescingAssignmentExpression(expr *Node) bool { + return IsBinaryExpression(expr) && IsLogicalOrCoalescingAssignmentOperator(expr.AsBinaryExpression().OperatorToken.Kind) +} + +func IsLogicalExpression(node *Node) bool { + for { + if node.Kind == KindParenthesizedExpression { + node = node.AsParenthesizedExpression().Expression + } else if node.Kind == KindPrefixUnaryExpression && node.AsPrefixUnaryExpression().Operator == KindExclamationToken { + node = node.AsPrefixUnaryExpression().Operand + } else { + return IsLogicalOrCoalescingBinaryExpression(node) + } + } +} + +func IsTokenKind(token Kind) bool { + return KindFirstToken <= token && token <= KindLastToken +} + +func IsAccessor(node *Node) bool { + return node.Kind == KindGetAccessor || node.Kind == KindSetAccessor +} + +func IsPropertyNameLiteral(node *Node) bool { + switch node.Kind { + case KindIdentifier, + KindStringLiteral, + KindNoSubstitutionTemplateLiteral, + KindNumericLiteral: + return true + } + return false +} + +func IsMemberName(node *Node) bool { + return node.Kind == KindIdentifier || node.Kind == KindPrivateIdentifier +} + +func IsEntityName(node *Node) bool { + return node.Kind == KindIdentifier || node.Kind == KindQualifiedName +} + +func IsPropertyName(node *Node) bool { + switch node.Kind { + case KindIdentifier, + KindPrivateIdentifier, + KindStringLiteral, + KindNumericLiteral, + KindComputedPropertyName: + return true + } + return false +} + +// Return true if the given identifier is classified as an IdentifierName by inspecting the parent of the node +func IsIdentifierName(node *Node) bool { + parent := node.Parent + switch parent.Kind { + case KindPropertyDeclaration, KindPropertySignature, KindMethodDeclaration, KindMethodSignature, KindGetAccessor, + KindSetAccessor, KindEnumMember, KindPropertyAssignment, KindPropertyAccessExpression: + return parent.Name() == node + case KindQualifiedName: + return parent.AsQualifiedName().Right == node + case KindBindingElement: + return parent.AsBindingElement().PropertyName == node + case KindImportSpecifier: + return parent.AsImportSpecifier().PropertyName == node + case KindExportSpecifier, KindJsxAttribute, KindJsxSelfClosingElement, KindJsxOpeningElement, KindJsxClosingElement: + return true + } + return false +} + +func IsPushOrUnshiftIdentifier(node *Node) bool { + text := node.Text() + return text == "push" || text == "unshift" +} + +func IsBooleanLiteral(node *Node) bool { + return node.Kind == KindTrueKeyword || node.Kind == KindFalseKeyword +} + +func IsLiteralKind(kind Kind) bool { + return KindFirstLiteralToken <= kind && kind <= KindLastLiteralToken +} + +func IsLiteralExpression(node *Node) bool { + return IsLiteralKind(node.Kind) +} + +func IsStringLiteralLike(node *Node) bool { + switch node.Kind { + case KindStringLiteral, KindNoSubstitutionTemplateLiteral: + return true + } + return false +} + +func IsStringOrNumericLiteralLike(node *Node) bool { + return IsStringLiteralLike(node) || IsNumericLiteral(node) +} + +func IsSignedNumericLiteral(node *Node) bool { + if node.Kind == KindPrefixUnaryExpression { + node := node.AsPrefixUnaryExpression() + return (node.Operator == KindPlusToken || node.Operator == KindMinusToken) && IsNumericLiteral(node.Operand) + } + return false +} + +// Determines if a node is part of an OptionalChain +func IsOptionalChain(node *Node) bool { + if node.Flags&NodeFlagsOptionalChain != 0 { + switch node.Kind { + case KindPropertyAccessExpression, + KindElementAccessExpression, + KindCallExpression, + KindNonNullExpression: + return true + } + } + return false +} + +func getQuestionDotToken(node *Expression) *TokenNode { + switch node.Kind { + case KindPropertyAccessExpression: + return node.AsPropertyAccessExpression().QuestionDotToken + case KindElementAccessExpression: + return node.AsElementAccessExpression().QuestionDotToken + case KindCallExpression: + return node.AsCallExpression().QuestionDotToken + } + panic("Unhandled case in getQuestionDotToken") +} + +// Determines if node is the root expression of an OptionalChain +func IsOptionalChainRoot(node *Expression) bool { + return IsOptionalChain(node) && !IsNonNullExpression(node) && getQuestionDotToken(node) != nil +} + +// Determines whether a node is the outermost `OptionalChain` in an ECMAScript `OptionalExpression`: +// +// 1. For `a?.b.c`, the outermost chain is `a?.b.c` (`c` is the end of the chain starting at `a?.`) +// 2. For `a?.b!`, the outermost chain is `a?.b` (`b` is the end of the chain starting at `a?.`) +// 3. For `(a?.b.c).d`, the outermost chain is `a?.b.c` (`c` is the end of the chain starting at `a?.` since parens end the chain) +// 4. For `a?.b.c?.d`, both `a?.b.c` and `a?.b.c?.d` are outermost (`c` is the end of the chain starting at `a?.`, and `d` is +// the end of the chain starting at `c?.`) +// 5. For `a?.(b?.c).d`, both `b?.c` and `a?.(b?.c)d` are outermost (`c` is the end of the chain starting at `b`, and `d` is +// the end of the chain starting at `a?.`) +func IsOutermostOptionalChain(node *Expression) bool { + parent := node.Parent + return !IsOptionalChain(parent) || // cases 1, 2, and 3 + IsOptionalChainRoot(parent) || // case 4 + node != parent.Expression() // case 5 +} + +// Determines whether a node is the expression preceding an optional chain (i.e. `a` in `a?.b`). +func IsExpressionOfOptionalChainRoot(node *Node) bool { + return IsOptionalChainRoot(node.Parent) && node.Parent.Expression() == node +} + +func IsNullishCoalesce(node *Node) bool { + return node.Kind == KindBinaryExpression && node.AsBinaryExpression().OperatorToken.Kind == KindQuestionQuestionToken +} + +func IsAssertionExpression(node *Node) bool { + kind := node.Kind + return kind == KindTypeAssertionExpression || kind == KindAsExpression +} + +func isLeftHandSideExpressionKind(kind Kind) bool { + switch kind { + case KindPropertyAccessExpression, KindElementAccessExpression, KindNewExpression, KindCallExpression, + KindJsxElement, KindJsxSelfClosingElement, KindJsxFragment, KindTaggedTemplateExpression, KindArrayLiteralExpression, + KindParenthesizedExpression, KindObjectLiteralExpression, KindClassExpression, KindFunctionExpression, KindIdentifier, + KindPrivateIdentifier, KindRegularExpressionLiteral, KindNumericLiteral, KindBigIntLiteral, KindStringLiteral, + KindNoSubstitutionTemplateLiteral, KindTemplateExpression, KindFalseKeyword, KindNullKeyword, KindThisKeyword, + KindTrueKeyword, KindSuperKeyword, KindNonNullExpression, KindExpressionWithTypeArguments, KindMetaProperty, + KindImportKeyword, KindMissingDeclaration: + return true + } + return false +} + +// Determines whether a node is a LeftHandSideExpression based only on its kind. +func IsLeftHandSideExpression(node *Node) bool { + return isLeftHandSideExpressionKind(node.Kind) +} + +func isUnaryExpressionKind(kind Kind) bool { + switch kind { + case KindPrefixUnaryExpression, + KindPostfixUnaryExpression, + KindDeleteExpression, + KindTypeOfExpression, + KindVoidExpression, + KindAwaitExpression, + KindTypeAssertionExpression: + return true + } + return isLeftHandSideExpressionKind(kind) +} + +// Determines whether a node is a UnaryExpression based only on its kind. +func IsUnaryExpression(node *Node) bool { + return isUnaryExpressionKind(node.Kind) +} + +func isExpressionKind(kind Kind) bool { + switch kind { + case KindConditionalExpression, + KindYieldExpression, + KindArrowFunction, + KindBinaryExpression, + KindSpreadElement, + KindAsExpression, + KindOmittedExpression, + KindCommaListExpression, + KindPartiallyEmittedExpression, + KindSatisfiesExpression: + return true + } + return isUnaryExpressionKind(kind) +} + +// Determines whether a node is an expression based only on its kind. +func IsExpression(node *Node) bool { + return isExpressionKind(node.Kind) +} + +func IsCommaExpression(node *Node) bool { + return node.Kind == KindBinaryExpression && node.AsBinaryExpression().OperatorToken.Kind == KindCommaToken +} + +func IsCommaSequence(node *Node) bool { + // !!! + // New compiler just has binary expressinons. + // Maybe this should consider KindCommaListExpression even though we don't generate them. + return IsCommaExpression(node) +} + +func IsIterationStatement(node *Node, lookInLabeledStatements bool) bool { + switch node.Kind { + case KindForStatement, + KindForInStatement, + KindForOfStatement, + KindDoStatement, + KindWhileStatement: + return true + case KindLabeledStatement: + return lookInLabeledStatements && IsIterationStatement((node.AsLabeledStatement()).Statement, lookInLabeledStatements) + } + + return false +} + +// Determines if a node is a property or element access expression +func IsAccessExpression(node *Node) bool { + return node.Kind == KindPropertyAccessExpression || node.Kind == KindElementAccessExpression +} + +func isFunctionLikeDeclarationKind(kind Kind) bool { + switch kind { + case KindFunctionDeclaration, + KindMethodDeclaration, + KindConstructor, + KindGetAccessor, + KindSetAccessor, + KindFunctionExpression, + KindArrowFunction: + return true + } + return false +} + +// Determines if a node is function-like (but is not a signature declaration) +func IsFunctionLikeDeclaration(node *Node) bool { + // TODO(rbuckton): Move `node != nil` test to call sites + return node != nil && isFunctionLikeDeclarationKind(node.Kind) +} + +func IsFunctionLikeKind(kind Kind) bool { + switch kind { + case KindMethodSignature, + KindCallSignature, + KindJSDocSignature, + KindConstructSignature, + KindIndexSignature, + KindFunctionType, + KindConstructorType: + return true + } + return isFunctionLikeDeclarationKind(kind) +} + +// Determines if a node is function- or signature-like. +func IsFunctionLike(node *Node) bool { + // TODO(rbuckton): Move `node != nil` test to call sites + return node != nil && IsFunctionLikeKind(node.Kind) +} + +func IsFunctionLikeOrClassStaticBlockDeclaration(node *Node) bool { + return node != nil && (IsFunctionLike(node) || IsClassStaticBlockDeclaration(node)) +} + +func IsFunctionOrSourceFile(node *Node) bool { + return IsFunctionLike(node) || IsSourceFile(node) +} + +func IsClassLike(node *Node) bool { + return node.Kind == KindClassDeclaration || node.Kind == KindClassExpression +} + +func IsClassOrInterfaceLike(node *Node) bool { + return node.Kind == KindClassDeclaration || node.Kind == KindClassExpression || node.Kind == KindInterfaceDeclaration +} + +func IsClassElement(node *Node) bool { + switch node.Kind { + case KindConstructor, + KindPropertyDeclaration, + KindMethodDeclaration, + KindGetAccessor, + KindSetAccessor, + KindIndexSignature, + KindClassStaticBlockDeclaration, + KindSemicolonClassElement: + return true + } + return false +} + +func isMethodOrAccessor(node *Node) bool { + switch node.Kind { + case KindMethodDeclaration, KindGetAccessor, KindSetAccessor: + return true + } + return false +} + +func IsPrivateIdentifierClassElementDeclaration(node *Node) bool { + return (IsPropertyDeclaration(node) || isMethodOrAccessor(node)) && IsPrivateIdentifier(node.Name()) +} + +func IsObjectLiteralOrClassExpressionMethodOrAccessor(node *Node) bool { + kind := node.Kind + return (kind == KindMethodDeclaration || kind == KindGetAccessor || kind == KindSetAccessor) && + (node.Parent.Kind == KindObjectLiteralExpression || node.Parent.Kind == KindClassExpression) +} + +func IsTypeElement(node *Node) bool { + switch node.Kind { + case KindConstructSignature, + KindCallSignature, + KindPropertySignature, + KindMethodSignature, + KindIndexSignature, + KindGetAccessor, + KindSetAccessor, + KindNotEmittedTypeElement: + return true + } + return false +} + +func IsObjectLiteralElement(node *Node) bool { + switch node.Kind { + case KindPropertyAssignment, + KindShorthandPropertyAssignment, + KindSpreadAssignment, + KindMethodDeclaration, + KindGetAccessor, + KindSetAccessor: + return true + } + return false +} + +func IsObjectLiteralMethod(node *Node) bool { + return node != nil && node.Kind == KindMethodDeclaration && node.Parent.Kind == KindObjectLiteralExpression +} + +func IsAutoAccessorPropertyDeclaration(node *Node) bool { + return IsPropertyDeclaration(node) && HasAccessorModifier(node) +} + +func IsParameterPropertyDeclaration(node *Node, parent *Node) bool { + return IsParameter(node) && HasSyntacticModifier(node, ModifierFlagsParameterPropertyModifier) && parent.Kind == KindConstructor +} + +func IsJsxChild(node *Node) bool { + switch node.Kind { + case KindJsxElement, + KindJsxExpression, + KindJsxSelfClosingElement, + KindJsxText, + KindJsxFragment: + return true + } + return false +} + +func IsJsxAttributeLike(node *Node) bool { + return IsJsxAttribute(node) || IsJsxSpreadAttribute(node) +} + +func isDeclarationStatementKind(kind Kind) bool { + switch kind { + case KindFunctionDeclaration, + KindMissingDeclaration, + KindClassDeclaration, + KindInterfaceDeclaration, + KindTypeAliasDeclaration, + KindJSTypeAliasDeclaration, + KindEnumDeclaration, + KindModuleDeclaration, + KindImportDeclaration, + KindJSImportDeclaration, + KindImportEqualsDeclaration, + KindExportDeclaration, + KindExportAssignment, + KindJSExportAssignment, + KindCommonJSExport, + KindNamespaceExportDeclaration: + return true + } + return false +} + +// Determines whether a node is a DeclarationStatement. Ideally this does not use Parent pointers, but it may use them +// to rule out a Block node that is part of `try` or `catch` or is the Block-like body of a function. +// +// NOTE: ECMA262 would just call this a Declaration +func IsDeclarationStatement(node *Node) bool { + return isDeclarationStatementKind(node.Kind) +} + +func isStatementKindButNotDeclarationKind(kind Kind) bool { + switch kind { + case KindBreakStatement, + KindContinueStatement, + KindDebuggerStatement, + KindDoStatement, + KindExpressionStatement, + KindEmptyStatement, + KindForInStatement, + KindForOfStatement, + KindForStatement, + KindIfStatement, + KindLabeledStatement, + KindReturnStatement, + KindSwitchStatement, + KindThrowStatement, + KindTryStatement, + KindVariableStatement, + KindWhileStatement, + KindWithStatement, + KindNotEmittedStatement: + return true + } + return false +} + +// Determines whether a node is a Statement that is not also a Declaration. Ideally this does not use Parent pointers, +// but it may use them to rule out a Block node that is part of `try` or `catch` or is the Block-like body of a function. +// +// NOTE: ECMA262 would just call this a Statement +func IsStatementButNotDeclaration(node *Node) bool { + return isStatementKindButNotDeclarationKind(node.Kind) +} + +// Determines whether a node is a Statement. Ideally this does not use Parent pointers, but it may use +// them to rule out a Block node that is part of `try` or `catch` or is the Block-like body of a function. +// +// NOTE: ECMA262 would call this either a StatementListItem or ModuleListItem +func IsStatement(node *Node) bool { + kind := node.Kind + return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) || isBlockStatement(node) +} + +// Determines whether a node is a BlockStatement. If parents are available, this ensures the Block is +// not part of a `try` statement, `catch` clause, or the Block-like body of a function +func isBlockStatement(node *Node) bool { + if node.Kind != KindBlock { + return false + } + if node.Parent != nil && (node.Parent.Kind == KindTryStatement || node.Parent.Kind == KindCatchClause) { + return false + } + return !IsFunctionBlock(node) +} + +// Determines whether a node is the Block-like body of a function by walking the parent of the node +func IsFunctionBlock(node *Node) bool { + return node != nil && node.Kind == KindBlock && node.Parent != nil && IsFunctionLike(node.Parent) +} + +func GetStatementsOfBlock(block *Node) *StatementList { + switch block.Kind { + case KindBlock: + return block.AsBlock().Statements + case KindModuleBlock: + return block.AsModuleBlock().Statements + case KindSourceFile: + return block.AsSourceFile().Statements + } + panic("Unhandled case in getStatementsOfBlock") +} + +func IsBlockOrCatchScoped(declaration *Node) bool { + return GetCombinedNodeFlags(declaration)&NodeFlagsBlockScoped != 0 || IsCatchClauseVariableDeclarationOrBindingElement(declaration) +} + +func IsCatchClauseVariableDeclarationOrBindingElement(declaration *Node) bool { + node := GetRootDeclaration(declaration) + return node.Kind == KindVariableDeclaration && node.Parent.Kind == KindCatchClause +} + +func IsTypeNodeKind(kind Kind) bool { + switch kind { + case KindAnyKeyword, + KindUnknownKeyword, + KindNumberKeyword, + KindBigIntKeyword, + KindObjectKeyword, + KindBooleanKeyword, + KindStringKeyword, + KindSymbolKeyword, + KindVoidKeyword, + KindUndefinedKeyword, + KindNeverKeyword, + KindIntrinsicKeyword, + KindExpressionWithTypeArguments, + KindJSDocAllType, + KindJSDocNullableType, + KindJSDocNonNullableType, + KindJSDocOptionalType, + KindJSDocVariadicType: + return true + } + return kind >= KindFirstTypeNode && kind <= KindLastTypeNode +} + +func IsTypeNode(node *Node) bool { + return IsTypeNodeKind(node.Kind) +} + +func IsJSDocKind(kind Kind) bool { + return KindFirstJSDocNode <= kind && kind <= KindLastJSDocNode +} + +func isJSDocTypeAssertion(_ *Node) bool { + return false // !!! +} + +func IsPrologueDirective(node *Node) bool { + return node.Kind == KindExpressionStatement && + node.AsExpressionStatement().Expression.Kind == KindStringLiteral +} + +type OuterExpressionKinds int16 + +const ( + OEKParentheses OuterExpressionKinds = 1 << 0 + OEKTypeAssertions OuterExpressionKinds = 1 << 1 + OEKNonNullAssertions OuterExpressionKinds = 1 << 2 + OEKPartiallyEmittedExpressions OuterExpressionKinds = 1 << 3 + OEKExpressionsWithTypeArguments OuterExpressionKinds = 1 << 4 + OEKSatisfies OuterExpressionKinds = 1 << 5 + OEKExcludeJSDocTypeAssertion = 1 << 6 + OEKAssertions = OEKTypeAssertions | OEKNonNullAssertions | OEKSatisfies + OEKAll = OEKParentheses | OEKAssertions | OEKPartiallyEmittedExpressions | OEKExpressionsWithTypeArguments +) + +// Determines whether node is an "outer expression" of the provided kinds +func IsOuterExpression(node *Expression, kinds OuterExpressionKinds) bool { + switch node.Kind { + case KindParenthesizedExpression: + return kinds&OEKParentheses != 0 && !(kinds&OEKExcludeJSDocTypeAssertion != 0 && isJSDocTypeAssertion(node)) + case KindTypeAssertionExpression, KindAsExpression: + return kinds&OEKTypeAssertions != 0 + case KindSatisfiesExpression: + return kinds&(OEKExpressionsWithTypeArguments|OEKSatisfies) != 0 + case KindExpressionWithTypeArguments: + return kinds&OEKExpressionsWithTypeArguments != 0 + case KindNonNullExpression: + return kinds&OEKNonNullAssertions != 0 + case KindPartiallyEmittedExpression: + return kinds&OEKPartiallyEmittedExpressions != 0 + } + return false +} + +// Descends into an expression, skipping past "outer expressions" of the provided kinds +func SkipOuterExpressions(node *Expression, kinds OuterExpressionKinds) *Expression { + for IsOuterExpression(node, kinds) { + node = node.Expression() + } + return node +} + +// Skips past the parentheses of an expression +func SkipParentheses(node *Expression) *Expression { + return SkipOuterExpressions(node, OEKParentheses) +} + +func SkipTypeParentheses(node *Node) *Node { + for IsParenthesizedTypeNode(node) { + node = node.AsParenthesizedTypeNode().Type + } + return node +} + +func SkipPartiallyEmittedExpressions(node *Expression) *Expression { + return SkipOuterExpressions(node, OEKPartiallyEmittedExpressions) +} + +// Walks up the parents of a parenthesized expression to find the containing node +func WalkUpParenthesizedExpressions(node *Expression) *Node { + for node != nil && node.Kind == KindParenthesizedExpression { + node = node.Parent + } + return node +} + +// Walks up the parents of a parenthesized type to find the containing node +func WalkUpParenthesizedTypes(node *TypeNode) *Node { + for node != nil && node.Kind == KindParenthesizedType { + node = node.Parent + } + return node +} + +// Walks up the parents of a node to find the containing SourceFile +func GetSourceFileOfNode(node *Node) *SourceFile { + for node != nil { + if node.Kind == KindSourceFile { + return node.AsSourceFile() + } + node = node.Parent + } + return nil +} + +var setParentInChildrenPool = sync.Pool{ + New: func() any { + return newParentInChildrenSetter() + }, +} + +func newParentInChildrenSetter() func(node *Node) bool { + // Consolidate state into one allocation. + // Similar to https://go.dev/cl/552375. + var state struct { + parent *Node + visit func(*Node) bool + } + + state.visit = func(node *Node) bool { + if state.parent != nil { + node.Parent = state.parent + } + saveParent := state.parent + state.parent = node + node.ForEachChild(state.visit) + state.parent = saveParent + return false + } + + return state.visit +} + +func SetParentInChildren(node *Node) { + fn := setParentInChildrenPool.Get().(func(node *Node) bool) + defer setParentInChildrenPool.Put(fn) + fn(node) +} + +// This should never be called outside the parser +func SetImportsOfSourceFile(node *SourceFile, imports []*LiteralLikeNode) { + node.imports = imports +} + +// Walks up the parents of a node to find the ancestor that matches the callback +func FindAncestor(node *Node, callback func(*Node) bool) *Node { + for node != nil { + if callback(node) { + return node + } + node = node.Parent + } + return nil +} + +// Walks up the parents of a node to find the ancestor that matches the kind +func FindAncestorKind(node *Node, kind Kind) *Node { + for node != nil { + if node.Kind == kind { + return node + } + node = node.Parent + } + return nil +} + +type FindAncestorResult int32 + +const ( + FindAncestorFalse FindAncestorResult = iota + FindAncestorTrue + FindAncestorQuit +) + +func ToFindAncestorResult(b bool) FindAncestorResult { + if b { + return FindAncestorTrue + } + return FindAncestorFalse +} + +// Walks up the parents of a node to find the ancestor that matches the callback +func FindAncestorOrQuit(node *Node, callback func(*Node) FindAncestorResult) *Node { + for node != nil { + switch callback(node) { + case FindAncestorQuit: + return nil + case FindAncestorTrue: + return node + } + node = node.Parent + } + return nil +} + +func IsNodeDescendantOf(node *Node, ancestor *Node) bool { + for node != nil { + if node == ancestor { + return true + } + node = node.Parent + } + return false +} + +func ModifierToFlag(token Kind) ModifierFlags { + switch token { + case KindStaticKeyword: + return ModifierFlagsStatic + case KindPublicKeyword: + return ModifierFlagsPublic + case KindProtectedKeyword: + return ModifierFlagsProtected + case KindPrivateKeyword: + return ModifierFlagsPrivate + case KindAbstractKeyword: + return ModifierFlagsAbstract + case KindAccessorKeyword: + return ModifierFlagsAccessor + case KindExportKeyword: + return ModifierFlagsExport + case KindDeclareKeyword: + return ModifierFlagsAmbient + case KindConstKeyword: + return ModifierFlagsConst + case KindDefaultKeyword: + return ModifierFlagsDefault + case KindAsyncKeyword: + return ModifierFlagsAsync + case KindReadonlyKeyword: + return ModifierFlagsReadonly + case KindOverrideKeyword: + return ModifierFlagsOverride + case KindInKeyword: + return ModifierFlagsIn + case KindOutKeyword: + return ModifierFlagsOut + case KindDecorator: + return ModifierFlagsDecorator + } + return ModifierFlagsNone +} + +func ModifiersToFlags(modifiers []*Node) ModifierFlags { + var flags ModifierFlags + for _, modifier := range modifiers { + flags |= ModifierToFlag(modifier.Kind) + } + return flags +} + +func HasSyntacticModifier(node *Node, flags ModifierFlags) bool { + return node.ModifierFlags()&flags != 0 +} + +func HasAccessorModifier(node *Node) bool { + return HasSyntacticModifier(node, ModifierFlagsAccessor) +} + +func HasStaticModifier(node *Node) bool { + return HasSyntacticModifier(node, ModifierFlagsStatic) +} + +func IsStatic(node *Node) bool { + // https://tc39.es/ecma262/#sec-static-semantics-isstatic + return IsClassElement(node) && HasStaticModifier(node) || IsClassStaticBlockDeclaration(node) +} + +func CanHaveSymbol(node *Node) bool { + switch node.Kind { + case KindArrowFunction, KindBinaryExpression, KindBindingElement, KindCallExpression, KindCallSignature, + KindClassDeclaration, KindClassExpression, KindClassStaticBlockDeclaration, KindConstructor, KindConstructorType, + KindConstructSignature, KindElementAccessExpression, KindEnumDeclaration, KindEnumMember, KindExportAssignment, + KindExportDeclaration, KindExportSpecifier, KindFunctionDeclaration, KindFunctionExpression, KindFunctionType, + KindGetAccessor, KindImportClause, KindImportEqualsDeclaration, KindImportSpecifier, KindIndexSignature, + KindInterfaceDeclaration, KindJSExportAssignment, KindJSTypeAliasDeclaration, KindCommonJSExport, + KindJsxAttribute, KindJsxAttributes, KindJsxSpreadAttribute, KindMappedType, KindMethodDeclaration, + KindMethodSignature, KindModuleDeclaration, KindNamedTupleMember, KindNamespaceExport, KindNamespaceExportDeclaration, + KindNamespaceImport, KindNewExpression, KindNoSubstitutionTemplateLiteral, KindNumericLiteral, KindObjectLiteralExpression, + KindParameter, KindPropertyAccessExpression, KindPropertyAssignment, KindPropertyDeclaration, KindPropertySignature, + KindSetAccessor, KindShorthandPropertyAssignment, KindSourceFile, KindSpreadAssignment, KindStringLiteral, + KindTypeAliasDeclaration, KindTypeLiteral, KindTypeParameter, KindVariableDeclaration: + return true + } + return false +} + +func CanHaveIllegalDecorators(node *Node) bool { + switch node.Kind { + case KindPropertyAssignment, KindShorthandPropertyAssignment, + KindFunctionDeclaration, KindConstructor, + KindIndexSignature, KindClassStaticBlockDeclaration, + KindMissingDeclaration, KindVariableStatement, + KindInterfaceDeclaration, KindTypeAliasDeclaration, + KindEnumDeclaration, KindModuleDeclaration, + KindImportEqualsDeclaration, KindImportDeclaration, KindJSImportDeclaration, + KindNamespaceExportDeclaration, KindExportDeclaration, + KindExportAssignment: + return true + } + return false +} + +func CanHaveIllegalModifiers(node *Node) bool { + switch node.Kind { + case KindClassStaticBlockDeclaration, + KindPropertyAssignment, + KindShorthandPropertyAssignment, + KindMissingDeclaration, + KindNamespaceExportDeclaration: + return true + } + return false +} + +func CanHaveModifiers(node *Node) bool { + switch node.Kind { + case KindTypeParameter, + KindParameter, + KindPropertySignature, + KindPropertyDeclaration, + KindMethodSignature, + KindMethodDeclaration, + KindConstructor, + KindGetAccessor, + KindSetAccessor, + KindIndexSignature, + KindConstructorType, + KindFunctionExpression, + KindArrowFunction, + KindClassExpression, + KindVariableStatement, + KindFunctionDeclaration, + KindClassDeclaration, + KindInterfaceDeclaration, + KindTypeAliasDeclaration, + KindEnumDeclaration, + KindModuleDeclaration, + KindImportEqualsDeclaration, + KindImportDeclaration, + KindJSImportDeclaration, + KindExportAssignment, + KindExportDeclaration: + return true + } + return false +} + +func CanHaveDecorators(node *Node) bool { + switch node.Kind { + case KindParameter, + KindPropertyDeclaration, + KindMethodDeclaration, + KindGetAccessor, + KindSetAccessor, + KindClassExpression, + KindClassDeclaration: + return true + } + return false +} + +func IsFunctionOrModuleBlock(node *Node) bool { + return IsSourceFile(node) || IsModuleBlock(node) || IsBlock(node) && IsFunctionLike(node.Parent) +} + +func IsFunctionExpressionOrArrowFunction(node *Node) bool { + return IsFunctionExpression(node) || IsArrowFunction(node) +} + +// Warning: This has the same semantics as the forEach family of functions in that traversal terminates +// in the event that 'visitor' returns true. +func ForEachReturnStatement(body *Node, visitor func(stmt *Node) bool) bool { + var traverse func(*Node) bool + traverse = func(node *Node) bool { + switch node.Kind { + case KindReturnStatement: + return visitor(node) + case KindCaseBlock, KindBlock, KindIfStatement, KindDoStatement, KindWhileStatement, KindForStatement, KindForInStatement, + KindForOfStatement, KindWithStatement, KindSwitchStatement, KindCaseClause, KindDefaultClause, KindLabeledStatement, + KindTryStatement, KindCatchClause: + return node.ForEachChild(traverse) + } + return false + } + return traverse(body) +} + +func GetRootDeclaration(node *Node) *Node { + for node.Kind == KindBindingElement { + node = node.Parent.Parent + } + return node +} + +func getCombinedFlags[T ~uint32](node *Node, getFlags func(*Node) T) T { + node = GetRootDeclaration(node) + flags := getFlags(node) + if node.Kind == KindVariableDeclaration { + node = node.Parent + } + if node != nil && node.Kind == KindVariableDeclarationList { + flags |= getFlags(node) + node = node.Parent + } + if node != nil && node.Kind == KindVariableStatement { + flags |= getFlags(node) + } + return flags +} + +func GetCombinedModifierFlags(node *Node) ModifierFlags { + return getCombinedFlags(node, (*Node).ModifierFlags) +} + +func GetCombinedNodeFlags(node *Node) NodeFlags { + return getCombinedFlags(node, getNodeFlags) +} + +func getNodeFlags(node *Node) NodeFlags { + return node.Flags +} + +// Gets whether a bound `VariableDeclaration` or `VariableDeclarationList` is part of an `await using` declaration. +func IsVarAwaitUsing(node *Node) bool { + return GetCombinedNodeFlags(node)&NodeFlagsBlockScoped == NodeFlagsAwaitUsing +} + +// Gets whether a bound `VariableDeclaration` or `VariableDeclarationList` is part of a `using` declaration. +func IsVarUsing(node *Node) bool { + return GetCombinedNodeFlags(node)&NodeFlagsBlockScoped == NodeFlagsUsing +} + +// Gets whether a bound `VariableDeclaration` or `VariableDeclarationList` is part of a `const` declaration. +func IsVarConst(node *Node) bool { + return GetCombinedNodeFlags(node)&NodeFlagsBlockScoped == NodeFlagsConst +} + +// Gets whether a bound `VariableDeclaration` or `VariableDeclarationList` is part of a `const`, `using` or `await using` declaration. +func IsVarConstLike(node *Node) bool { + switch GetCombinedNodeFlags(node) & NodeFlagsBlockScoped { + case NodeFlagsConst, NodeFlagsUsing, NodeFlagsAwaitUsing: + return true + } + return false +} + +// Gets whether a bound `VariableDeclaration` or `VariableDeclarationList` is part of a `let` declaration. +func IsVarLet(node *Node) bool { + return GetCombinedNodeFlags(node)&NodeFlagsBlockScoped == NodeFlagsLet +} + +func IsImportMeta(node *Node) bool { + if node.Kind == KindMetaProperty { + return node.AsMetaProperty().KeywordToken == KindImportKeyword && node.AsMetaProperty().Name().AsIdentifier().Text == "meta" + } + return false +} + +func WalkUpBindingElementsAndPatterns(binding *Node) *Node { + node := binding.Parent + for IsBindingElement(node.Parent) { + node = node.Parent.Parent + } + return node.Parent +} + +func IsSourceFileJS(file *SourceFile) bool { + return file.ScriptKind == core.ScriptKindJS || file.ScriptKind == core.ScriptKindJSX +} + +func IsInJSFile(node *Node) bool { + return node != nil && node.Flags&NodeFlagsJavaScriptFile != 0 +} + +func IsDeclaration(node *Node) bool { + if node.Kind == KindTypeParameter { + return node.Parent != nil + } + return IsDeclarationNode(node) +} + +// True if `name` is the name of a declaration node +func IsDeclarationName(name *Node) bool { + return !IsSourceFile(name) && !IsBindingPattern(name) && IsDeclaration(name.Parent) && name.Parent.Name() == name +} + +// Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. +func IsDeclarationNameOrImportPropertyName(name *Node) bool { + switch name.Parent.Kind { + case KindImportSpecifier, KindExportSpecifier: + return IsIdentifier(name) || name.Kind == KindStringLiteral + default: + return IsDeclarationName(name) + } +} + +func IsLiteralComputedPropertyDeclarationName(node *Node) bool { + return IsStringOrNumericLiteralLike(node) && + node.Parent.Kind == KindComputedPropertyName && + IsDeclaration(node.Parent.Parent) +} + +func IsExternalModuleImportEqualsDeclaration(node *Node) bool { + return node.Kind == KindImportEqualsDeclaration && node.AsImportEqualsDeclaration().ModuleReference.Kind == KindExternalModuleReference +} + +func IsModuleOrEnumDeclaration(node *Node) bool { + return node.Kind == KindModuleDeclaration || node.Kind == KindEnumDeclaration +} + +func IsLiteralImportTypeNode(node *Node) bool { + return IsImportTypeNode(node) && IsLiteralTypeNode(node.AsImportTypeNode().Argument) && IsStringLiteral(node.AsImportTypeNode().Argument.AsLiteralTypeNode().Literal) +} + +func IsJsxTagName(node *Node) bool { + parent := node.Parent + switch parent.Kind { + case KindJsxOpeningElement, KindJsxClosingElement, KindJsxSelfClosingElement: + return parent.TagName() == node + } + return false +} + +func IsImportOrExportSpecifier(node *Node) bool { + return IsImportSpecifier(node) || IsExportSpecifier(node) +} + +func isVoidZero(node *Node) bool { + return IsVoidExpression(node) && IsNumericLiteral(node.Expression()) && node.Expression().Text() == "0" +} + +func IsVoidExpression(node *Node) bool { + return node.Kind == KindVoidExpression +} + +func IsExportsIdentifier(node *Node) bool { + return IsIdentifier(node) && node.Text() == "exports" +} + +func IsModuleIdentifier(node *Node) bool { + return IsIdentifier(node) && node.Text() == "module" +} + +func IsThisIdentifier(node *Node) bool { + return IsIdentifier(node) && node.Text() == "this" +} + +func IsThisParameter(node *Node) bool { + return IsParameter(node) && node.Name() != nil && IsThisIdentifier(node.Name()) +} + +func IsBindableStaticAccessExpression(node *Node, excludeThisKeyword bool) bool { + return IsPropertyAccessExpression(node) && + (!excludeThisKeyword && node.Expression().Kind == KindThisKeyword || IsIdentifier(node.Name()) && IsBindableStaticNameExpression(node.Expression() /*excludeThisKeyword*/, true)) || + IsBindableStaticElementAccessExpression(node, excludeThisKeyword) +} + +func IsBindableStaticElementAccessExpression(node *Node, excludeThisKeyword bool) bool { + return IsLiteralLikeElementAccess(node) && + ((!excludeThisKeyword && node.Expression().Kind == KindThisKeyword) || + IsEntityNameExpression(node.Expression()) || + IsBindableStaticAccessExpression(node.Expression(), true /*excludeThisKeyword*/)) +} + +func IsLiteralLikeElementAccess(node *Node) bool { + return IsElementAccessExpression(node) && IsStringOrNumericLiteralLike(node.AsElementAccessExpression().ArgumentExpression) +} + +func IsBindableStaticNameExpression(node *Node, excludeThisKeyword bool) bool { + return IsEntityNameExpression(node) || IsBindableStaticAccessExpression(node, excludeThisKeyword) +} + +// Does not handle signed numeric names like `a[+0]` - handling those would require handling prefix unary expressions +// throughout late binding handling as well, which is awkward (but ultimately probably doable if there is demand) +func GetElementOrPropertyAccessName(node *Node) *Node { + switch node.Kind { + case KindPropertyAccessExpression: + if IsIdentifier(node.Name()) { + return node.Name() + } + return nil + case KindElementAccessExpression: + if arg := SkipParentheses(node.AsElementAccessExpression().ArgumentExpression); IsStringOrNumericLiteralLike(arg) { + return arg + } + return nil + } + panic("Unhandled case in GetElementOrPropertyAccessName") +} + +func GetInitializerOfBinaryExpression(expr *BinaryExpression) *Expression { + for IsBinaryExpression(expr.Right) { + expr = expr.Right.AsBinaryExpression() + } + return expr.Right.Expression() +} + +func IsExpressionWithTypeArgumentsInClassExtendsClause(node *Node) bool { + return TryGetClassExtendingExpressionWithTypeArguments(node) != nil +} + +func TryGetClassExtendingExpressionWithTypeArguments(node *Node) *ClassLikeDeclaration { + cls, isImplements := TryGetClassImplementingOrExtendingExpressionWithTypeArguments(node) + if cls != nil && !isImplements { + return cls + } + return nil +} + +func TryGetClassImplementingOrExtendingExpressionWithTypeArguments(node *Node) (class *ClassLikeDeclaration, isImplements bool) { + if IsExpressionWithTypeArguments(node) { + if IsHeritageClause(node.Parent) && IsClassLike(node.Parent.Parent) { + return node.Parent.Parent, node.Parent.AsHeritageClause().Token == KindImplementsKeyword + } + } + return nil, false +} + +func GetNameOfDeclaration(declaration *Node) *Node { + if declaration == nil { + return nil + } + nonAssignedName := GetNonAssignedNameOfDeclaration(declaration) + if nonAssignedName != nil { + return nonAssignedName + } + if IsFunctionExpression(declaration) || IsArrowFunction(declaration) || IsClassExpression(declaration) { + return getAssignedName(declaration) + } + return nil +} + +func GetImportClauseOfDeclaration(declaration *Declaration) *ImportClause { + switch declaration.Kind { + case KindImportDeclaration: + return declaration.AsImportDeclaration().ImportClause.AsImportClause() + case KindJSDocImportTag: + return declaration.AsJSDocImportTag().ImportClause.AsImportClause() + } + return nil +} + +func GetNonAssignedNameOfDeclaration(declaration *Node) *Node { + // !!! + switch declaration.Kind { + case KindBinaryExpression: + bin := declaration.AsBinaryExpression() + kind := GetAssignmentDeclarationKind(bin) + if kind == JSDeclarationKindProperty || kind == JSDeclarationKindThisProperty { + if name := GetElementOrPropertyAccessName(bin.Left); name != nil { + return name + } else { + return bin.Left + } + } + return nil + case KindExportAssignment, KindJSExportAssignment: + expr := declaration.AsExportAssignment().Expression + if IsIdentifier(expr) { + return expr + } + return nil + } + return declaration.Name() +} + +func getAssignedName(node *Node) *Node { + parent := node.Parent + if parent != nil { + switch parent.Kind { + case KindPropertyAssignment: + return parent.AsPropertyAssignment().Name() + case KindBindingElement: + return parent.AsBindingElement().Name() + case KindBinaryExpression: + if node == parent.AsBinaryExpression().Right { + left := parent.AsBinaryExpression().Left + switch left.Kind { + case KindIdentifier: + return left + case KindPropertyAccessExpression: + return left.AsPropertyAccessExpression().Name() + case KindElementAccessExpression: + arg := SkipParentheses(left.AsElementAccessExpression().ArgumentExpression) + if IsStringOrNumericLiteralLike(arg) { + return arg + } + } + } + case KindCommonJSExport: + return parent.AsCommonJSExport().Name() + case KindVariableDeclaration: + name := parent.AsVariableDeclaration().Name() + if IsIdentifier(name) { + return name + } + } + } + return nil +} + +type JSDeclarationKind int + +const ( + JSDeclarationKindNone JSDeclarationKind = iota + /// module.exports = expr + JSDeclarationKindModuleExports + /// exports.name = expr + /// module.exports.name = expr + JSDeclarationKindExportsProperty + /// className.prototype.name = expr + JSDeclarationKindPrototypeProperty + /// this.name = expr + JSDeclarationKindThisProperty + /// F.name = expr, F[name] = expr + JSDeclarationKindProperty +) + +func GetAssignmentDeclarationKind(bin *BinaryExpression) JSDeclarationKind { + if bin.OperatorToken.Kind != KindEqualsToken || !IsAccessExpression(bin.Left) { + return JSDeclarationKindNone + } + if IsInJSFile(bin.Left) && IsModuleExportsAccessExpression(bin.Left) { + return JSDeclarationKindModuleExports + } else if IsInJSFile(bin.Left) && + (IsModuleExportsAccessExpression(bin.Left.Expression()) || IsExportsIdentifier(bin.Left.Expression())) && + GetElementOrPropertyAccessName(bin.Left) != nil { + return JSDeclarationKindExportsProperty + } + if IsInJSFile(bin.Left) && bin.Left.Expression().Kind == KindThisKeyword { + return JSDeclarationKindThisProperty + } + if bin.Left.Kind == KindPropertyAccessExpression && IsEntityNameExpressionEx(bin.Left.Expression(), IsInJSFile(bin.Left)) && IsIdentifier(bin.Left.Name()) || + bin.Left.Kind == KindElementAccessExpression && IsEntityNameExpressionEx(bin.Left.Expression(), IsInJSFile(bin.Left)) { + return JSDeclarationKindProperty + } + return JSDeclarationKindNone +} + +/** + * A declaration has a dynamic name if all of the following are true: + * 1. The declaration has a computed property name. + * 2. The computed name is *not* expressed as a StringLiteral. + * 3. The computed name is *not* expressed as a NumericLiteral. + * 4. The computed name is *not* expressed as a PlusToken or MinusToken + * immediately followed by a NumericLiteral. + */ +func HasDynamicName(declaration *Node) bool { + name := GetNameOfDeclaration(declaration) + return name != nil && IsDynamicName(name) +} + +func IsDynamicName(name *Node) bool { + var expr *Node + switch name.Kind { + case KindComputedPropertyName: + expr = name.AsComputedPropertyName().Expression + case KindElementAccessExpression: + expr = SkipParentheses(name.AsElementAccessExpression().ArgumentExpression) + default: + return false + } + return !IsStringOrNumericLiteralLike(expr) && !IsSignedNumericLiteral(expr) +} + +func IsEntityNameExpression(node *Node) bool { + return IsEntityNameExpressionEx(node, false /*allowJS*/) +} + +func IsEntityNameExpressionEx(node *Node, allowJS bool) bool { + if node.Kind == KindIdentifier || IsPropertyAccessEntityNameExpression(node, allowJS) { + return true + } + if allowJS { + return node.Kind == KindThisKeyword || isElementAccessEntityNameExpression(node, allowJS) + } + return false +} + +func IsPropertyAccessEntityNameExpression(node *Node, allowJS bool) bool { + if node.Kind == KindPropertyAccessExpression { + expr := node.AsPropertyAccessExpression() + return expr.Name().Kind == KindIdentifier && IsEntityNameExpressionEx(expr.Expression, allowJS) + } + return false +} + +func isElementAccessEntityNameExpression(node *Node, allowJS bool) bool { + if node.Kind == KindElementAccessExpression { + expr := node.AsElementAccessExpression() + if IsStringOrNumericLiteralLike(SkipParentheses(expr.ArgumentExpression)) { + return IsEntityNameExpressionEx(expr.Expression, allowJS) + } + } + return false +} + +func IsDottedName(node *Node) bool { + switch node.Kind { + case KindIdentifier, KindThisKeyword, KindSuperKeyword, KindMetaProperty: + return true + case KindPropertyAccessExpression, KindParenthesizedExpression: + return IsDottedName(node.Expression()) + } + return false +} + +func HasSamePropertyAccessName(node1, node2 *Node) bool { + if node1.Kind == KindIdentifier && node2.Kind == KindIdentifier { + return node1.Text() == node2.Text() + } else if node1.Kind == KindPropertyAccessExpression && node2.Kind == KindPropertyAccessExpression { + return node1.AsPropertyAccessExpression().Name().Text() == node2.AsPropertyAccessExpression().Name().Text() && + HasSamePropertyAccessName(node1.AsPropertyAccessExpression().Expression, node2.AsPropertyAccessExpression().Expression) + } + return false +} + +func IsAmbientModule(node *Node) bool { + return IsModuleDeclaration(node) && (node.AsModuleDeclaration().Name().Kind == KindStringLiteral || IsGlobalScopeAugmentation(node)) +} + +func IsExternalModule(file *SourceFile) bool { + return file.ExternalModuleIndicator != nil +} + +func IsExternalOrCommonJSModule(file *SourceFile) bool { + return file.ExternalModuleIndicator != nil || file.CommonJSModuleIndicator != nil +} + +// TODO: Should we deprecate `IsExternalOrCommonJSModule` in favor of this function? +func IsEffectiveExternalModule(node *SourceFile, compilerOptions *core.CompilerOptions) bool { + return IsExternalModule(node) || (isCommonJSContainingModuleKind(compilerOptions.GetEmitModuleKind()) && node.CommonJSModuleIndicator != nil) +} + +func isCommonJSContainingModuleKind(kind core.ModuleKind) bool { + return kind == core.ModuleKindCommonJS || core.ModuleKindNode16 <= kind && kind <= core.ModuleKindNodeNext +} + +func IsExternalModuleIndicator(node *Statement) bool { + // Exported top-level member indicates moduleness + return IsAnyImportOrReExport(node) || IsExportAssignment(node) || HasSyntacticModifier(node, ModifierFlagsExport) +} + +func IsExportNamespaceAsDefaultDeclaration(node *Node) bool { + if IsExportDeclaration(node) { + decl := node.AsExportDeclaration() + return IsNamespaceExport(decl.ExportClause) && ModuleExportNameIsDefault(decl.ExportClause.Name()) + } + return false +} + +func IsGlobalScopeAugmentation(node *Node) bool { + return IsModuleDeclaration(node) && node.AsModuleDeclaration().Keyword == KindGlobalKeyword +} + +func IsModuleAugmentationExternal(node *Node) bool { + // external module augmentation is a ambient module declaration that is either: + // - defined in the top level scope and source file is an external module + // - defined inside ambient module declaration located in the top level scope and source file not an external module + switch node.Parent.Kind { + case KindSourceFile: + return IsExternalModule(node.Parent.AsSourceFile()) + case KindModuleBlock: + grandParent := node.Parent.Parent + return IsAmbientModule(grandParent) && IsSourceFile(grandParent.Parent) && !IsExternalModule(grandParent.Parent.AsSourceFile()) + } + return false +} + +func IsModuleWithStringLiteralName(node *Node) bool { + return IsModuleDeclaration(node) && node.Name().Kind == KindStringLiteral +} + +func GetContainingClass(node *Node) *Node { + return FindAncestor(node.Parent, IsClassLike) +} + +func GetExtendsHeritageClauseElement(node *Node) *ExpressionWithTypeArgumentsNode { + return core.FirstOrNil(GetExtendsHeritageClauseElements(node)) +} + +func GetExtendsHeritageClauseElements(node *Node) []*ExpressionWithTypeArgumentsNode { + return GetHeritageElements(node, KindExtendsKeyword) +} + +func GetImplementsHeritageClauseElements(node *Node) []*ExpressionWithTypeArgumentsNode { + return GetHeritageElements(node, KindImplementsKeyword) +} + +func GetHeritageElements(node *Node, kind Kind) []*Node { + clause := GetHeritageClause(node, kind) + if clause != nil { + return clause.AsHeritageClause().Types.Nodes + } + return nil +} + +func GetHeritageClause(node *Node, kind Kind) *Node { + clauses := getHeritageClauses(node) + if clauses != nil { + for _, clause := range clauses.Nodes { + if clause.AsHeritageClause().Token == kind { + return clause + } + } + } + return nil +} + +func getHeritageClauses(node *Node) *NodeList { + switch node.Kind { + case KindClassDeclaration: + return node.AsClassDeclaration().HeritageClauses + case KindClassExpression: + return node.AsClassExpression().HeritageClauses + case KindInterfaceDeclaration: + return node.AsInterfaceDeclaration().HeritageClauses + } + return nil +} + +func IsPartOfTypeQuery(node *Node) bool { + for node.Kind == KindQualifiedName || node.Kind == KindIdentifier { + node = node.Parent + } + return node.Kind == KindTypeQuery +} + +/** + * This function returns true if the this node's root declaration is a parameter. + * For example, passing a `ParameterDeclaration` will return true, as will passing a + * binding element that is a child of a `ParameterDeclaration`. + * + * If you are looking to test that a `Node` is a `ParameterDeclaration`, use `isParameter`. + */ +func IsPartOfParameterDeclaration(node *Node) bool { + return GetRootDeclaration(node).Kind == KindParameter +} + +func IsInTopLevelContext(node *Node) bool { + // The name of a class or function declaration is a BindingIdentifier in its surrounding scope. + if IsIdentifier(node) { + parent := node.Parent + if (IsClassDeclaration(parent) || IsFunctionDeclaration(parent)) && parent.Name() == node { + node = parent + } + } + container := GetThisContainer(node, true /*includeArrowFunctions*/, false /*includeClassComputedPropertyName*/) + return IsSourceFile(container) +} + +func GetThisContainer(node *Node, includeArrowFunctions bool, includeClassComputedPropertyName bool) *Node { + for { + node = node.Parent + if node == nil { + panic("nil parent in getThisContainer") + } + switch node.Kind { + case KindComputedPropertyName: + if includeClassComputedPropertyName && IsClassLike(node.Parent.Parent) { + return node + } + node = node.Parent.Parent + case KindDecorator: + if node.Parent.Kind == KindParameter && IsClassElement(node.Parent.Parent) { + // If the decorator's parent is a Parameter, we resolve the this container from + // the grandparent class declaration. + node = node.Parent.Parent + } else if IsClassElement(node.Parent) { + // If the decorator's parent is a class element, we resolve the 'this' container + // from the parent class declaration. + node = node.Parent + } + case KindArrowFunction: + if includeArrowFunctions { + return node + } + case KindFunctionDeclaration, KindFunctionExpression, KindModuleDeclaration, KindClassStaticBlockDeclaration, + KindPropertyDeclaration, KindPropertySignature, KindMethodDeclaration, KindMethodSignature, KindConstructor, + KindGetAccessor, KindSetAccessor, KindCallSignature, KindConstructSignature, KindIndexSignature, + KindEnumDeclaration, KindSourceFile: + return node + } + } +} + +func GetSuperContainer(node *Node, stopOnFunctions bool) *Node { + for node = node.Parent; node != nil; node = node.Parent { + switch node.Kind { + case KindComputedPropertyName: + node = node.Parent + case KindFunctionDeclaration, KindFunctionExpression, KindArrowFunction: + if !stopOnFunctions { + continue + } + return node + case KindPropertyDeclaration, KindPropertySignature, KindMethodDeclaration, KindMethodSignature, KindConstructor, KindGetAccessor, KindSetAccessor, KindClassStaticBlockDeclaration: + return node + case KindDecorator: + // Decorators are always applied outside of the body of a class or method. + if node.Parent.Kind == KindParameter && IsClassElement(node.Parent.Parent) { + // If the decorator's parent is a Parameter, we resolve the this container from + // the grandparent class declaration. + node = node.Parent.Parent + } else if IsClassElement(node.Parent) { + // If the decorator's parent is a class element, we resolve the 'this' container + // from the parent class declaration. + node = node.Parent + } + } + } + return nil +} + +func GetImmediatelyInvokedFunctionExpression(fn *Node) *Node { + if IsFunctionExpressionOrArrowFunction(fn) { + prev := fn + parent := fn.Parent + for IsParenthesizedExpression(parent) { + prev = parent + parent = parent.Parent + } + if IsCallExpression(parent) && parent.AsCallExpression().Expression == prev { + return parent + } + } + return nil +} + +func IsEnumConst(node *Node) bool { + return GetCombinedModifierFlags(node)&ModifierFlagsConst != 0 +} + +func ExportAssignmentIsAlias(node *Node) bool { + e := node.AsExportAssignment().Expression + return IsEntityNameExpression(e) || IsClassExpression(e) +} + +func IsInstanceOfExpression(node *Node) bool { + return IsBinaryExpression(node) && node.AsBinaryExpression().OperatorToken.Kind == KindInstanceOfKeyword +} + +func IsAnyImportOrReExport(node *Node) bool { + return IsAnyImportSyntax(node) || IsExportDeclaration(node) +} + +func IsAnyImportSyntax(node *Node) bool { + return NodeKindIs(node, KindImportDeclaration, KindJSImportDeclaration, KindImportEqualsDeclaration) +} + +func IsJsonSourceFile(file *SourceFile) bool { + return file.ScriptKind == core.ScriptKindJSON +} + +func IsInJsonFile(node *Node) bool { + return node.Flags&NodeFlagsJsonFile != 0 +} + +func GetExternalModuleName(node *Node) *Expression { + switch node.Kind { + case KindImportDeclaration, KindJSImportDeclaration: + return node.AsImportDeclaration().ModuleSpecifier + case KindExportDeclaration: + return node.AsExportDeclaration().ModuleSpecifier + case KindImportEqualsDeclaration: + if node.AsImportEqualsDeclaration().ModuleReference.Kind == KindExternalModuleReference { + return node.AsImportEqualsDeclaration().ModuleReference.AsExternalModuleReference().Expression + } + return nil + case KindImportType: + return getImportTypeNodeLiteral(node) + case KindCallExpression: + return core.FirstOrNil(node.AsCallExpression().Arguments.Nodes) + case KindModuleDeclaration: + if IsStringLiteral(node.AsModuleDeclaration().Name()) { + return node.AsModuleDeclaration().Name() + } + return nil + } + panic("Unhandled case in getExternalModuleName") +} + +func GetImportAttributes(node *Node) *Node { + switch node.Kind { + case KindImportDeclaration, KindJSImportDeclaration: + return node.AsImportDeclaration().Attributes + case KindExportDeclaration: + return node.AsExportDeclaration().Attributes + } + panic("Unhandled case in getImportAttributes") +} + +func getImportTypeNodeLiteral(node *Node) *Node { + if IsImportTypeNode(node) { + importTypeNode := node.AsImportTypeNode() + if IsLiteralTypeNode(importTypeNode.Argument) { + literalTypeNode := importTypeNode.Argument.AsLiteralTypeNode() + if IsStringLiteral(literalTypeNode.Literal) { + return literalTypeNode.Literal + } + } + } + return nil +} + +func IsExpressionNode(node *Node) bool { + switch node.Kind { + case KindSuperKeyword, KindNullKeyword, KindTrueKeyword, KindFalseKeyword, KindRegularExpressionLiteral, + KindArrayLiteralExpression, KindObjectLiteralExpression, KindPropertyAccessExpression, KindElementAccessExpression, + KindCallExpression, KindNewExpression, KindTaggedTemplateExpression, KindAsExpression, KindTypeAssertionExpression, + KindSatisfiesExpression, KindNonNullExpression, KindParenthesizedExpression, KindFunctionExpression, + KindClassExpression, KindArrowFunction, KindVoidExpression, KindDeleteExpression, KindTypeOfExpression, + KindPrefixUnaryExpression, KindPostfixUnaryExpression, KindBinaryExpression, KindConditionalExpression, + KindSpreadElement, KindTemplateExpression, KindOmittedExpression, KindJsxElement, KindJsxSelfClosingElement, + KindJsxFragment, KindYieldExpression, KindAwaitExpression: + return true + case KindMetaProperty: + // `import.defer` in `import.defer(...)` is not an expression + return !IsImportCall(node.Parent) || node.Parent.AsCallExpression().Expression != node + case KindExpressionWithTypeArguments: + return !IsHeritageClause(node.Parent) + case KindQualifiedName: + for node.Parent.Kind == KindQualifiedName { + node = node.Parent + } + return IsTypeQueryNode(node.Parent) || IsJSDocLinkLike(node.Parent) || IsJSDocNameReference(node.Parent) || isJSXTagName(node) + case KindPrivateIdentifier: + return IsBinaryExpression(node.Parent) && node.Parent.AsBinaryExpression().Left == node && node.Parent.AsBinaryExpression().OperatorToken.Kind == KindInKeyword + case KindIdentifier: + if IsTypeQueryNode(node.Parent) || IsJSDocLinkLike(node.Parent) || IsJSDocNameReference(node.Parent) || isJSXTagName(node) { + return true + } + fallthrough + case KindNumericLiteral, KindBigIntLiteral, KindStringLiteral, KindNoSubstitutionTemplateLiteral, KindThisKeyword: + return IsInExpressionContext(node) + default: + return false + } +} + +func IsInExpressionContext(node *Node) bool { + parent := node.Parent + switch parent.Kind { + case KindVariableDeclaration: + return parent.AsVariableDeclaration().Initializer == node + case KindParameter: + return parent.AsParameterDeclaration().Initializer == node + case KindPropertyDeclaration: + return parent.AsPropertyDeclaration().Initializer == node + case KindPropertySignature: + return parent.AsPropertySignatureDeclaration().Initializer == node + case KindEnumMember: + return parent.AsEnumMember().Initializer == node + case KindPropertyAssignment: + return parent.AsPropertyAssignment().Initializer == node + case KindBindingElement: + return parent.AsBindingElement().Initializer == node + case KindExpressionStatement: + return parent.AsExpressionStatement().Expression == node + case KindIfStatement: + return parent.AsIfStatement().Expression == node + case KindDoStatement: + return parent.AsDoStatement().Expression == node + case KindWhileStatement: + return parent.AsWhileStatement().Expression == node + case KindReturnStatement: + return parent.AsReturnStatement().Expression == node + case KindWithStatement: + return parent.AsWithStatement().Expression == node + case KindSwitchStatement: + return parent.AsSwitchStatement().Expression == node + case KindCaseClause, KindDefaultClause: + return parent.AsCaseOrDefaultClause().Expression == node + case KindThrowStatement: + return parent.AsThrowStatement().Expression == node + case KindForStatement: + s := parent.AsForStatement() + return s.Initializer == node && s.Initializer.Kind != KindVariableDeclarationList || s.Condition == node || s.Incrementor == node + case KindForInStatement, KindForOfStatement: + s := parent.AsForInOrOfStatement() + return s.Initializer == node && s.Initializer.Kind != KindVariableDeclarationList || s.Expression == node + case KindTypeAssertionExpression: + return parent.AsTypeAssertion().Expression == node + case KindAsExpression: + return parent.AsAsExpression().Expression == node + case KindTemplateSpan: + return parent.AsTemplateSpan().Expression == node + case KindComputedPropertyName: + return parent.AsComputedPropertyName().Expression == node + case KindDecorator, KindJsxExpression, KindJsxSpreadAttribute, KindSpreadAssignment: + return true + case KindExpressionWithTypeArguments: + return parent.AsExpressionWithTypeArguments().Expression == node && !IsPartOfTypeNode(parent) + case KindShorthandPropertyAssignment: + return parent.AsShorthandPropertyAssignment().ObjectAssignmentInitializer == node + case KindSatisfiesExpression: + return parent.AsSatisfiesExpression().Expression == node + default: + return IsExpressionNode(parent) + } +} + +func IsPartOfTypeNode(node *Node) bool { + kind := node.Kind + if kind >= KindFirstTypeNode && kind <= KindLastTypeNode { + return true + } + switch node.Kind { + case KindAnyKeyword, KindUnknownKeyword, KindNumberKeyword, KindBigIntKeyword, KindStringKeyword, + KindBooleanKeyword, KindSymbolKeyword, KindObjectKeyword, KindUndefinedKeyword, KindNullKeyword, + KindNeverKeyword: + return true + case KindVoidKeyword: + return node.Parent.Kind != KindVoidExpression + case KindExpressionWithTypeArguments: + return isPartOfTypeExpressionWithTypeArguments(node) + case KindTypeParameter: + return node.Parent.Kind == KindMappedType || node.Parent.Kind == KindInferType + case KindIdentifier: + parent := node.Parent + if IsQualifiedName(parent) && parent.AsQualifiedName().Right == node { + return isPartOfTypeNodeInParent(parent) + } + if IsPropertyAccessExpression(parent) && parent.AsPropertyAccessExpression().Name() == node { + return isPartOfTypeNodeInParent(parent) + } + return isPartOfTypeNodeInParent(node) + case KindQualifiedName, KindPropertyAccessExpression, KindThisKeyword: + return isPartOfTypeNodeInParent(node) + } + return false +} + +func isPartOfTypeNodeInParent(node *Node) bool { + parent := node.Parent + if parent.Kind == KindTypeQuery { + return false + } + if parent.Kind == KindImportType { + return !parent.AsImportTypeNode().IsTypeOf + } + + // Do not recursively call isPartOfTypeNode on the parent. In the example: + // + // let a: A.B.C; + // + // Calling isPartOfTypeNode would consider the qualified name A.B a type node. + // Only C and A.B.C are type nodes. + if parent.Kind >= KindFirstTypeNode && parent.Kind <= KindLastTypeNode { + return true + } + switch parent.Kind { + case KindExpressionWithTypeArguments: + return isPartOfTypeExpressionWithTypeArguments(parent) + case KindTypeParameter: + return node == parent.AsTypeParameter().Constraint + case KindVariableDeclaration, KindParameter, KindPropertyDeclaration, KindPropertySignature, KindFunctionDeclaration, + KindFunctionExpression, KindArrowFunction, KindConstructor, KindMethodDeclaration, KindMethodSignature, + KindGetAccessor, KindSetAccessor, KindCallSignature, KindConstructSignature, KindIndexSignature, + KindTypeAssertionExpression: + return node == parent.Type() + case KindCallExpression, KindNewExpression, KindTaggedTemplateExpression: + return slices.Contains(parent.TypeArguments(), node) + } + return false +} + +func isPartOfTypeExpressionWithTypeArguments(node *Node) bool { + parent := node.Parent + return IsHeritageClause(parent) && (!IsClassLike(parent.Parent) || parent.AsHeritageClause().Token == KindImplementsKeyword) || + IsJSDocImplementsTag(parent) || + IsJSDocAugmentsTag(parent) +} + +func IsJSDocLinkLike(node *Node) bool { + return NodeKindIs(node, KindJSDocLink, KindJSDocLinkCode, KindJSDocLinkPlain) +} + +func IsJSDocTag(node *Node) bool { + return node.Kind >= KindFirstJSDocTagNode && node.Kind <= KindLastJSDocTagNode +} + +func isJSXTagName(node *Node) bool { + parent := node.Parent + switch parent.Kind { + case KindJsxOpeningElement: + return parent.AsJsxOpeningElement().TagName == node + case KindJsxSelfClosingElement: + return parent.AsJsxSelfClosingElement().TagName == node + case KindJsxClosingElement: + return parent.AsJsxClosingElement().TagName == node + } + return false +} + +func IsSuperCall(node *Node) bool { + return IsCallExpression(node) && node.AsCallExpression().Expression.Kind == KindSuperKeyword +} + +func IsImportCall(node *Node) bool { + if !IsCallExpression(node) { + return false + } + e := node.AsCallExpression().Expression + return e.Kind == KindImportKeyword || IsMetaProperty(e) && e.AsMetaProperty().KeywordToken == KindImportKeyword && e.Text() == "defer" +} + +func IsComputedNonLiteralName(name *Node) bool { + return IsComputedPropertyName(name) && !IsStringOrNumericLiteralLike(name.Expression()) +} + +func IsQuestionToken(node *Node) bool { + return node != nil && node.Kind == KindQuestionToken +} + +func GetTextOfPropertyName(name *Node) string { + text, _ := TryGetTextOfPropertyName(name) + return text +} + +func TryGetTextOfPropertyName(name *Node) (string, bool) { + switch name.Kind { + case KindIdentifier, KindPrivateIdentifier, KindStringLiteral, KindNumericLiteral, KindBigIntLiteral, + KindNoSubstitutionTemplateLiteral: + return name.Text(), true + case KindComputedPropertyName: + if IsStringOrNumericLiteralLike(name.Expression()) { + return name.Expression().Text(), true + } + case KindJsxNamespacedName: + return name.AsJsxNamespacedName().Namespace.Text() + ":" + name.Name().Text(), true + } + return "", false +} + +func IsJSDocNode(node *Node) bool { + return node.Kind >= KindFirstJSDocNode && node.Kind <= KindLastJSDocNode +} + +func IsNonWhitespaceToken(node *Node) bool { + return IsTokenKind(node.Kind) && !IsWhitespaceOnlyJsxText(node) +} + +func IsWhitespaceOnlyJsxText(node *Node) bool { + return node.Kind == KindJsxText && node.AsJsxText().ContainsOnlyTriviaWhiteSpaces +} + +func GetNewTargetContainer(node *Node) *Node { + container := GetThisContainer(node, false /*includeArrowFunctions*/, false /*includeClassComputedPropertyName*/) + if container != nil { + switch container.Kind { + case KindConstructor, KindFunctionDeclaration, KindFunctionExpression: + return container + } + } + return nil +} + +func GetEnclosingBlockScopeContainer(node *Node) *Node { + return FindAncestor(node.Parent, func(current *Node) bool { + return IsBlockScope(current, current.Parent) + }) +} + +func IsBlockScope(node *Node, parentNode *Node) bool { + switch node.Kind { + case KindSourceFile, KindCaseBlock, KindCatchClause, KindModuleDeclaration, KindForStatement, KindForInStatement, KindForOfStatement, + KindConstructor, KindMethodDeclaration, KindGetAccessor, KindSetAccessor, KindFunctionDeclaration, KindFunctionExpression, + KindArrowFunction, KindPropertyDeclaration, KindClassStaticBlockDeclaration: + return true + case KindBlock: + // function block is not considered block-scope container + // see comment in binder.ts: bind(...), case for SyntaxKind.Block + return !IsFunctionLikeOrClassStaticBlockDeclaration(parentNode) + } + return false +} + +type SemanticMeaning int32 + +const ( + SemanticMeaningNone SemanticMeaning = 0 + SemanticMeaningValue SemanticMeaning = 1 << 0 + SemanticMeaningType SemanticMeaning = 1 << 1 + SemanticMeaningNamespace SemanticMeaning = 1 << 2 + SemanticMeaningAll SemanticMeaning = SemanticMeaningValue | SemanticMeaningType | SemanticMeaningNamespace +) + +func GetMeaningFromDeclaration(node *Node) SemanticMeaning { + switch node.Kind { + case KindVariableDeclaration: + return SemanticMeaningValue + case KindParameter, + KindBindingElement, + KindPropertyDeclaration, + KindPropertySignature, + KindPropertyAssignment, + KindShorthandPropertyAssignment, + KindMethodDeclaration, + KindMethodSignature, + KindConstructor, + KindGetAccessor, + KindSetAccessor, + KindFunctionDeclaration, + KindFunctionExpression, + KindArrowFunction, + KindCatchClause, + KindJsxAttribute: + return SemanticMeaningValue + + case KindTypeParameter, + KindInterfaceDeclaration, + KindTypeAliasDeclaration, + KindJSTypeAliasDeclaration, + KindTypeLiteral: + return SemanticMeaningType + case KindEnumMember, KindClassDeclaration: + return SemanticMeaningValue | SemanticMeaningType + + case KindModuleDeclaration: + if IsAmbientModule(node) { + return SemanticMeaningNamespace | SemanticMeaningValue + } else if GetModuleInstanceState(node) == ModuleInstanceStateInstantiated { + return SemanticMeaningNamespace | SemanticMeaningValue + } else { + return SemanticMeaningNamespace + } + + case KindEnumDeclaration, + KindNamedImports, + KindImportSpecifier, + KindImportEqualsDeclaration, + KindImportDeclaration, + KindJSImportDeclaration, + KindExportAssignment, + KindJSExportAssignment, + KindExportDeclaration: + return SemanticMeaningAll + + // An external module can be a Value + case KindSourceFile: + return SemanticMeaningNamespace | SemanticMeaningValue + } + + return SemanticMeaningAll +} + +func IsPropertyAccessOrQualifiedName(node *Node) bool { + return node.Kind == KindPropertyAccessExpression || node.Kind == KindQualifiedName +} + +func IsLabelName(node *Node) bool { + return IsLabelOfLabeledStatement(node) || IsJumpStatementTarget(node) +} + +func IsLabelOfLabeledStatement(node *Node) bool { + if !IsIdentifier(node) { + return false + } + if !IsLabeledStatement(node.Parent) { + return false + } + return node == node.Parent.Label() +} + +func IsJumpStatementTarget(node *Node) bool { + if !IsIdentifier(node) { + return false + } + if !IsBreakOrContinueStatement(node.Parent) { + return false + } + return node == node.Parent.Label() +} + +func IsBreakOrContinueStatement(node *Node) bool { + return NodeKindIs(node, KindBreakStatement, KindContinueStatement) +} + +// GetModuleInstanceState is used during binding as well as in transformations and tests, and therefore may be invoked +// with a node that does not yet have its `Parent` pointer set. In this case, an `ancestors` represents a stack of +// virtual `Parent` pointers that can be used to walk up the tree. Since `getModuleInstanceStateForAliasTarget` may +// potentially walk up out of the provided `Node`, merely setting the parent pointers for a given `ModuleDeclaration` +// prior to invoking `GetModuleInstanceState` is not sufficient. It is, however, necessary that the `Parent` pointers +// for all ancestors of the `Node` provided to `GetModuleInstanceState` have been set. + +// Push a virtual parent pointer onto `ancestors` and return it. +func pushAncestor(ancestors []*Node, parent *Node) []*Node { + return append(ancestors, parent) +} + +// If a virtual `Parent` exists on the stack, returns the previous stack entry and the virtual `Parent“. +// Otherwise, we return `nil` and the value of `node.Parent`. +func popAncestor(ancestors []*Node, node *Node) ([]*Node, *Node) { + if len(ancestors) == 0 { + return nil, node.Parent + } + n := len(ancestors) - 1 + return ancestors[:n], ancestors[n] +} + +type ModuleInstanceState int32 + +const ( + ModuleInstanceStateUnknown ModuleInstanceState = iota + ModuleInstanceStateNonInstantiated + ModuleInstanceStateInstantiated + ModuleInstanceStateConstEnumOnly +) + +func GetModuleInstanceState(node *Node) ModuleInstanceState { + return getModuleInstanceState(node, nil, nil) +} + +func getModuleInstanceState(node *Node, ancestors []*Node, visited map[NodeId]ModuleInstanceState) ModuleInstanceState { + module := node.AsModuleDeclaration() + if module.Body != nil { + return getModuleInstanceStateCached(module.Body, pushAncestor(ancestors, node), visited) + } else { + return ModuleInstanceStateInstantiated + } +} + +func getModuleInstanceStateCached(node *Node, ancestors []*Node, visited map[NodeId]ModuleInstanceState) ModuleInstanceState { + if visited == nil { + visited = make(map[NodeId]ModuleInstanceState) + } + nodeId := GetNodeId(node) + if cached, ok := visited[nodeId]; ok { + if cached != ModuleInstanceStateUnknown { + return cached + } + return ModuleInstanceStateNonInstantiated + } + visited[nodeId] = ModuleInstanceStateUnknown + result := getModuleInstanceStateWorker(node, ancestors, visited) + visited[nodeId] = result + return result +} + +func getModuleInstanceStateWorker(node *Node, ancestors []*Node, visited map[NodeId]ModuleInstanceState) ModuleInstanceState { + // A module is uninstantiated if it contains only + switch node.Kind { + case KindInterfaceDeclaration, KindTypeAliasDeclaration, KindJSTypeAliasDeclaration: + return ModuleInstanceStateNonInstantiated + case KindEnumDeclaration: + if IsEnumConst(node) { + return ModuleInstanceStateConstEnumOnly + } + case KindImportDeclaration, KindJSImportDeclaration, KindImportEqualsDeclaration: + if !HasSyntacticModifier(node, ModifierFlagsExport) { + return ModuleInstanceStateNonInstantiated + } + case KindExportDeclaration: + decl := node.AsExportDeclaration() + if decl.ModuleSpecifier == nil && decl.ExportClause != nil && decl.ExportClause.Kind == KindNamedExports { + state := ModuleInstanceStateNonInstantiated + ancestors = pushAncestor(ancestors, node) + ancestors = pushAncestor(ancestors, decl.ExportClause) + for _, specifier := range decl.ExportClause.AsNamedExports().Elements.Nodes { + specifierState := getModuleInstanceStateForAliasTarget(specifier, ancestors, visited) + if specifierState > state { + state = specifierState + } + if state == ModuleInstanceStateInstantiated { + return state + } + } + return state + } + case KindModuleBlock: + state := ModuleInstanceStateNonInstantiated + ancestors = pushAncestor(ancestors, node) + node.ForEachChild(func(n *Node) bool { + childState := getModuleInstanceStateCached(n, ancestors, visited) + switch childState { + case ModuleInstanceStateNonInstantiated: + return false + case ModuleInstanceStateConstEnumOnly: + state = ModuleInstanceStateConstEnumOnly + return false + case ModuleInstanceStateInstantiated: + state = ModuleInstanceStateInstantiated + return true + } + panic("Unhandled case in getModuleInstanceStateWorker") + }) + return state + case KindModuleDeclaration: + return getModuleInstanceState(node, ancestors, visited) + } + return ModuleInstanceStateInstantiated +} + +func getModuleInstanceStateForAliasTarget(node *Node, ancestors []*Node, visited map[NodeId]ModuleInstanceState) ModuleInstanceState { + spec := node.AsExportSpecifier() + name := spec.PropertyName + if name == nil { + name = spec.Name() + } + if name.Kind != KindIdentifier { + // Skip for invalid syntax like this: export { "x" } + return ModuleInstanceStateInstantiated + } + for ancestors, p := popAncestor(ancestors, node); p != nil; ancestors, p = popAncestor(ancestors, p) { + if IsBlock(p) || IsModuleBlock(p) || IsSourceFile(p) { + statements := GetStatementsOfBlock(p) + found := ModuleInstanceStateUnknown + statementsAncestors := pushAncestor(ancestors, p) + for _, statement := range statements.Nodes { + if NodeHasName(statement, name) { + state := getModuleInstanceStateCached(statement, statementsAncestors, visited) + if found == ModuleInstanceStateUnknown || state > found { + found = state + } + if found == ModuleInstanceStateInstantiated { + return found + } + if statement.Kind == KindImportEqualsDeclaration { + // Treat re-exports of import aliases as instantiated since they're ambiguous. This is consistent + // with `export import x = mod.x` being treated as instantiated: + // import x = mod.x; + // export { x }; + found = ModuleInstanceStateInstantiated + } + } + } + if found != ModuleInstanceStateUnknown { + return found + } + } + } + // Couldn't locate, assume could refer to a value + return ModuleInstanceStateInstantiated +} + +func NodeHasName(statement *Node, id *Node) bool { + name := statement.Name() + if name != nil { + return IsIdentifier(name) && name.AsIdentifier().Text == id.AsIdentifier().Text + } + if IsVariableStatement(statement) { + declarations := statement.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes + return core.Some(declarations, func(d *Node) bool { return NodeHasName(d, id) }) + } + return false +} + +func IsInternalModuleImportEqualsDeclaration(node *Node) bool { + return IsImportEqualsDeclaration(node) && node.AsImportEqualsDeclaration().ModuleReference.Kind != KindExternalModuleReference +} + +func GetAssertedTypeNode(node *Node) *Node { + switch node.Kind { + case KindAsExpression: + return node.AsAsExpression().Type + case KindSatisfiesExpression: + return node.AsSatisfiesExpression().Type + case KindTypeAssertionExpression: + return node.AsTypeAssertion().Type + } + panic("Unhandled case in getAssertedTypeNode") +} + +func IsConstAssertion(node *Node) bool { + switch node.Kind { + case KindAsExpression, KindTypeAssertionExpression: + return IsConstTypeReference(GetAssertedTypeNode(node)) + } + return false +} + +func IsConstTypeReference(node *Node) bool { + return IsTypeReferenceNode(node) && len(node.TypeArguments()) == 0 && IsIdentifier(node.AsTypeReferenceNode().TypeName) && node.AsTypeReferenceNode().TypeName.Text() == "const" +} + +func IsGlobalSourceFile(node *Node) bool { + return node.Kind == KindSourceFile && !IsExternalOrCommonJSModule(node.AsSourceFile()) +} + +func IsParameterLike(node *Node) bool { + switch node.Kind { + case KindParameter, KindTypeParameter: + return true + } + return false +} + +func GetDeclarationOfKind(symbol *Symbol, kind Kind) *Node { + for _, declaration := range symbol.Declarations { + if declaration.Kind == kind { + return declaration + } + } + return nil +} + +func FindConstructorDeclaration(node *ClassLikeDeclaration) *Node { + for _, member := range node.ClassLikeData().Members.Nodes { + if IsConstructorDeclaration(member) && NodeIsPresent(member.AsConstructorDeclaration().Body) { + return member + } + } + return nil +} + +func GetFirstIdentifier(node *Node) *Node { + switch node.Kind { + case KindIdentifier: + return node + case KindQualifiedName: + return GetFirstIdentifier(node.AsQualifiedName().Left) + case KindPropertyAccessExpression: + return GetFirstIdentifier(node.AsPropertyAccessExpression().Expression) + } + panic("Unhandled case in GetFirstIdentifier") +} + +func GetNamespaceDeclarationNode(node *Node) *Node { + switch node.Kind { + case KindImportDeclaration, KindJSImportDeclaration: + importClause := node.AsImportDeclaration().ImportClause + if importClause != nil && importClause.AsImportClause().NamedBindings != nil && IsNamespaceImport(importClause.AsImportClause().NamedBindings) { + return importClause.AsImportClause().NamedBindings + } + case KindImportEqualsDeclaration: + return node + case KindExportDeclaration: + exportClause := node.AsExportDeclaration().ExportClause + if exportClause != nil && IsNamespaceExport(exportClause) { + return exportClause + } + default: + panic("Unhandled case in getNamespaceDeclarationNode") + } + return nil +} + +func ModuleExportNameIsDefault(node *Node) bool { + return node.Text() == InternalSymbolNameDefault +} + +func IsDefaultImport(node *Node /*ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration*/) bool { + switch node.Kind { + case KindImportDeclaration, KindJSImportDeclaration: + importClause := node.AsImportDeclaration().ImportClause + return importClause != nil && importClause.AsImportClause().name != nil + } + return false +} + +func GetImpliedNodeFormatForFile(path string, packageJsonType string) core.ModuleKind { + impliedNodeFormat := core.ResolutionModeNone + if tspath.FileExtensionIsOneOf(path, []string{tspath.ExtensionDmts, tspath.ExtensionMts, tspath.ExtensionMjs}) { + impliedNodeFormat = core.ResolutionModeESM + } else if tspath.FileExtensionIsOneOf(path, []string{tspath.ExtensionDcts, tspath.ExtensionCts, tspath.ExtensionCjs}) { + impliedNodeFormat = core.ResolutionModeCommonJS + } else if tspath.FileExtensionIsOneOf(path, []string{tspath.ExtensionDts, tspath.ExtensionTs, tspath.ExtensionTsx, tspath.ExtensionJs, tspath.ExtensionJsx}) { + impliedNodeFormat = core.IfElse(packageJsonType == "module", core.ResolutionModeESM, core.ResolutionModeCommonJS) + } + + return impliedNodeFormat +} + +func GetEmitModuleFormatOfFileWorker(fileName string, options *core.CompilerOptions, sourceFileMetaData SourceFileMetaData) core.ModuleKind { + result := GetImpliedNodeFormatForEmitWorker(fileName, options.GetEmitModuleKind(), sourceFileMetaData) + if result != core.ModuleKindNone { + return result + } + return options.GetEmitModuleKind() +} + +func GetImpliedNodeFormatForEmitWorker(fileName string, emitModuleKind core.ModuleKind, sourceFileMetaData SourceFileMetaData) core.ResolutionMode { + if core.ModuleKindNode16 <= emitModuleKind && emitModuleKind <= core.ModuleKindNodeNext { + return sourceFileMetaData.ImpliedNodeFormat + } + if sourceFileMetaData.ImpliedNodeFormat == core.ModuleKindCommonJS && + (sourceFileMetaData.PackageJsonType == "commonjs" || + tspath.FileExtensionIsOneOf(fileName, []string{tspath.ExtensionCjs, tspath.ExtensionCts})) { + return core.ModuleKindCommonJS + } + if sourceFileMetaData.ImpliedNodeFormat == core.ModuleKindESNext && + (sourceFileMetaData.PackageJsonType == "module" || + tspath.FileExtensionIsOneOf(fileName, []string{tspath.ExtensionMjs, tspath.ExtensionMts})) { + return core.ModuleKindESNext + } + return core.ModuleKindNone +} + +func GetDeclarationContainer(node *Node) *Node { + return FindAncestor(GetRootDeclaration(node), func(node *Node) bool { + switch node.Kind { + case KindVariableDeclaration, + KindVariableDeclarationList, + KindImportSpecifier, + KindNamedImports, + KindNamespaceImport, + KindImportClause: + return false + default: + return true + } + }).Parent +} + +// Indicates that a symbol is an alias that does not merge with a local declaration. +// OR Is a JSContainer which may merge an alias with a local declaration +func IsNonLocalAlias(symbol *Symbol, excludes SymbolFlags) bool { + if symbol == nil { + return false + } + return symbol.Flags&(SymbolFlagsAlias|excludes) == SymbolFlagsAlias || + symbol.Flags&SymbolFlagsAlias != 0 && symbol.Flags&SymbolFlagsAssignment != 0 +} + +// An alias symbol is created by one of the following declarations: +// +// import = ... +// const = ... (JS only) +// const { , ... } = ... (JS only) +// import from ... +// import * as from ... +// import { x as } from ... +// export { x as } from ... +// export * as ns from ... +// export = +// export default +// module.exports = (JS only) +func IsAliasSymbolDeclaration(node *Node) bool { + switch node.Kind { + case KindImportEqualsDeclaration, KindNamespaceExportDeclaration, KindNamespaceImport, KindNamespaceExport, + KindImportSpecifier, KindExportSpecifier: + return true + case KindImportClause: + return node.AsImportClause().Name() != nil + case KindExportAssignment, KindJSExportAssignment: + return ExportAssignmentIsAlias(node) + case KindVariableDeclaration, KindBindingElement: + return IsVariableDeclarationInitializedToRequire(node) + } + return false +} + +func IsParseTreeNode(node *Node) bool { + return node.Flags&NodeFlagsSynthesized == 0 +} + +// Returns a token if position is in [start-of-leading-trivia, end), includes JSDoc only if requested +func GetNodeAtPosition(file *SourceFile, position int, includeJSDoc bool) *Node { + current := file.AsNode() + for { + var child *Node + if includeJSDoc { + for _, jsdoc := range current.JSDoc(file) { + if nodeContainsPosition(jsdoc, position) { + child = jsdoc + break + } + } + } + if child == nil { + current.ForEachChild(func(node *Node) bool { + if nodeContainsPosition(node, position) { + child = node + return true + } + return false + }) + } + if child == nil || IsMetaProperty(child) { + return current + } + current = child + } +} + +func nodeContainsPosition(node *Node, position int) bool { + return node.Kind >= KindFirstNode && node.Pos() <= position && (position < node.End() || position == node.End() && node.Kind == KindEndOfFile) +} + +func findImportOrRequire(text string, start int) (index int, size int) { + index = max(start, 0) + n := len(text) + for index < n { + next := strings.IndexAny(text[index:], "ir") + if next < 0 { + break + } + index += next + + var expected string + if text[index] == 'i' { + size = 6 + expected = "import" + } else { + size = 7 + expected = "require" + } + if index+size <= n && text[index:index+size] == expected { + return index, size + } + index++ + } + + return -1, 0 +} + +func ForEachDynamicImportOrRequireCall( + file *SourceFile, + includeTypeSpaceImports bool, + requireStringLiteralLikeArgument bool, + cb func(node *Node, argument *Expression) bool, +) bool { + isJavaScriptFile := IsInJSFile(file.AsNode()) + lastIndex, size := findImportOrRequire(file.Text(), 0) + for lastIndex >= 0 { + node := GetNodeAtPosition(file, lastIndex, isJavaScriptFile && includeTypeSpaceImports) + if isJavaScriptFile && IsRequireCall(node, requireStringLiteralLikeArgument) { + if cb(node, node.Arguments()[0]) { + return true + } + } else if IsImportCall(node) && len(node.Arguments()) > 0 && (!requireStringLiteralLikeArgument || IsStringLiteralLike(node.Arguments()[0])) { + if cb(node, node.Arguments()[0]) { + return true + } + } else if includeTypeSpaceImports && IsLiteralImportTypeNode(node) { + if cb(node, node.AsImportTypeNode().Argument.AsLiteralTypeNode().Literal) { + return true + } + } + // skip past import/require + lastIndex += size + lastIndex, size = findImportOrRequire(file.Text(), lastIndex) + } + return false +} + +// Returns true if the node is a CallExpression to the identifier 'require' with +// exactly one argument (of the form 'require("name")'). +// This function does not test if the node is in a JavaScript file or not. +func IsRequireCall(node *Node, requireStringLiteralLikeArgument bool) bool { + if !IsCallExpression(node) { + return false + } + call := node.AsCallExpression() + if !IsIdentifier(call.Expression) || call.Expression.Text() != "require" { + return false + } + if len(call.Arguments.Nodes) != 1 { + return false + } + return !requireStringLiteralLikeArgument || IsStringLiteralLike(call.Arguments.Nodes[0]) +} + +func IsRequireVariableStatement(node *Node) bool { + if IsVariableStatement(node) { + if declarations := node.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes; len(declarations) > 0 { + return core.Every(declarations, IsVariableDeclarationInitializedToRequire) + } + } + return false +} + +func GetJSXImplicitImportBase(compilerOptions *core.CompilerOptions, file *SourceFile) string { + jsxImportSourcePragma := GetPragmaFromSourceFile(file, "jsximportsource") + jsxRuntimePragma := GetPragmaFromSourceFile(file, "jsxruntime") + if GetPragmaArgument(jsxRuntimePragma, "factory") == "classic" { + return "" + } + if compilerOptions.Jsx == core.JsxEmitReactJSX || + compilerOptions.Jsx == core.JsxEmitReactJSXDev || + compilerOptions.JsxImportSource != "" || + jsxImportSourcePragma != nil || + GetPragmaArgument(jsxRuntimePragma, "factory") == "automatic" { + result := GetPragmaArgument(jsxImportSourcePragma, "factory") + if result == "" { + result = compilerOptions.JsxImportSource + } + if result == "" { + result = "react" + } + return result + } + return "" +} + +func GetJSXRuntimeImport(base string, options *core.CompilerOptions) string { + if base == "" { + return base + } + return base + "/" + core.IfElse(options.Jsx == core.JsxEmitReactJSXDev, "jsx-dev-runtime", "jsx-runtime") +} + +func GetPragmaFromSourceFile(file *SourceFile, name string) *Pragma { + var result *Pragma + if file != nil { + for i := range file.Pragmas { + if file.Pragmas[i].Name == name { + result = &file.Pragmas[i] // Last one wins + } + } + } + return result +} + +func GetPragmaArgument(pragma *Pragma, name string) string { + if pragma != nil { + if arg, ok := pragma.Args[name]; ok { + return arg.Value + } + } + return "" +} + +// Of the form: `const x = require("x")` or `const { x } = require("x")` or with `var` or `let` +// The variable must not be exported and must not have a type annotation, even a jsdoc one. +// The initializer must be a call to `require` with a string literal or a string literal-like argument. +func IsVariableDeclarationInitializedToRequire(node *Node) bool { + if !IsInJSFile(node) { + return false + } + if node.Kind == KindBindingElement { + node = node.Parent.Parent + } + if node.Kind != KindVariableDeclaration { + return false + } + + return node.Parent.Parent.ModifierFlags()&ModifierFlagsExport == 0 && + node.AsVariableDeclaration().Initializer != nil && + node.Type() == nil && + IsRequireCall(node.AsVariableDeclaration().Initializer, true /*requireStringLiteralLikeArgument*/) +} + +func IsModuleExportsAccessExpression(node *Node) bool { + if IsAccessExpression(node) && IsModuleIdentifier(node.Expression()) { + if name := GetElementOrPropertyAccessName(node); name != nil { + return name.Text() == "exports" + } + } + return false +} + +func IsCheckJSEnabledForFile(sourceFile *SourceFile, compilerOptions *core.CompilerOptions) bool { + if sourceFile.CheckJsDirective != nil { + return sourceFile.CheckJsDirective.Enabled + } + return compilerOptions.CheckJs == core.TSTrue +} + +func IsPlainJSFile(file *SourceFile, checkJs core.Tristate) bool { + return file != nil && (file.ScriptKind == core.ScriptKindJS || file.ScriptKind == core.ScriptKindJSX) && file.CheckJsDirective == nil && checkJs == core.TSUnknown +} + +func GetLeftmostAccessExpression(expr *Node) *Node { + for IsAccessExpression(expr) { + expr = expr.Expression() + } + return expr +} + +func IsTypeOnlyImportDeclaration(node *Node) bool { + switch node.Kind { + case KindImportSpecifier: + return node.IsTypeOnly() || node.Parent.Parent.IsTypeOnly() + case KindNamespaceImport: + return node.Parent.IsTypeOnly() + case KindImportClause, KindImportEqualsDeclaration: + return node.IsTypeOnly() + } + return false +} + +func isTypeOnlyExportDeclaration(node *Node) bool { + switch node.Kind { + case KindExportSpecifier: + return node.AsExportSpecifier().IsTypeOnly || node.Parent.Parent.AsExportDeclaration().IsTypeOnly + case KindExportDeclaration: + d := node.AsExportDeclaration() + return d.IsTypeOnly && d.ModuleSpecifier != nil && d.ExportClause == nil + case KindNamespaceExport: + return node.Parent.AsExportDeclaration().IsTypeOnly + } + return false +} + +func IsTypeOnlyImportOrExportDeclaration(node *Node) bool { + return IsTypeOnlyImportDeclaration(node) || isTypeOnlyExportDeclaration(node) +} + +func IsExclusivelyTypeOnlyImportOrExport(node *Node) bool { + switch node.Kind { + case KindExportDeclaration: + return node.AsExportDeclaration().IsTypeOnly + case KindImportDeclaration, KindJSImportDeclaration: + if importClause := node.AsImportDeclaration().ImportClause; importClause != nil { + return importClause.AsImportClause().IsTypeOnly() + } + case KindJSDocImportTag: + if importClause := node.AsJSDocImportTag().ImportClause; importClause != nil { + return importClause.AsImportClause().IsTypeOnly() + } + } + return false +} + +func GetClassLikeDeclarationOfSymbol(symbol *Symbol) *Node { + return core.Find(symbol.Declarations, IsClassLike) +} + +func IsCallLikeExpression(node *Node) bool { + switch node.Kind { + case KindJsxOpeningElement, KindJsxSelfClosingElement, KindJsxOpeningFragment, KindCallExpression, KindNewExpression, + KindTaggedTemplateExpression, KindDecorator: + return true + case KindBinaryExpression: + return node.AsBinaryExpression().OperatorToken.Kind == KindInstanceOfKeyword + } + return false +} + +func IsJsxCallLike(node *Node) bool { + switch node.Kind { + case KindJsxOpeningElement, KindJsxSelfClosingElement, KindJsxOpeningFragment: + return true + } + return false +} + +func IsCallLikeOrFunctionLikeExpression(node *Node) bool { + return IsCallLikeExpression(node) || IsFunctionExpressionOrArrowFunction(node) +} + +func NodeHasKind(node *Node, kind Kind) bool { + if node == nil { + return false + } + return node.Kind == kind +} + +func IsContextualKeyword(token Kind) bool { + return KindFirstContextualKeyword <= token && token <= KindLastContextualKeyword +} + +func IsThisInTypeQuery(node *Node) bool { + if !IsThisIdentifier(node) { + return false + } + for IsQualifiedName(node.Parent) && node.Parent.AsQualifiedName().Left == node { + node = node.Parent + } + return node.Parent.Kind == KindTypeQuery +} + +// Gets whether a bound `VariableDeclaration` or `VariableDeclarationList` is part of a `let` declaration. +func IsLet(node *Node) bool { + return GetCombinedNodeFlags(node)&NodeFlagsBlockScoped == NodeFlagsLet +} + +func IsClassMemberModifier(token Kind) bool { + return IsParameterPropertyModifier(token) || token == KindStaticKeyword || + token == KindOverrideKeyword || token == KindAccessorKeyword +} + +func IsParameterPropertyModifier(kind Kind) bool { + return ModifierToFlag(kind)&ModifierFlagsParameterPropertyModifier != 0 +} + +func ForEachChildAndJSDoc(node *Node, sourceFile *SourceFile, v Visitor) bool { + if node.Flags&NodeFlagsHasJSDoc != 0 { + if visitNodes(v, node.JSDoc(sourceFile)) { + return true + } + } + return node.ForEachChild(v) +} + +func IsTypeReferenceType(node *Node) bool { + return node.Kind == KindTypeReference || node.Kind == KindExpressionWithTypeArguments +} + +func IsVariableLike(node *Node) bool { + switch node.Kind { + case KindBindingElement, KindEnumMember, KindParameter, KindPropertyAssignment, KindPropertyDeclaration, + KindPropertySignature, KindShorthandPropertyAssignment, KindVariableDeclaration: + return true + } + return false +} + +func HasInitializer(node *Node) bool { + switch node.Kind { + case KindVariableDeclaration, KindParameter, KindBindingElement, KindPropertyDeclaration, + KindPropertyAssignment, KindEnumMember, KindForStatement, KindForInStatement, KindForOfStatement, + KindJsxAttribute: + return node.Initializer() != nil + default: + return false + } +} + +func GetTypeAnnotationNode(node *Node) *TypeNode { + switch node.Kind { + case KindVariableDeclaration, KindParameter, KindPropertySignature, KindPropertyDeclaration, + KindTypePredicate, KindParenthesizedType, KindTypeOperator, KindMappedType, KindTypeAssertionExpression, + KindAsExpression, KindSatisfiesExpression, KindTypeAliasDeclaration, KindJSTypeAliasDeclaration, + KindNamedTupleMember, KindOptionalType, KindRestType, KindTemplateLiteralTypeSpan, KindJSDocTypeExpression, + KindJSDocPropertyTag, KindJSDocNullableType, KindJSDocNonNullableType, KindJSDocOptionalType: + return node.Type() + default: + funcLike := node.FunctionLikeData() + if funcLike != nil { + return funcLike.Type + } + return nil + } +} + +func IsObjectTypeDeclaration(node *Node) bool { + return IsClassLike(node) || IsInterfaceDeclaration(node) || IsTypeLiteralNode(node) +} + +func IsClassOrTypeElement(node *Node) bool { + return IsClassElement(node) || IsTypeElement(node) +} + +func GetClassExtendsHeritageElement(node *Node) *ExpressionWithTypeArgumentsNode { + heritageElements := GetHeritageElements(node, KindExtendsKeyword) + if len(heritageElements) > 0 { + return heritageElements[0] + } + return nil +} + +func GetImplementsTypeNodes(node *Node) []*ExpressionWithTypeArgumentsNode { + return GetHeritageElements(node, KindImplementsKeyword) +} + +func IsTypeKeywordToken(node *Node) bool { + return node.Kind == KindTypeKeyword +} + +// See `IsJSDocSingleCommentNode`. +func IsJSDocSingleCommentNodeList(nodeList *NodeList) bool { + if nodeList == nil || len(nodeList.Nodes) == 0 { + return false + } + parent := nodeList.Nodes[0].Parent + return IsJSDocSingleCommentNode(parent) && nodeList == parent.CommentList() +} + +// See `IsJSDocSingleCommentNode`. +func IsJSDocSingleCommentNodeComment(node *Node) bool { + if node == nil || node.Parent == nil { + return false + } + return IsJSDocSingleCommentNode(node.Parent) && node == node.Parent.CommentList().Nodes[0] +} + +// In Strada, if a JSDoc node has a single comment, that comment is represented as a string property +// as a simplification, and therefore that comment is not visited by `forEachChild`. +func IsJSDocSingleCommentNode(node *Node) bool { + return hasComment(node.Kind) && node.CommentList() != nil && len(node.CommentList().Nodes) == 1 +} + +func IsValidTypeOnlyAliasUseSite(useSite *Node) bool { + return useSite.Flags&(NodeFlagsAmbient|NodeFlagsJSDoc) != 0 || + IsPartOfTypeQuery(useSite) || + isIdentifierInNonEmittingHeritageClause(useSite) || + isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite) || + !(IsExpressionNode(useSite) || isShorthandPropertyNameUseSite(useSite)) +} + +func isIdentifierInNonEmittingHeritageClause(node *Node) bool { + if !IsIdentifier(node) { + return false + } + parent := node.Parent + for IsPropertyAccessExpression(parent) || IsExpressionWithTypeArguments(parent) { + parent = parent.Parent + } + return IsHeritageClause(parent) && (parent.AsHeritageClause().Token == KindImplementsKeyword || IsInterfaceDeclaration(parent.Parent)) +} + +func isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node *Node) bool { + for NodeKindIs(node, KindIdentifier, KindPropertyAccessExpression) { + node = node.Parent + } + if node.Kind != KindComputedPropertyName { + return false + } + if HasSyntacticModifier(node.Parent, ModifierFlagsAbstract) { + return true + } + return NodeKindIs(node.Parent.Parent, KindInterfaceDeclaration, KindTypeLiteral) +} + +func isShorthandPropertyNameUseSite(useSite *Node) bool { + return IsIdentifier(useSite) && IsShorthandPropertyAssignment(useSite.Parent) && useSite.Parent.AsShorthandPropertyAssignment().Name() == useSite +} + +func GetPropertyNameForPropertyNameNode(name *Node) string { + switch name.Kind { + case KindIdentifier, KindPrivateIdentifier, KindStringLiteral, KindNoSubstitutionTemplateLiteral, + KindNumericLiteral, KindBigIntLiteral, KindJsxNamespacedName: + return name.Text() + case KindComputedPropertyName: + nameExpression := name.AsComputedPropertyName().Expression + if IsStringOrNumericLiteralLike(nameExpression) { + return nameExpression.Text() + } + if IsSignedNumericLiteral(nameExpression) { + text := nameExpression.AsPrefixUnaryExpression().Operand.Text() + if nameExpression.AsPrefixUnaryExpression().Operator == KindMinusToken { + text = "-" + text + } + return text + } + return InternalSymbolNameMissing + } + panic("Unhandled case in getPropertyNameForPropertyNameNode") +} + +func IsPartOfTypeOnlyImportOrExportDeclaration(node *Node) bool { + return FindAncestor(node, IsTypeOnlyImportOrExportDeclaration) != nil +} + +func IsPartOfExclusivelyTypeOnlyImportOrExportDeclaration(node *Node) bool { + return FindAncestor(node, IsExclusivelyTypeOnlyImportOrExport) != nil +} + +func IsEmittableImport(node *Node) bool { + switch node.Kind { + case KindImportDeclaration: + return node.AsImportDeclaration().ImportClause != nil && !node.AsImportDeclaration().ImportClause.IsTypeOnly() + case KindExportDeclaration: + return !node.AsExportDeclaration().IsTypeOnly + case KindImportEqualsDeclaration: + return !node.AsImportEqualsDeclaration().IsTypeOnly + case KindCallExpression: + return IsImportCall(node) + } + return false +} + +func IsResolutionModeOverrideHost(node *Node) bool { + if node == nil { + return false + } + switch node.Kind { + case KindImportType, KindExportDeclaration, KindImportDeclaration, KindJSImportDeclaration: + return true + } + return false +} + +func HasResolutionModeOverride(node *Node) bool { + if node == nil { + return false + } + var attributes *ImportAttributesNode + switch node.Kind { + case KindImportType: + attributes = node.AsImportTypeNode().Attributes + case KindImportDeclaration, KindJSImportDeclaration: + attributes = node.AsImportDeclaration().Attributes + case KindExportDeclaration: + attributes = node.AsExportDeclaration().Attributes + } + if attributes != nil { + _, ok := attributes.GetResolutionModeOverride() + return ok + } + return false +} + +func IsStringTextContainingNode(node *Node) bool { + return node.Kind == KindStringLiteral || IsTemplateLiteralKind(node.Kind) +} + +func IsTemplateLiteralKind(kind Kind) bool { + return KindFirstTemplateToken <= kind && kind <= KindLastTemplateToken +} + +func IsTemplateLiteralToken(node *Node) bool { + return IsTemplateLiteralKind(node.Kind) +} + +func GetExternalModuleImportEqualsDeclarationExpression(node *Node) *Node { + debug.Assert(IsExternalModuleImportEqualsDeclaration(node)) + return node.AsImportEqualsDeclaration().ModuleReference.AsExternalModuleReference().Expression +} + +func CreateModifiersFromModifierFlags(flags ModifierFlags, createModifier func(kind Kind) *Node) []*Node { + var result []*Node + if flags&ModifierFlagsExport != 0 { + result = append(result, createModifier(KindExportKeyword)) + } + if flags&ModifierFlagsAmbient != 0 { + result = append(result, createModifier(KindDeclareKeyword)) + } + if flags&ModifierFlagsDefault != 0 { + result = append(result, createModifier(KindDefaultKeyword)) + } + if flags&ModifierFlagsConst != 0 { + result = append(result, createModifier(KindConstKeyword)) + } + if flags&ModifierFlagsPublic != 0 { + result = append(result, createModifier(KindPublicKeyword)) + } + if flags&ModifierFlagsPrivate != 0 { + result = append(result, createModifier(KindPrivateKeyword)) + } + if flags&ModifierFlagsProtected != 0 { + result = append(result, createModifier(KindProtectedKeyword)) + } + if flags&ModifierFlagsAbstract != 0 { + result = append(result, createModifier(KindAbstractKeyword)) + } + if flags&ModifierFlagsStatic != 0 { + result = append(result, createModifier(KindStaticKeyword)) + } + if flags&ModifierFlagsOverride != 0 { + result = append(result, createModifier(KindOverrideKeyword)) + } + if flags&ModifierFlagsReadonly != 0 { + result = append(result, createModifier(KindReadonlyKeyword)) + } + if flags&ModifierFlagsAccessor != 0 { + result = append(result, createModifier(KindAccessorKeyword)) + } + if flags&ModifierFlagsAsync != 0 { + result = append(result, createModifier(KindAsyncKeyword)) + } + if flags&ModifierFlagsIn != 0 { + result = append(result, createModifier(KindInKeyword)) + } + if flags&ModifierFlagsOut != 0 { + result = append(result, createModifier(KindOutKeyword)) + } + return result +} + +func GetThisParameter(signature *Node) *Node { + // callback tags do not currently support this parameters + if len(signature.Parameters()) != 0 { + thisParameter := signature.Parameters()[0] + if IsThisParameter(thisParameter) { + return thisParameter + } + } + return nil +} + +func ReplaceModifiers(factory *NodeFactory, node *Node, modifierArray *ModifierList) *Node { + switch node.Kind { + case KindTypeParameter: + return factory.UpdateTypeParameterDeclaration( + node.AsTypeParameter(), + modifierArray, + node.Name(), + node.AsTypeParameter().Constraint, + node.AsTypeParameter().DefaultType, + ) + case KindParameter: + return factory.UpdateParameterDeclaration( + node.AsParameterDeclaration(), + modifierArray, + node.AsParameterDeclaration().DotDotDotToken, + node.Name(), + node.AsParameterDeclaration().QuestionToken, + node.Type(), + node.Initializer(), + ) + case KindConstructorType: + return factory.UpdateConstructorTypeNode( + node.AsConstructorTypeNode(), + modifierArray, + node.TypeParameterList(), + node.ParameterList(), + node.Type(), + ) + case KindPropertySignature: + return factory.UpdatePropertySignatureDeclaration( + node.AsPropertySignatureDeclaration(), + modifierArray, + node.Name(), + node.AsPropertySignatureDeclaration().PostfixToken, + node.Type(), + node.Initializer(), + ) + case KindPropertyDeclaration: + return factory.UpdatePropertyDeclaration( + node.AsPropertyDeclaration(), + modifierArray, + node.Name(), + node.AsPropertyDeclaration().PostfixToken, + node.Type(), + node.Initializer(), + ) + case KindMethodSignature: + return factory.UpdateMethodSignatureDeclaration( + node.AsMethodSignatureDeclaration(), + modifierArray, + node.Name(), + node.AsMethodSignatureDeclaration().PostfixToken, + node.TypeParameterList(), + node.ParameterList(), + node.Type(), + ) + case KindMethodDeclaration: + return factory.UpdateMethodDeclaration( + node.AsMethodDeclaration(), + modifierArray, + node.AsMethodDeclaration().AsteriskToken, + node.Name(), + node.AsMethodDeclaration().PostfixToken, + node.TypeParameterList(), + node.ParameterList(), + node.Type(), + node.AsMethodDeclaration().FullSignature, + node.Body(), + ) + case KindConstructor: + return factory.UpdateConstructorDeclaration( + node.AsConstructorDeclaration(), + modifierArray, + node.TypeParameterList(), + node.ParameterList(), + node.Type(), + node.AsConstructorDeclaration().FullSignature, + node.Body(), + ) + case KindGetAccessor: + return factory.UpdateGetAccessorDeclaration( + node.AsGetAccessorDeclaration(), + modifierArray, + node.Name(), + node.TypeParameterList(), + node.ParameterList(), + node.Type(), + node.AsGetAccessorDeclaration().FullSignature, + node.Body(), + ) + case KindSetAccessor: + return factory.UpdateSetAccessorDeclaration( + node.AsSetAccessorDeclaration(), + modifierArray, + node.Name(), + node.TypeParameterList(), + node.ParameterList(), + node.Type(), + node.AsSetAccessorDeclaration().FullSignature, + node.Body(), + ) + case KindIndexSignature: + return factory.UpdateIndexSignatureDeclaration( + node.AsIndexSignatureDeclaration(), + modifierArray, + node.ParameterList(), + node.Type(), + ) + case KindFunctionExpression: + return factory.UpdateFunctionExpression( + node.AsFunctionExpression(), + modifierArray, + node.AsFunctionExpression().AsteriskToken, + node.Name(), + node.TypeParameterList(), + node.ParameterList(), + node.Type(), + node.AsFunctionExpression().FullSignature, + node.Body(), + ) + case KindArrowFunction: + return factory.UpdateArrowFunction( + node.AsArrowFunction(), + modifierArray, + node.TypeParameterList(), + node.ParameterList(), + node.Type(), + node.AsArrowFunction().FullSignature, + node.AsArrowFunction().EqualsGreaterThanToken, + node.Body(), + ) + case KindClassExpression: + return factory.UpdateClassExpression( + node.AsClassExpression(), + modifierArray, + node.Name(), + node.TypeParameterList(), + node.AsClassExpression().HeritageClauses, + node.MemberList(), + ) + case KindVariableStatement: + return factory.UpdateVariableStatement( + node.AsVariableStatement(), + modifierArray, + node.AsVariableStatement().DeclarationList, + ) + case KindFunctionDeclaration: + return factory.UpdateFunctionDeclaration( + node.AsFunctionDeclaration(), + modifierArray, + node.AsFunctionDeclaration().AsteriskToken, + node.Name(), + node.TypeParameterList(), + node.ParameterList(), + node.Type(), + node.AsFunctionDeclaration().FullSignature, + node.Body(), + ) + case KindClassDeclaration: + return factory.UpdateClassDeclaration( + node.AsClassDeclaration(), + modifierArray, + node.Name(), + node.TypeParameterList(), + node.AsClassDeclaration().HeritageClauses, + node.MemberList(), + ) + case KindInterfaceDeclaration: + return factory.UpdateInterfaceDeclaration( + node.AsInterfaceDeclaration(), + modifierArray, + node.Name(), + node.TypeParameterList(), + node.AsInterfaceDeclaration().HeritageClauses, + node.MemberList(), + ) + case KindTypeAliasDeclaration: + return factory.UpdateTypeAliasDeclaration( + node.AsTypeAliasDeclaration(), + modifierArray, + node.Name(), + node.TypeParameterList(), + node.Type(), + ) + case KindEnumDeclaration: + return factory.UpdateEnumDeclaration( + node.AsEnumDeclaration(), + modifierArray, + node.Name(), + node.MemberList(), + ) + case KindModuleDeclaration: + return factory.UpdateModuleDeclaration( + node.AsModuleDeclaration(), + modifierArray, + node.AsModuleDeclaration().Keyword, + node.Name(), + node.Body(), + ) + case KindImportEqualsDeclaration: + return factory.UpdateImportEqualsDeclaration( + node.AsImportEqualsDeclaration(), + modifierArray, + node.IsTypeOnly(), + node.Name(), + node.AsImportEqualsDeclaration().ModuleReference, + ) + case KindImportDeclaration: + return factory.UpdateImportDeclaration( + node.AsImportDeclaration(), + modifierArray, + node.AsImportDeclaration().ImportClause, + node.AsImportDeclaration().ModuleSpecifier, + node.AsImportDeclaration().Attributes, + ) + case KindExportAssignment: + return factory.UpdateExportAssignment( + node.AsExportAssignment(), + modifierArray, + node.Type(), + node.Expression(), + ) + case KindExportDeclaration: + return factory.UpdateExportDeclaration( + node.AsExportDeclaration(), + modifierArray, + node.IsTypeOnly(), + node.AsExportDeclaration().ExportClause, + node.AsExportDeclaration().ModuleSpecifier, + node.AsExportDeclaration().Attributes, + ) + } + panic(fmt.Sprintf("Node that does not have modifiers tried to have modifier replaced: %d", node.Kind)) +} + +func IsLateVisibilityPaintedStatement(node *Node) bool { + switch node.Kind { + case KindImportDeclaration, + KindJSImportDeclaration, + KindImportEqualsDeclaration, + KindVariableStatement, + KindClassDeclaration, + KindFunctionDeclaration, + KindModuleDeclaration, + KindTypeAliasDeclaration, + KindJSTypeAliasDeclaration, + KindInterfaceDeclaration, + KindEnumDeclaration: + return true + default: + return false + } +} + +func IsExternalModuleAugmentation(node *Node) bool { + return IsAmbientModule(node) && IsModuleAugmentationExternal(node) +} + +func GetSourceFileOfModule(module *Symbol) *SourceFile { + declaration := module.ValueDeclaration + if declaration == nil { + declaration = getNonAugmentationDeclaration(module) + } + return GetSourceFileOfNode(declaration) +} + +func getNonAugmentationDeclaration(symbol *Symbol) *Node { + return core.Find(symbol.Declarations, func(d *Node) bool { + return !IsExternalModuleAugmentation(d) && !IsGlobalScopeAugmentation(d) + }) +} + +func IsTypeDeclaration(node *Node) bool { + switch node.Kind { + case KindTypeParameter, KindClassDeclaration, KindInterfaceDeclaration, KindTypeAliasDeclaration, KindJSTypeAliasDeclaration, KindEnumDeclaration: + return true + case KindImportClause: + return node.AsImportClause().PhaseModifier == KindTypeKeyword + case KindImportSpecifier: + return node.Parent.Parent.AsImportClause().PhaseModifier == KindTypeKeyword + case KindExportSpecifier: + return node.Parent.Parent.AsExportDeclaration().IsTypeOnly + default: + return false + } +} + +func IsTypeDeclarationName(name *Node) bool { + return name.Kind == KindIdentifier && + IsTypeDeclaration(name.Parent) && + GetNameOfDeclaration(name.Parent) == name +} + +func IsRightSideOfQualifiedNameOrPropertyAccess(node *Node) bool { + parent := node.Parent + switch parent.Kind { + case KindQualifiedName: + return parent.AsQualifiedName().Right == node + case KindPropertyAccessExpression: + return parent.AsPropertyAccessExpression().Name() == node + case KindMetaProperty: + return parent.AsMetaProperty().Name() == node + } + return false +} + +func ShouldTransformImportCall(fileName string, options *core.CompilerOptions, impliedNodeFormatForEmit core.ModuleKind) bool { + moduleKind := options.GetEmitModuleKind() + if core.ModuleKindNode16 <= moduleKind && moduleKind <= core.ModuleKindNodeNext || moduleKind == core.ModuleKindPreserve { + return false + } + return impliedNodeFormatForEmit < core.ModuleKindES2015 +} + +func HasQuestionToken(node *Node) bool { + return IsQuestionToken(node.PostfixToken()) +} + +func IsJsxOpeningLikeElement(node *Node) bool { + return IsJsxOpeningElement(node) || IsJsxSelfClosingElement(node) +} + +func GetInvokedExpression(node *Node) *Node { + switch node.Kind { + case KindTaggedTemplateExpression: + return node.AsTaggedTemplateExpression().Tag + case KindJsxOpeningElement, KindJsxSelfClosingElement: + return node.TagName() + case KindBinaryExpression: + return node.AsBinaryExpression().Right + case KindJsxOpeningFragment: + return node + default: + return node.Expression() + } +} + +func IsCallOrNewExpression(node *Node) bool { + return IsCallExpression(node) || IsNewExpression(node) +} + +func IndexOfNode(nodes []*Node, node *Node) int { + index, ok := slices.BinarySearchFunc(nodes, node, compareNodePositions) + if ok { + return index + } + return -1 +} + +func compareNodePositions(n1, n2 *Node) int { + return n1.Pos() - n2.Pos() +} + +func IsUnterminatedLiteral(node *Node) bool { + return IsLiteralKind(node.Kind) && node.LiteralLikeData().TokenFlags&TokenFlagsUnterminated != 0 || + IsTemplateLiteralKind(node.Kind) && node.TemplateLiteralLikeData().TemplateFlags&TokenFlagsUnterminated != 0 +} + +// Gets a value indicating whether a class element is either a static or an instance property declaration with an initializer. +func IsInitializedProperty(member *ClassElement) bool { + return member.Kind == KindPropertyDeclaration && + member.Initializer() != nil +} + +func IsTrivia(token Kind) bool { + return KindFirstTriviaToken <= token && token <= KindLastTriviaToken +} + +func HasDecorators(node *Node) bool { + return HasSyntacticModifier(node, ModifierFlagsDecorator) +} + +type hasFileNameImpl struct { + fileName string + path tspath.Path +} + +func NewHasFileName(fileName string, path tspath.Path) HasFileName { + return &hasFileNameImpl{ + fileName: fileName, + path: path, + } +} + +func (h *hasFileNameImpl) FileName() string { + return h.fileName +} + +func (h *hasFileNameImpl) Path() tspath.Path { + return h.path +} + +func GetSemanticJsxChildren(children []*JsxChild) []*JsxChild { + return core.Filter(children, func(i *JsxChild) bool { + switch i.Kind { + case KindJsxExpression: + return i.Expression() != nil + case KindJsxText: + return !i.AsJsxText().ContainsOnlyTriviaWhiteSpaces + default: + return true + } + }) +} + +// Returns true if the node kind has a comment property. +func hasComment(kind Kind) bool { + switch kind { + case KindJSDoc, KindJSDocTag, KindJSDocAugmentsTag, KindJSDocImplementsTag, + KindJSDocDeprecatedTag, KindJSDocPublicTag, KindJSDocPrivateTag, KindJSDocProtectedTag, + KindJSDocReadonlyTag, KindJSDocOverrideTag, KindJSDocCallbackTag, KindJSDocOverloadTag, + KindJSDocParameterTag, KindJSDocPropertyTag, KindJSDocReturnTag, KindJSDocThisTag, + KindJSDocTypeTag, KindJSDocTemplateTag, KindJSDocTypedefTag, KindJSDocSeeTag, + KindJSDocSatisfiesTag, KindJSDocImportTag: + return true + default: + return false + } +} + +func IsAssignmentPattern(node *Node) bool { + return node.Kind == KindArrayLiteralExpression || node.Kind == KindObjectLiteralExpression +} + +func GetElementsOfBindingOrAssignmentPattern(name *Node) []*Node { + switch name.Kind { + case KindObjectBindingPattern, KindArrayBindingPattern: + // `a` in `{a}` + // `a` in `[a]` + return name.AsBindingPattern().Elements.Nodes + case KindArrayLiteralExpression: + // `a` in `[a]` + return name.AsArrayLiteralExpression().Elements.Nodes + case KindObjectLiteralExpression: + // `a` in `{a}` + return name.AsObjectLiteralExpression().Properties.Nodes + } + return nil +} + +func IsDeclarationBindingElement(bindingElement *Node) bool { + switch bindingElement.Kind { + case KindVariableDeclaration, KindParameter, KindBindingElement: + return true + default: + return false + } +} + +/** + * Gets the name of an BindingOrAssignmentElement. + */ +func GetTargetOfBindingOrAssignmentElement(bindingElement *Node) *Node { + if IsDeclarationBindingElement(bindingElement) { + // `a` in `let { a } = ...` + // `a` in `let { a = 1 } = ...` + // `b` in `let { a: b } = ...` + // `b` in `let { a: b = 1 } = ...` + // `a` in `let { ...a } = ...` + // `{b}` in `let { a: {b} } = ...` + // `{b}` in `let { a: {b} = 1 } = ...` + // `[b]` in `let { a: [b] } = ...` + // `[b]` in `let { a: [b] = 1 } = ...` + // `a` in `let [a] = ...` + // `a` in `let [a = 1] = ...` + // `a` in `let [...a] = ...` + // `{a}` in `let [{a}] = ...` + // `{a}` in `let [{a} = 1] = ...` + // `[a]` in `let [[a]] = ...` + // `[a]` in `let [[a] = 1] = ...` + return bindingElement.Name() + } + + if IsObjectLiteralElement(bindingElement) { + switch bindingElement.Kind { + case KindPropertyAssignment: + // `b` in `({ a: b } = ...)` + // `b` in `({ a: b = 1 } = ...)` + // `{b}` in `({ a: {b} } = ...)` + // `{b}` in `({ a: {b} = 1 } = ...)` + // `[b]` in `({ a: [b] } = ...)` + // `[b]` in `({ a: [b] = 1 } = ...)` + // `b.c` in `({ a: b.c } = ...)` + // `b.c` in `({ a: b.c = 1 } = ...)` + // `b[0]` in `({ a: b[0] } = ...)` + // `b[0]` in `({ a: b[0] = 1 } = ...)` + return GetTargetOfBindingOrAssignmentElement(bindingElement.Initializer()) + case KindShorthandPropertyAssignment: + // `a` in `({ a } = ...)` + // `a` in `({ a = 1 } = ...)` + return bindingElement.Name() + case KindSpreadAssignment: + // `a` in `({ ...a } = ...)` + return GetTargetOfBindingOrAssignmentElement(bindingElement.AsSpreadAssignment().Expression) + } + + // no target + return nil + } + + if IsAssignmentExpression(bindingElement /*excludeCompoundAssignment*/, true) { + // `a` in `[a = 1] = ...` + // `{a}` in `[{a} = 1] = ...` + // `[a]` in `[[a] = 1] = ...` + // `a.b` in `[a.b = 1] = ...` + // `a[0]` in `[a[0] = 1] = ...` + return GetTargetOfBindingOrAssignmentElement(bindingElement.AsBinaryExpression().Left) + } + + if IsSpreadElement(bindingElement) { + // `a` in `[...a] = ...` + return GetTargetOfBindingOrAssignmentElement(bindingElement.AsSpreadElement().Expression) + } + + // `a` in `[a] = ...` + // `{a}` in `[{a}] = ...` + // `[a]` in `[[a]] = ...` + // `a.b` in `[a.b] = ...` + // `a[0]` in `[a[0]] = ...` + return bindingElement +} + +func TryGetPropertyNameOfBindingOrAssignmentElement(bindingElement *Node) *Node { + switch bindingElement.Kind { + case KindBindingElement: + // `a` in `let { a: b } = ...` + // `[a]` in `let { [a]: b } = ...` + // `"a"` in `let { "a": b } = ...` + // `1` in `let { 1: b } = ...` + if bindingElement.AsBindingElement().PropertyName != nil { + propertyName := bindingElement.AsBindingElement().PropertyName + // if ast.IsPrivateIdentifier(propertyName) { + // return Debug.failBadSyntaxKind(propertyName) // !!! + // } + if IsComputedPropertyName(propertyName) && IsStringOrNumericLiteralLike(propertyName.AsComputedPropertyName().Expression) { + return propertyName.AsComputedPropertyName().Expression + } + return propertyName + } + case KindPropertyAssignment: + // `a` in `({ a: b } = ...)` + // `[a]` in `({ [a]: b } = ...)` + // `"a"` in `({ "a": b } = ...)` + // `1` in `({ 1: b } = ...)` + if bindingElement.Name() != nil { + propertyName := bindingElement.Name() + // if ast.IsPrivateIdentifier(propertyName) { + // return Debug.failBadSyntaxKind(propertyName) // !!! + // } + if IsComputedPropertyName(propertyName) && IsStringOrNumericLiteralLike(propertyName.AsComputedPropertyName().Expression) { + return propertyName.AsComputedPropertyName().Expression + } + return propertyName + } + case KindSpreadAssignment: + // `a` in `({ ...a } = ...)` + // if ast.IsPrivateIdentifier(bindingElement.Name()) { + // return Debug.failBadSyntaxKind(bindingElement.Name()) // !!! + // } + return bindingElement.Name() + } + + target := GetTargetOfBindingOrAssignmentElement(bindingElement) + if target != nil && IsPropertyName(target) { + return target + } + return nil +} + +/** + * Walk an AssignmentPattern to determine if it contains object rest (`...`) syntax. We cannot rely on + * propagation of `TransformFlags.ContainsObjectRestOrSpread` since it isn't propagated by default in + * ObjectLiteralExpression and ArrayLiteralExpression since we do not know whether they belong to an + * AssignmentPattern at the time the nodes are parsed. + */ +func ContainsObjectRestOrSpread(node *Node) bool { + if node.SubtreeFacts()&SubtreeContainsObjectRestOrSpread != 0 { + return true + } + if node.SubtreeFacts()&SubtreeContainsESObjectRestOrSpread != 0 { + // check for nested spread assignments, otherwise '{ x: { a, ...b } = foo } = c' + // will not be correctly interpreted by the rest/spread transformer + for _, element := range GetElementsOfBindingOrAssignmentPattern(node) { + target := GetTargetOfBindingOrAssignmentElement(element) + if target != nil && IsAssignmentPattern(target) { + if target.SubtreeFacts()&SubtreeContainsObjectRestOrSpread != 0 { + return true + } + if target.SubtreeFacts()&SubtreeContainsESObjectRestOrSpread != 0 { + if ContainsObjectRestOrSpread(target) { + return true + } + } + } + } + } + return false +} + +func IsEmptyObjectLiteral(expression *Node) bool { + return expression.Kind == KindObjectLiteralExpression && len(expression.AsObjectLiteralExpression().Properties.Nodes) == 0 +} + +func IsEmptyArrayLiteral(expression *Node) bool { + return expression.Kind == KindArrayLiteralExpression && len(expression.AsArrayLiteralExpression().Elements.Nodes) == 0 +} + +func GetRestIndicatorOfBindingOrAssignmentElement(bindingElement *Node) *Node { + switch bindingElement.Kind { + case KindParameter: + return bindingElement.AsParameterDeclaration().DotDotDotToken + case KindBindingElement: + return bindingElement.AsBindingElement().DotDotDotToken + case KindSpreadElement, KindSpreadAssignment: + return bindingElement + } + return nil +} + +func IsJSDocNameReferenceContext(node *Node) bool { + return node.Flags&NodeFlagsJSDoc != 0 && FindAncestor(node, func(node *Node) bool { + return IsJSDocNameReference(node) || IsJSDocLinkLike(node) + }) != nil +} + +func IsImportOrImportEqualsDeclaration(node *Node) bool { + return IsImportDeclaration(node) || IsImportEqualsDeclaration(node) +} + +func IsKeyword(token Kind) bool { + return KindFirstKeyword <= token && token <= KindLastKeyword +} + +func IsNonContextualKeyword(token Kind) bool { + return IsKeyword(token) && !IsContextualKeyword(token) +} + +func HasModifier(node *Node, flags ModifierFlags) bool { + return node.ModifierFlags()&flags != 0 +} + +func IsExpandoInitializer(initializer *Node) bool { + if initializer == nil { + return false + } + if IsFunctionExpressionOrArrowFunction(initializer) { + return true + } + if IsInJSFile(initializer) { + return IsClassExpression(initializer) || (IsObjectLiteralExpression(initializer) && len(initializer.AsObjectLiteralExpression().Properties.Nodes) == 0) + } + return false +} + +func GetContainingFunction(node *Node) *Node { + return FindAncestor(node.Parent, IsFunctionLike) +} diff --git a/kitcom/internal/tsgo/ast/visitor.go b/kitcom/internal/tsgo/ast/visitor.go new file mode 100644 index 0000000..b0b7db5 --- /dev/null +++ b/kitcom/internal/tsgo/ast/visitor.go @@ -0,0 +1,278 @@ +package ast + +import ( + "slices" +) + +// NodeVisitor + +type NodeVisitor struct { + Visit func(node *Node) *Node // Required. The callback used to visit a node + Factory *NodeFactory // Required. The NodeFactory used to produce new nodes when passed to VisitEachChild + Hooks NodeVisitorHooks // Hooks to be invoked when visiting a node +} + +// These hooks are used to intercept the default behavior of the visitor +type NodeVisitorHooks struct { + VisitNode func(node *Node, v *NodeVisitor) *Node // Overrides visiting a Node. Only invoked by the VisitEachChild method on a given Node subtype. + VisitToken func(node *TokenNode, v *NodeVisitor) *Node // Overrides visiting a TokenNode. Only invoked by the VisitEachChild method on a given Node subtype. + VisitNodes func(nodes *NodeList, v *NodeVisitor) *NodeList // Overrides visiting a NodeList. Only invoked by the VisitEachChild method on a given Node subtype. + VisitModifiers func(nodes *ModifierList, v *NodeVisitor) *ModifierList // Overrides visiting a ModifierList. Only invoked by the VisitEachChild method on a given Node subtype. + VisitEmbeddedStatement func(node *Statement, v *NodeVisitor) *Statement // Overrides visiting a Node when it is the embedded statement body of an iteration statement, `if` statement, or `with` statement. Only invoked by the VisitEachChild method on a given Node subtype. + VisitIterationBody func(node *Statement, v *NodeVisitor) *Statement // Overrides visiting a Node when it is the embedded statement body of an iteration statement. Only invoked by the VisitEachChild method on a given Node subtype. + VisitParameters func(nodes *ParameterList, v *NodeVisitor) *ParameterList // Overrides visiting a ParameterList. Only invoked by the VisitEachChild method on a given Node subtype. + VisitFunctionBody func(node *BlockOrExpression, v *NodeVisitor) *BlockOrExpression // Overrides visiting a function body. Only invoked by the VisitEachChild method on a given Node subtype. + VisitTopLevelStatements func(nodes *StatementList, v *NodeVisitor) *StatementList // Overrides visiting a variable environment. Only invoked by the VisitEachChild method on a given Node subtype. +} + +func NewNodeVisitor(visit func(node *Node) *Node, factory *NodeFactory, hooks NodeVisitorHooks) *NodeVisitor { + if factory == nil { + factory = &NodeFactory{} + } + return &NodeVisitor{Visit: visit, Factory: factory, Hooks: hooks} +} + +func (v *NodeVisitor) VisitSourceFile(node *SourceFile) *SourceFile { + return v.VisitNode(node.AsNode()).AsSourceFile() +} + +// Visits a Node, possibly returning a new Node in its place. +// +// - If the input node is nil, then the output is nil. +// - If v.Visit is nil, then the output is the input. +// - If v.Visit returns nil, then the output is nil. +// - If v.Visit returns a SyntaxList Node, then the output is the only child of the SyntaxList Node. +func (v *NodeVisitor) VisitNode(node *Node) *Node { + if node == nil || v.Visit == nil { + return node + } + + if v.Visit != nil { + visited := v.Visit(node) + if visited != nil && visited.Kind == KindSyntaxList { + nodes := visited.AsSyntaxList().Children + if len(nodes) != 1 { + panic("Expected only a single node to be written to output") + } + visited = nodes[0] + if visited != nil && visited.Kind == KindSyntaxList { + panic("The result of visiting and lifting a Node may not be SyntaxList") + } + } + return visited + } + + return node +} + +// Visits an embedded Statement (i.e., the single statement body of a loop, `if..else` branch, etc.), possibly returning a new Statement in its place. +// +// - If the input node is nil, then the output is nil. +// - If v.Visit is nil, then the output is the input. +// - If v.Visit returns nil, then the output is nil. +// - If v.Visit returns a SyntaxList Node, then the output is either the only child of the SyntaxList Node, or a Block containing the nodes in the list. +func (v *NodeVisitor) VisitEmbeddedStatement(node *Statement) *Statement { + if node == nil || v.Visit == nil { + return node + } + + if v.Visit != nil { + return v.liftToBlock(v.Visit(node)) + } + + return node +} + +// Visits a NodeList, possibly returning a new NodeList in its place. +// +// - If the input NodeList is nil, the output is nil. +// - If v.Visit is nil, then the output is the input. +// - If v.Visit returns nil, the visited Node will be absent in the output. +// - If v.Visit returns a different Node than the input, a new NodeList will be generated and returned. +// - If v.Visit returns a SyntaxList Node, then the children of that node will be merged into the output and a new NodeList will be returned. +// - If this method returns a new NodeList for any reason, it will have the same Loc as the input NodeList. +func (v *NodeVisitor) VisitNodes(nodes *NodeList) *NodeList { + if nodes == nil || v.Visit == nil { + return nodes + } + + if result, changed := v.VisitSlice(nodes.Nodes); changed { + list := v.Factory.NewNodeList(result) + list.Loc = nodes.Loc + return list + } + + return nodes +} + +// Visits a ModifierList, possibly returning a new ModifierList in its place. +// +// - If the input ModifierList is nil, the output is nil. +// - If v.Visit is nil, then the output is the input. +// - If v.Visit returns nil, the visited Node will be absent in the output. +// - If v.Visit returns a different Node than the input, a new ModifierList will be generated and returned. +// - If v.Visit returns a SyntaxList Node, then the children of that node will be merged into the output and a new NodeList will be returned. +// - If this method returns a new NodeList for any reason, it will have the same Loc as the input NodeList. +func (v *NodeVisitor) VisitModifiers(nodes *ModifierList) *ModifierList { + if nodes == nil || v.Visit == nil { + return nodes + } + + if result, changed := v.VisitSlice(nodes.Nodes); changed { + list := v.Factory.NewModifierList(result) + list.Loc = nodes.Loc + return list + } + + return nodes +} + +// Visits a slice of Nodes, returning the resulting slice and a value indicating whether the slice was changed. +// +// - If the input slice is nil, the output is nil. +// - If v.Visit is nil, then the output is the input. +// - If v.Visit returns nil, the visited Node will be absent in the output. +// - If v.Visit returns a different Node than the input, a new slice will be generated and returned. +// - If v.Visit returns a SyntaxList Node, then the children of that node will be merged into the output and a new slice will be returned. +func (v *NodeVisitor) VisitSlice(nodes []*Node) (result []*Node, changed bool) { + if nodes == nil || v.Visit == nil { + return nodes, false + } + + for i := 0; i < len(nodes); i++ { + node := nodes[i] + if v.Visit == nil { + break + } + + visited := v.Visit(node) + if visited == nil || visited != node { + updated := slices.Clone(nodes[:i]) + + for { + // finish prior loop + switch { + case visited == nil: // do nothing + case visited.Kind == KindSyntaxList: + updated = append(updated, visited.AsSyntaxList().Children...) + default: + updated = append(updated, visited) + } + + i++ + + // loop over remaining elements + if i >= len(nodes) { + break + } + + if v.Visit != nil { + node = nodes[i] + visited = v.Visit(node) + } else { + updated = append(updated, nodes[i:]...) + break + } + } + + return updated, true + } + } + + return nodes, false +} + +// Visits each child of a Node, possibly returning a new Node of the same kind in its place. +func (v *NodeVisitor) VisitEachChild(node *Node) *Node { + if node == nil || v.Visit == nil { + return node + } + + return node.VisitEachChild(v) +} + +func (v *NodeVisitor) visitNode(node *Node) *Node { + if v.Hooks.VisitNode != nil { + return v.Hooks.VisitNode(node, v) + } + return v.VisitNode(node) +} + +func (v *NodeVisitor) visitEmbeddedStatement(node *Node) *Node { + if v.Hooks.VisitEmbeddedStatement != nil { + return v.Hooks.VisitEmbeddedStatement(node, v) + } + if v.Hooks.VisitNode != nil { + return v.liftToBlock(v.Hooks.VisitNode(node, v)) + } + return v.VisitEmbeddedStatement(node) +} + +func (v *NodeVisitor) visitIterationBody(node *Statement) *Statement { + if v.Hooks.VisitIterationBody != nil { + return v.Hooks.VisitIterationBody(node, v) + } + return v.visitEmbeddedStatement(node) +} + +func (v *NodeVisitor) visitFunctionBody(node *BlockOrExpression) *BlockOrExpression { + if v.Hooks.VisitFunctionBody != nil { + return v.Hooks.VisitFunctionBody(node, v) + } + return v.visitNode(node) +} + +func (v *NodeVisitor) visitToken(node *Node) *Node { + if v.Hooks.VisitToken != nil { + return v.Hooks.VisitToken(node, v) + } + return v.VisitNode(node) +} + +func (v *NodeVisitor) visitNodes(nodes *NodeList) *NodeList { + if v.Hooks.VisitNodes != nil { + return v.Hooks.VisitNodes(nodes, v) + } + return v.VisitNodes(nodes) +} + +func (v *NodeVisitor) visitModifiers(nodes *ModifierList) *ModifierList { + if v.Hooks.VisitModifiers != nil { + return v.Hooks.VisitModifiers(nodes, v) + } + return v.VisitModifiers(nodes) +} + +func (v *NodeVisitor) visitParameters(nodes *ParameterList) *ParameterList { + if v.Hooks.VisitParameters != nil { + return v.Hooks.VisitParameters(nodes, v) + } + return v.visitNodes(nodes) +} + +func (v *NodeVisitor) visitTopLevelStatements(nodes *StatementList) *StatementList { + if v.Hooks.VisitTopLevelStatements != nil { + return v.Hooks.VisitTopLevelStatements(nodes, v) + } + return v.visitNodes(nodes) +} + +func (v *NodeVisitor) liftToBlock(node *Statement) *Statement { + var nodes []*Node + if node != nil { + if node.Kind == KindSyntaxList { + nodes = node.AsSyntaxList().Children + } else { + nodes = []*Node{node} + } + } + if len(nodes) == 1 { + node = nodes[0] + } else { + node = v.Factory.NewBlock(v.Factory.NewNodeList(nodes), true /*multiLine*/) + } + if node.Kind == KindSyntaxList { + panic("The result of visiting and lifting a Node may not be SyntaxList") + } + return node +} diff --git a/kitcom/internal/tsgo/astnav/tokens.go b/kitcom/internal/tsgo/astnav/tokens.go new file mode 100644 index 0000000..6be7fd3 --- /dev/null +++ b/kitcom/internal/tsgo/astnav/tokens.go @@ -0,0 +1,653 @@ +package astnav + +import ( + "fmt" + + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/ast" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/core" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/scanner" +) + +func GetTouchingPropertyName(sourceFile *ast.SourceFile, position int) *ast.Node { + return getReparsedNodeForNode(getTokenAtPosition(sourceFile, position, false /*allowPositionInLeadingTrivia*/, func(node *ast.Node) bool { + return ast.IsPropertyNameLiteral(node) || ast.IsKeywordKind(node.Kind) || ast.IsPrivateIdentifier(node) + })) +} + +// If the given node is a declaration name node in a JSDoc comment that is subject to reparsing, return the declaration name node +// for the corresponding reparsed construct. Otherwise, just return the node. +func getReparsedNodeForNode(node *ast.Node) *ast.Node { + if node.Flags&ast.NodeFlagsJSDoc != 0 && (ast.IsIdentifier(node) || ast.IsPrivateIdentifier(node)) { + parent := node.Parent + if (ast.IsJSDocTypedefTag(parent) || ast.IsJSDocCallbackTag(parent) || ast.IsJSDocPropertyTag(parent) || ast.IsJSDocParameterTag(parent) || ast.IsImportClause(parent) || ast.IsImportSpecifier(parent)) && parent.Name() == node { + // Reparsing preserves the location of the name. Thus, a search at the position of the name with JSDoc excluded + // finds the containing reparsed declaration node. + if reparsed := ast.GetNodeAtPosition(ast.GetSourceFileOfNode(node), node.Pos(), false); reparsed != nil { + if name := reparsed.Name(); name != nil && name.Pos() == node.Pos() { + return name + } + } + } + } + return node +} + +func GetTouchingToken(sourceFile *ast.SourceFile, position int) *ast.Node { + return getTokenAtPosition(sourceFile, position, false /*allowPositionInLeadingTrivia*/, nil) +} + +func GetTokenAtPosition(sourceFile *ast.SourceFile, position int) *ast.Node { + return getTokenAtPosition(sourceFile, position, true /*allowPositionInLeadingTrivia*/, nil) +} + +func getTokenAtPosition( + sourceFile *ast.SourceFile, + position int, + allowPositionInLeadingTrivia bool, + includePrecedingTokenAtEndPosition func(node *ast.Node) bool, +) *ast.Node { + // getTokenAtPosition returns a token at the given position in the source file. + // The token can be a real node in the AST, or a synthesized token constructed + // with information from the scanner. Synthesized tokens are only created when + // needed, and they are stored in the source file's token cache such that multiple + // calls to getTokenAtPosition with the same position will return the same object + // in memory. If there is no token at the given position (possible when + // `allowPositionInLeadingTrivia` is false), the lowest node that encloses the + // position is returned. + + // `next` tracks the node whose children will be visited on the next iteration. + // `prevSubtree` is a node whose end position is equal to the target position, + // only if `includePrecedingTokenAtEndPosition` is provided. Once set, the next + // iteration of the loop will test the rightmost token of `prevSubtree` to see + // if it should be returned. + var next, prevSubtree *ast.Node + current := sourceFile.AsNode() + // `left` tracks the lower boundary of the node/token that could be returned, + // and is eventually the scanner's start position, if the scanner is used. + left := 0 + + testNode := func(node *ast.Node) int { + if node.Kind != ast.KindEndOfFile && node.End() == position && includePrecedingTokenAtEndPosition != nil { + prevSubtree = node + } + + if node.End() < position || node.Kind != ast.KindEndOfFile && node.End() == position { + return -1 + } + if getPosition(node, sourceFile, allowPositionInLeadingTrivia) > position { + return 1 + } + return 0 + } + + // We zero in on the node that contains the target position by visiting each + // child and JSDoc comment of the current node. Node children are walked in + // order, while node lists are binary searched. + visitNode := func(node *ast.Node, _ *ast.NodeVisitor) *ast.Node { + // We can't abort visiting children, so once a match is found, we set `next` + // and do nothing on subsequent visits. + if node != nil && node.Flags&ast.NodeFlagsReparsed == 0 && next == nil { + switch testNode(node) { + case -1: + if !ast.IsJSDocKind(node.Kind) { + // We can't move the left boundary into or beyond JSDoc, + // because we may end up returning the token after this JSDoc, + // constructing it with the scanner, and we need to include + // all its leading trivia in its position. + left = node.End() + } + case 0: + next = node + } + } + return node + } + + visitNodeList := func(nodeList *ast.NodeList, _ *ast.NodeVisitor) *ast.NodeList { + if nodeList != nil && len(nodeList.Nodes) > 0 && next == nil { + if nodeList.End() == position && includePrecedingTokenAtEndPosition != nil { + left = nodeList.End() + prevSubtree = nodeList.Nodes[len(nodeList.Nodes)-1] + } else if nodeList.End() <= position { + left = nodeList.End() + } else if nodeList.Pos() <= position { + nodes := nodeList.Nodes + index, match := core.BinarySearchUniqueFunc(nodes, func(middle int, node *ast.Node) int { + if node.Flags&ast.NodeFlagsReparsed != 0 { + return 0 + } + cmp := testNode(node) + if cmp < 0 { + left = node.End() + } + return cmp + }) + if match && nodes[index].Flags&ast.NodeFlagsReparsed != 0 { + // filter and search again + nodes = core.Filter(nodes, func(node *ast.Node) bool { + return node.Flags&ast.NodeFlagsReparsed == 0 + }) + index, match = core.BinarySearchUniqueFunc(nodes, func(middle int, node *ast.Node) int { + cmp := testNode(node) + if cmp < 0 { + left = node.End() + } + return cmp + }) + } + if match { + next = nodes[index] + } + } + } + return nodeList + } + + for { + VisitEachChildAndJSDoc(current, sourceFile, visitNode, visitNodeList) + // If prevSubtree was set on the last iteration, it ends at the target position. + // Check if the rightmost token of prevSubtree should be returned based on the + // `includePrecedingTokenAtEndPosition` callback. + if prevSubtree != nil { + child := FindPrecedingTokenEx(sourceFile, position, prevSubtree, false /*excludeJSDoc*/) + if child != nil && child.End() == position && includePrecedingTokenAtEndPosition(child) { + // Optimization: includePrecedingTokenAtEndPosition only ever returns true + // for real AST nodes, so we don't run the scanner here. + return child + } + prevSubtree = nil + } + + // No node was found that contains the target position, so we've gone as deep as + // we can in the AST. We've either found a token, or we need to run the scanner + // to construct one that isn't stored in the AST. + if next == nil { + if ast.IsTokenKind(current.Kind) || shouldSkipChild(current) { + return current + } + scanner := scanner.GetScannerForSourceFile(sourceFile, left) + for left < current.End() { + token := scanner.Token() + tokenFullStart := scanner.TokenFullStart() + tokenStart := core.IfElse(allowPositionInLeadingTrivia, tokenFullStart, scanner.TokenStart()) + tokenEnd := scanner.TokenEnd() + if tokenStart <= position && (position < tokenEnd) { + if token == ast.KindIdentifier || !ast.IsTokenKind(token) { + if ast.IsJSDocKind(current.Kind) { + return current + } + panic(fmt.Sprintf("did not expect %s to have %s in its trivia", current.Kind.String(), token.String())) + } + return sourceFile.GetOrCreateToken(token, tokenFullStart, tokenEnd, current) + } + if includePrecedingTokenAtEndPosition != nil && tokenEnd == position { + prevToken := sourceFile.GetOrCreateToken(token, tokenFullStart, tokenEnd, current) + if includePrecedingTokenAtEndPosition(prevToken) { + return prevToken + } + } + left = tokenEnd + scanner.Scan() + } + return current + } + current = next + left = current.Pos() + next = nil + } +} + +func getPosition(node *ast.Node, sourceFile *ast.SourceFile, allowPositionInLeadingTrivia bool) int { + if allowPositionInLeadingTrivia { + return node.Pos() + } + return scanner.GetTokenPosOfNode(node, sourceFile, true /*includeJSDoc*/) +} + +func findRightmostNode(node *ast.Node) *ast.Node { + var next *ast.Node + current := node + visitNode := func(node *ast.Node, _ *ast.NodeVisitor) *ast.Node { + if node != nil { + next = node + } + return node + } + visitNodes := func(nodeList *ast.NodeList, visitor *ast.NodeVisitor) *ast.NodeList { + if nodeList != nil { + if rightmost := ast.FindLastVisibleNode(nodeList.Nodes); rightmost != nil { + next = rightmost + } + } + return nodeList + } + visitor := getNodeVisitor(visitNode, visitNodes) + + for { + current.VisitEachChild(visitor) + if next == nil { + return current + } + current = next + next = nil + } +} + +func VisitEachChildAndJSDoc( + node *ast.Node, + sourceFile *ast.SourceFile, + visitNode func(*ast.Node, *ast.NodeVisitor) *ast.Node, + visitNodes func(*ast.NodeList, *ast.NodeVisitor) *ast.NodeList, +) { + visitor := getNodeVisitor(visitNode, visitNodes) + if node.Flags&ast.NodeFlagsHasJSDoc != 0 { + for _, jsdoc := range node.JSDoc(sourceFile) { + if visitor.Hooks.VisitNode != nil { + visitor.Hooks.VisitNode(jsdoc, visitor) + } else { + visitor.VisitNode(jsdoc) + } + } + } + node.VisitEachChild(visitor) +} + +const ( + comparisonLessThan = -1 + comparisonEqualTo = 0 + comparisonGreaterThan = 1 +) + +// Finds the leftmost token satisfying `position < token.End()`. +// If the leftmost token satisfying `position < token.End()` is invalid, or if position +// is in the trivia of that leftmost token, +// we will find the rightmost valid token with `token.End() <= position`. +func FindPrecedingToken(sourceFile *ast.SourceFile, position int) *ast.Node { + return FindPrecedingTokenEx(sourceFile, position, nil, false) +} + +func FindPrecedingTokenEx(sourceFile *ast.SourceFile, position int, startNode *ast.Node, excludeJSDoc bool) *ast.Node { + var find func(node *ast.Node) *ast.Node + find = func(n *ast.Node) *ast.Node { + if ast.IsNonWhitespaceToken(n) && n.Kind != ast.KindEndOfFile { + return n + } + + // `foundChild` is the leftmost node that contains the target position. + // `prevChild` is the last visited child of the current node. + var foundChild, prevChild *ast.Node + visitNode := func(node *ast.Node, _ *ast.NodeVisitor) *ast.Node { + // skip synthesized nodes (that will exist now because of jsdoc handling) + if node == nil || node.Flags&ast.NodeFlagsReparsed != 0 { + return node + } + if foundChild != nil { // We cannot abort visiting children, so once the desired child is found, we do nothing. + return node + } + if position < node.End() && (prevChild == nil || prevChild.End() <= position) { + foundChild = node + } else { + prevChild = node + } + return node + } + visitNodes := func(nodeList *ast.NodeList, _ *ast.NodeVisitor) *ast.NodeList { + if foundChild != nil { + return nodeList + } + if nodeList != nil && len(nodeList.Nodes) > 0 { + nodes := nodeList.Nodes + index, match := core.BinarySearchUniqueFunc(nodes, func(middle int, _ *ast.Node) int { + // synthetic jsdoc nodes should have jsdocNode.End() <= n.Pos() + if nodes[middle].Flags&ast.NodeFlagsReparsed != 0 { + return comparisonLessThan + } + if position < nodes[middle].End() { + if middle == 0 || position >= nodes[middle-1].End() { + return comparisonEqualTo + } + return comparisonGreaterThan + } + return comparisonLessThan + }) + + if match { + foundChild = nodes[index] + } + + validLookupIndex := core.IfElse(match, index-1, len(nodes)-1) + for i := validLookupIndex; i >= 0; i-- { + if nodes[i].Flags&ast.NodeFlagsReparsed != 0 { + continue + } + if prevChild == nil { + prevChild = nodes[i] + } + } + } + return nodeList + } + VisitEachChildAndJSDoc(n, sourceFile, visitNode, visitNodes) + + if foundChild != nil { + // Note that the span of a node's tokens is [getStartOfNode(node, ...), node.end). + // Given that `position < child.end` and child has constituent tokens, we distinguish these cases: + // 1) `position` precedes `child`'s tokens or `child` has no tokens (ie: in a comment or whitespace preceding `child`): + // we need to find the last token in a previous child node or child tokens. + // 2) `position` is within the same span: we recurse on `child`. + start := GetStartOfNode(foundChild, sourceFile, !excludeJSDoc /*includeJSDoc*/) + lookInPreviousChild := start >= position || // cursor in the leading trivia or preceding tokens + !isValidPrecedingNode(foundChild, sourceFile) + if lookInPreviousChild { + if position >= foundChild.Pos() { + // Find jsdoc preceding the foundChild. + var jsDoc *ast.Node + nodeJSDoc := n.JSDoc(sourceFile) + for i := len(nodeJSDoc) - 1; i >= 0; i-- { + if nodeJSDoc[i].Pos() >= foundChild.Pos() { + jsDoc = nodeJSDoc[i] + break + } + } + if jsDoc != nil { + if !excludeJSDoc { + return find(jsDoc) + } else { + return findRightmostValidToken(jsDoc.End(), sourceFile, n, position, excludeJSDoc) + } + } + return findRightmostValidToken(foundChild.Pos(), sourceFile, n, -1 /*position*/, excludeJSDoc) + } else { // Answer is in tokens between two visited children. + return findRightmostValidToken(foundChild.Pos(), sourceFile, n, position, excludeJSDoc) + } + } else { + // position is in [foundChild.getStart(), foundChild.End): recur. + return find(foundChild) + } + } + + // We have two cases here: either the position is at the end of the file, + // or the desired token is in the unvisited trailing tokens of the current node. + if position >= n.End() { + return findRightmostValidToken(n.End(), sourceFile, n, -1 /*position*/, excludeJSDoc) + } else { + return findRightmostValidToken(n.End(), sourceFile, n, position, excludeJSDoc) + } + } + + var node *ast.Node + if startNode != nil { + node = startNode + } else { + node = sourceFile.AsNode() + } + result := find(node) + if result != nil && ast.IsWhitespaceOnlyJsxText(result) { + panic("Expected result to be a non-whitespace token.") + } + return result +} + +func isValidPrecedingNode(node *ast.Node, sourceFile *ast.SourceFile) bool { + start := GetStartOfNode(node, sourceFile, false /*includeJSDoc*/) + width := node.End() - start + return !(ast.IsWhitespaceOnlyJsxText(node) || width == 0) +} + +func GetStartOfNode(node *ast.Node, file *ast.SourceFile, includeJSDoc bool) int { + return scanner.GetTokenPosOfNode(node, file, includeJSDoc) +} + +// Looks for rightmost valid token in the range [startPos, endPos). +// If position is >= 0, looks for rightmost valid token that precedes or touches that position. +func findRightmostValidToken(endPos int, sourceFile *ast.SourceFile, containingNode *ast.Node, position int, excludeJSDoc bool) *ast.Node { + if position == -1 { + position = containingNode.End() + } + var find func(n *ast.Node, endPos int) *ast.Node + find = func(n *ast.Node, endPos int) *ast.Node { + if n == nil { + return nil + } + if ast.IsNonWhitespaceToken(n) { + return n + } + + var rightmostValidNode *ast.Node + rightmostVisitedNodes := make([]*ast.Node, 0, 1) // Nodes after the last valid node. + hasChildren := false + shouldVisitNode := func(node *ast.Node) bool { + // Node is synthetic or out of the desired range: don't visit it. + return !(node.Flags&ast.NodeFlagsReparsed != 0 || + node.End() > endPos || GetStartOfNode(node, sourceFile, !excludeJSDoc /*includeJSDoc*/) >= position) + } + visitNode := func(node *ast.Node, _ *ast.NodeVisitor) *ast.Node { + if node == nil { + return node + } + hasChildren = true + if !shouldVisitNode(node) { + return node + } + rightmostVisitedNodes = append(rightmostVisitedNodes, node) + if isValidPrecedingNode(node, sourceFile) { + rightmostValidNode = node + rightmostVisitedNodes = rightmostVisitedNodes[:0] + } + return node + } + visitNodes := func(nodeList *ast.NodeList, _ *ast.NodeVisitor) *ast.NodeList { + if nodeList != nil && len(nodeList.Nodes) > 0 { + hasChildren = true + index, _ := core.BinarySearchUniqueFunc(nodeList.Nodes, func(middle int, node *ast.Node) int { + if node.End() > endPos { + return comparisonGreaterThan + } + return comparisonLessThan + }) + validIndex := -1 + for i := index - 1; i >= 0; i-- { + if !shouldVisitNode(nodeList.Nodes[i]) { + continue + } + if isValidPrecedingNode(nodeList.Nodes[i], sourceFile) { + validIndex = i + rightmostValidNode = nodeList.Nodes[i] + break + } + } + for i := validIndex + 1; i < index; i++ { + if !shouldVisitNode(nodeList.Nodes[i]) { + continue + } + rightmostVisitedNodes = append(rightmostVisitedNodes, nodeList.Nodes[i]) + } + } + return nodeList + } + VisitEachChildAndJSDoc(n, sourceFile, visitNode, visitNodes) + + // Three cases: + // 1. The answer is a token of `rightmostValidNode`. + // 2. The answer is one of the unvisited tokens that occur after the rightmost valid node. + // 3. The current node is a childless, token-less node. The answer is the current node. + + // Case 2: Look at unvisited trailing tokens that occur in between the rightmost visited nodes. + if !shouldSkipChild(n) { // JSDoc nodes don't include trivia tokens as children. + var startPos int + if rightmostValidNode != nil { + startPos = rightmostValidNode.End() + } else { + startPos = n.Pos() + } + scanner := scanner.GetScannerForSourceFile(sourceFile, startPos) + var tokens []*ast.Node + for _, visitedNode := range rightmostVisitedNodes { + // Trailing tokens that occur before this node. + for startPos < min(visitedNode.Pos(), position) { + tokenStart := scanner.TokenStart() + if tokenStart >= position { + break + } + token := scanner.Token() + tokenFullStart := scanner.TokenFullStart() + tokenEnd := scanner.TokenEnd() + startPos = tokenEnd + tokens = append(tokens, sourceFile.GetOrCreateToken(token, tokenFullStart, tokenEnd, n)) + scanner.Scan() + } + startPos = visitedNode.End() + scanner.ResetPos(startPos) + scanner.Scan() + } + // Trailing tokens after last visited node. + for startPos < min(endPos, position) { + tokenStart := scanner.TokenStart() + if tokenStart >= position { + break + } + token := scanner.Token() + tokenFullStart := scanner.TokenFullStart() + tokenEnd := scanner.TokenEnd() + startPos = tokenEnd + tokens = append(tokens, sourceFile.GetOrCreateToken(token, tokenFullStart, tokenEnd, n)) + scanner.Scan() + } + + lastToken := len(tokens) - 1 + // Find preceding valid token. + for i := lastToken; i >= 0; i-- { + if !ast.IsWhitespaceOnlyJsxText(tokens[i]) { + return tokens[i] + } + } + } + + // Case 3: childless node. + if !hasChildren { + if n != containingNode { + return n + } + return nil + } + // Case 1: recur on rightmostValidNode. + if rightmostValidNode != nil { + endPos = rightmostValidNode.End() + } + return find(rightmostValidNode, endPos) + } + + return find(containingNode, endPos) +} + +func FindNextToken(previousToken *ast.Node, parent *ast.Node, file *ast.SourceFile) *ast.Node { + var find func(n *ast.Node) *ast.Node + find = func(n *ast.Node) *ast.Node { + if ast.IsTokenKind(n.Kind) && n.Pos() == previousToken.End() { + // this is token that starts at the end of previous token - return it + return n + } + // Node that contains `previousToken` or occurs immediately after it. + var foundNode *ast.Node + visitNode := func(node *ast.Node, _ *ast.NodeVisitor) *ast.Node { + if node != nil && node.Flags&ast.NodeFlagsReparsed == 0 && + node.Pos() <= previousToken.End() && node.End() > previousToken.End() { + foundNode = node + } + return node + } + visitNodes := func(nodeList *ast.NodeList, _ *ast.NodeVisitor) *ast.NodeList { + if nodeList != nil && len(nodeList.Nodes) > 0 && foundNode == nil { + nodes := nodeList.Nodes + index, match := core.BinarySearchUniqueFunc(nodes, func(_ int, node *ast.Node) int { + if node.Flags&ast.NodeFlagsReparsed != 0 { + return comparisonLessThan + } + if node.Pos() > previousToken.End() { + return comparisonGreaterThan + } + if node.End() <= previousToken.Pos() { + return comparisonLessThan + } + return comparisonEqualTo + }) + if match { + foundNode = nodes[index] + } + } + return nodeList + } + VisitEachChildAndJSDoc(n, file, visitNode, visitNodes) + // Cases: + // 1. no answer exists + // 2. answer is an unvisited token + // 3. answer is in the visited found node + + // Case 3: look for the next token inside the found node. + if foundNode != nil { + return find(foundNode) + } + startPos := previousToken.End() + // Case 2: look for the next token directly. + if startPos >= n.Pos() && startPos < n.End() { + scanner := scanner.GetScannerForSourceFile(file, startPos) + token := scanner.Token() + tokenFullStart := scanner.TokenFullStart() + tokenStart := scanner.TokenStart() + tokenEnd := scanner.TokenEnd() + if tokenStart == previousToken.End() { + return file.GetOrCreateToken(token, tokenFullStart, tokenEnd, n) + } + panic(fmt.Sprintf("Expected to find next token at %d, got token %s at %d", previousToken.End(), token, tokenStart)) + } + // Case 3: no answer. + return nil + } + return find(parent) +} + +func getNodeVisitor( + visitNode func(*ast.Node, *ast.NodeVisitor) *ast.Node, + visitNodes func(*ast.NodeList, *ast.NodeVisitor) *ast.NodeList, +) *ast.NodeVisitor { + var wrappedVisitNode func(*ast.Node, *ast.NodeVisitor) *ast.Node + var wrappedVisitNodes func(*ast.NodeList, *ast.NodeVisitor) *ast.NodeList + if visitNode != nil { + wrappedVisitNode = func(n *ast.Node, v *ast.NodeVisitor) *ast.Node { + if ast.IsJSDocSingleCommentNodeComment(n) { + return n + } + return visitNode(n, v) + } + } + + if visitNodes != nil { + wrappedVisitNodes = func(n *ast.NodeList, v *ast.NodeVisitor) *ast.NodeList { + if ast.IsJSDocSingleCommentNodeList(n) { + return n + } + return visitNodes(n, v) + } + } + + return ast.NewNodeVisitor(core.Identity, nil, ast.NodeVisitorHooks{ + VisitNode: wrappedVisitNode, + VisitToken: wrappedVisitNode, + VisitNodes: wrappedVisitNodes, + VisitModifiers: func(modifiers *ast.ModifierList, visitor *ast.NodeVisitor) *ast.ModifierList { + if modifiers != nil { + wrappedVisitNodes(&modifiers.NodeList, visitor) + } + return modifiers + }, + }) +} + +func shouldSkipChild(node *ast.Node) bool { + return node.Kind == ast.KindJSDoc || + node.Kind == ast.KindJSDocText || + node.Kind == ast.KindJSDocTypeLiteral || + node.Kind == ast.KindJSDocSignature || + ast.IsJSDocLinkLike(node) || + ast.IsJSDocTag(node) +} diff --git a/kitcom/internal/tsgo/astnav/tokens_test.go b/kitcom/internal/tsgo/astnav/tokens_test.go new file mode 100644 index 0000000..d52d631 --- /dev/null +++ b/kitcom/internal/tsgo/astnav/tokens_test.go @@ -0,0 +1,474 @@ +package astnav_test + +import ( + "fmt" + "os" + "path/filepath" + "slices" + "strconv" + "strings" + "testing" + + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/ast" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/astnav" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/core" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/parser" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/repo" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil/baseline" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil/jstest" + "gotest.tools/v3/assert" +) + +var testFiles = []string{ + filepath.Join(repo.TypeScriptSubmodulePath, "src/services/mapCode.ts"), +} + +func TestGetTokenAtPosition(t *testing.T) { + t.Parallel() + repo.SkipIfNoTypeScriptSubmodule(t) + jstest.SkipIfNoNodeJS(t) + + t.Run("baseline", func(t *testing.T) { + t.Parallel() + baselineTokens( + t, + "GetTokenAtPosition", + false, /*includeEOF*/ + func(fileText string, positions []int) []*tokenInfo { + return tsGetTokensAtPositions(t, fileText, positions) + }, + func(file *ast.SourceFile, pos int) *tokenInfo { + return toTokenInfo(astnav.GetTokenAtPosition(file, pos)) + }, + ) + }) + + t.Run("pointer equality", func(t *testing.T) { + t.Parallel() + fileText := ` + function foo() { + return 0; + } + ` + file := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: "/file.ts", + Path: "/file.ts", + }, fileText, core.ScriptKindTS) + assert.Equal(t, astnav.GetTokenAtPosition(file, 0), astnav.GetTokenAtPosition(file, 0)) + }) +} + +func TestGetTouchingPropertyName(t *testing.T) { + t.Parallel() + jstest.SkipIfNoNodeJS(t) + repo.SkipIfNoTypeScriptSubmodule(t) + + baselineTokens( + t, + "GetTouchingPropertyName", + false, /*includeEOF*/ + func(fileText string, positions []int) []*tokenInfo { + return tsGetTouchingPropertyName(t, fileText, positions) + }, + func(file *ast.SourceFile, pos int) *tokenInfo { + return toTokenInfo(astnav.GetTouchingPropertyName(file, pos)) + }, + ) +} + +func baselineTokens(t *testing.T, testName string, includeEOF bool, getTSTokens func(fileText string, positions []int) []*tokenInfo, getGoToken func(file *ast.SourceFile, pos int) *tokenInfo) { + for _, fileName := range testFiles { + t.Run(filepath.Base(fileName), func(t *testing.T) { + t.Parallel() + fileText, err := os.ReadFile(fileName) + assert.NilError(t, err) + + positions := make([]int, len(fileText)+core.IfElse(includeEOF, 1, 0)) + for i := range positions { + positions[i] = i + } + tsTokens := getTSTokens(string(fileText), positions) + file := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: "/file.ts", + Path: "/file.ts", + }, string(fileText), core.ScriptKindTS) + + var output strings.Builder + currentRange := core.NewTextRange(0, 0) + currentDiff := tokenDiff{} + + for pos, tsToken := range tsTokens { + goToken := getGoToken(file, pos) + diff := tokenDiff{goToken: goToken, tsToken: tsToken} + + if !diffEqual(currentDiff, diff) { + if !tokensEqual(currentDiff.goToken, currentDiff.tsToken) { + writeRangeDiff(&output, file, currentDiff, currentRange, pos) + } + currentDiff = diff + currentRange = core.NewTextRange(pos, pos) + } + currentRange = currentRange.WithEnd(pos) + } + + if !tokensEqual(currentDiff.goToken, currentDiff.tsToken) { + writeRangeDiff(&output, file, currentDiff, currentRange, len(tsTokens)-1) + } + + baseline.Run( + t, + fmt.Sprintf("%s.%s.baseline.txt", testName, filepath.Base(fileName)), + core.IfElse(output.Len() > 0, output.String(), baseline.NoContent), + baseline.Options{ + Subfolder: "astnav", + }, + ) + }) + } +} + +type tokenDiff struct { + goToken *tokenInfo + tsToken *tokenInfo +} + +type tokenInfo struct { + Kind string `json:"kind"` + Pos int `json:"pos"` + End int `json:"end"` +} + +func toTokenInfo(node *ast.Node) *tokenInfo { + if node == nil { + return nil + } + kind := strings.Replace(node.Kind.String(), "Kind", "", 1) + switch kind { + case "EndOfFile": + kind = "EndOfFileToken" + } + return &tokenInfo{ + Kind: kind, + Pos: node.Pos(), + End: node.End(), + } +} + +func diffEqual(a, b tokenDiff) bool { + return tokensEqual(a.goToken, b.goToken) && tokensEqual(a.tsToken, b.tsToken) +} + +func tokensEqual(t1, t2 *tokenInfo) bool { + if t1 == nil || t2 == nil { + return t1 == t2 + } + return *t1 == *t2 +} + +func tsGetTokensAtPositions(t testing.TB, fileText string, positions []int) []*tokenInfo { + dir := t.TempDir() + err := os.WriteFile(filepath.Join(dir, "file.ts"), []byte(fileText), 0o644) + assert.NilError(t, err) + + err = os.WriteFile(filepath.Join(dir, "positions.json"), []byte(core.Must(core.StringifyJson(positions, "", ""))), 0o644) + assert.NilError(t, err) + + script := ` + import fs from "fs"; + export default (ts) => { + const positions = JSON.parse(fs.readFileSync("positions.json", "utf8")); + const fileText = fs.readFileSync("file.ts", "utf8"); + const file = ts.createSourceFile( + "file.ts", + fileText, + { languageVersion: ts.ScriptTarget.Latest, jsDocParsingMode: ts.JSDocParsingMode.ParseAll }, + /*setParentNodes*/ true + ); + return positions.map(position => { + let token = ts.getTokenAtPosition(file, position); + if (token.kind === ts.SyntaxKind.SyntaxList) { + token = token.parent; + } + return { + kind: ts.Debug.formatSyntaxKind(token.kind), + pos: token.pos, + end: token.end, + }; + }); + };` + + info, err := jstest.EvalNodeScriptWithTS[[]*tokenInfo](t, script, dir, "") + assert.NilError(t, err) + return info +} + +func tsGetTouchingPropertyName(t testing.TB, fileText string, positions []int) []*tokenInfo { + dir := t.TempDir() + err := os.WriteFile(filepath.Join(dir, "file.ts"), []byte(fileText), 0o644) + assert.NilError(t, err) + + err = os.WriteFile(filepath.Join(dir, "positions.json"), []byte(core.Must(core.StringifyJson(positions, "", ""))), 0o644) + assert.NilError(t, err) + + script := ` + import fs from "fs"; + export default (ts) => { + const positions = JSON.parse(fs.readFileSync("positions.json", "utf8")); + const fileText = fs.readFileSync("file.ts", "utf8"); + const file = ts.createSourceFile( + "file.ts", + fileText, + { languageVersion: ts.ScriptTarget.Latest, jsDocParsingMode: ts.JSDocParsingMode.ParseAll }, + /*setParentNodes*/ true + ); + return positions.map(position => { + let token = ts.getTouchingPropertyName(file, position); + if (token.kind === ts.SyntaxKind.SyntaxList) { + token = token.parent; + } + return { + kind: ts.Debug.formatSyntaxKind(token.kind), + pos: token.pos, + end: token.end, + }; + }); + };` + + info, err := jstest.EvalNodeScriptWithTS[[]*tokenInfo](t, script, dir, "") + assert.NilError(t, err) + return info +} + +func writeRangeDiff(output *strings.Builder, file *ast.SourceFile, diff tokenDiff, rng core.TextRange, position int) { + lines := file.ECMALineMap() + + tsTokenPos := position + goTokenPos := position + tsTokenEnd := position + goTokenEnd := position + if diff.tsToken != nil { + tsTokenPos = diff.tsToken.Pos + tsTokenEnd = diff.tsToken.End + } + if diff.goToken != nil { + goTokenPos = diff.goToken.Pos + goTokenEnd = diff.goToken.End + } + tsStartLine, _ := core.PositionToLineAndCharacter(tsTokenPos, lines) + tsEndLine, _ := core.PositionToLineAndCharacter(tsTokenEnd, lines) + goStartLine, _ := core.PositionToLineAndCharacter(goTokenPos, lines) + goEndLine, _ := core.PositionToLineAndCharacter(goTokenEnd, lines) + + contextLines := 2 + startLine := min(tsStartLine, goStartLine) + endLine := max(tsEndLine, goEndLine) + markerLines := []int{tsStartLine, tsEndLine, goStartLine, goEndLine} + slices.Sort(markerLines) + contextStart := max(0, startLine-contextLines) + contextEnd := min(len(lines)-1, endLine+contextLines) + digits := len(strconv.Itoa(contextEnd)) + + shouldTruncate := func(line int) (result bool, skipTo int) { + index, _ := slices.BinarySearch(markerLines, line) + if index == 0 || index == len(markerLines) { + return false, 0 + } + low := markerLines[index-1] + high := markerLines[index] + if line-low > 5 && high-line > 5 { + return true, high - 5 + } + return false, 0 + } + + if output.Len() > 0 { + output.WriteString("\n\n") + } + + output.WriteString(fmt.Sprintf("〚Positions: [%d, %d]〛\n", rng.Pos(), rng.End())) + if diff.tsToken != nil { + output.WriteString(fmt.Sprintf("【TS: %s [%d, %d)】\n", diff.tsToken.Kind, tsTokenPos, tsTokenEnd)) + } else { + output.WriteString("【TS: nil】\n") + } + if diff.goToken != nil { + output.WriteString(fmt.Sprintf("《Go: %s [%d, %d)》\n", diff.goToken.Kind, goTokenPos, goTokenEnd)) + } else { + output.WriteString("《Go: nil》\n") + } + for line := contextStart; line <= contextEnd; line++ { + if truncate, skipTo := shouldTruncate(line); truncate { + output.WriteString(fmt.Sprintf("%s │........ %d lines omitted ........\n", strings.Repeat(" ", digits), skipTo-line+1)) + line = skipTo + } + output.WriteString(fmt.Sprintf("%*d │", digits, line+1)) + end := len(file.Text()) + 1 + if line < len(lines)-1 { + end = int(lines[line+1]) + } + for pos := int(lines[line]); pos < end; pos++ { + if pos == rng.End()+1 { + output.WriteString("〛") + } + if diff.tsToken != nil && pos == tsTokenEnd { + output.WriteString("】") + } + if diff.goToken != nil && pos == goTokenEnd { + output.WriteString("》") + } + + if diff.goToken != nil && pos == goTokenPos { + output.WriteString("《") + } + if diff.tsToken != nil && pos == tsTokenPos { + output.WriteString("【") + } + if pos == rng.Pos() { + output.WriteString("〚") + } + + if pos < len(file.Text()) { + output.WriteByte(file.Text()[pos]) + } + } + } +} + +func TestFindPrecedingToken(t *testing.T) { + t.Parallel() + repo.SkipIfNoTypeScriptSubmodule(t) + jstest.SkipIfNoNodeJS(t) + + t.Run("baseline", func(t *testing.T) { + t.Parallel() + baselineTokens( + t, + "FindPrecedingToken", + true, /*includeEOF*/ + func(fileText string, positions []int) []*tokenInfo { + return tsFindPrecedingTokens(t, fileText, positions) + }, + func(file *ast.SourceFile, pos int) *tokenInfo { + return toTokenInfo(astnav.FindPrecedingToken(file, pos)) + }, + ) + }) +} + +func TestUnitFindPrecedingToken(t *testing.T) { + t.Parallel() + testCases := []struct { + name string + fileContent string + position int + expectedKind ast.Kind + }{ + { + name: "after dot in jsdoc", + fileContent: `import { + CharacterCodes, + compareStringsCaseInsensitive, + compareStringsCaseSensitive, + compareValues, + Comparison, + Debug, + endsWith, + equateStringsCaseInsensitive, + equateStringsCaseSensitive, + GetCanonicalFileName, + getDeclarationFileExtension, + getStringComparer, + identity, + lastOrUndefined, + Path, + some, + startsWith, +} from "./_namespaces/ts.js"; + +/** + * Internally, we represent paths as strings with '/' as the directory separator. + * When we make system calls (eg: LanguageServiceHost.getDirectory()), + * we expect the host to correctly handle paths in our specified format. + * + * @internal + */ +export const directorySeparator = "/"; +/** @internal */ +export const altDirectorySeparator = "\\"; +const urlSchemeSeparator = "://"; +const backslashRegExp = /\\/g; + + +backslashRegExp. + +//Path Tests + +/** + * Determines whether a charCode corresponds to '/' or '\'. + * + * @internal + */ +export function isAnyDirectorySeparator(charCode: number): boolean { + return charCode === CharacterCodes.slash || charCode === CharacterCodes.backslash; +}`, + position: 839, + expectedKind: ast.KindDotToken, + }, + { + name: "after comma in parameter list", + fileContent: `takesCb((n, s, ))`, + position: 15, + expectedKind: ast.KindCommaToken, + }, + } + for _, testCase := range testCases { + t.Run(testCase.name, func(t *testing.T) { + t.Parallel() + file := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: "/file.ts", + Path: "/file.ts", + }, testCase.fileContent, core.ScriptKindTS) + token := astnav.FindPrecedingToken(file, testCase.position) + assert.Equal(t, token.Kind, testCase.expectedKind) + }) + } +} + +func tsFindPrecedingTokens(t *testing.T, fileText string, positions []int) []*tokenInfo { + dir := t.TempDir() + err := os.WriteFile(filepath.Join(dir, "file.ts"), []byte(fileText), 0o644) + assert.NilError(t, err) + + err = os.WriteFile(filepath.Join(dir, "positions.json"), []byte(core.Must(core.StringifyJson(positions, "", ""))), 0o644) + assert.NilError(t, err) + + script := ` + import fs from "fs"; + export default (ts) => { + const positions = JSON.parse(fs.readFileSync("positions.json", "utf8")); + const fileText = fs.readFileSync("file.ts", "utf8"); + const file = ts.createSourceFile( + "file.ts", + fileText, + { languageVersion: ts.ScriptTarget.Latest, jsDocParsingMode: ts.JSDocParsingMode.ParseAll }, + /*setParentNodes*/ true + ); + return positions.map(position => { + let token = ts.findPrecedingToken(position, file); + if (token === undefined) { + return undefined; + } + if (token.kind === ts.SyntaxKind.SyntaxList) { + token = token.parent; + } + return { + kind: ts.Debug.formatSyntaxKind(token.kind), + pos: token.pos, + end: token.end, + }; + }); + };` + info, err := jstest.EvalNodeScriptWithTS[[]*tokenInfo](t, script, dir, "") + assert.NilError(t, err) + return info +} diff --git a/kitcom/internal/tsgo/binder/binder.go b/kitcom/internal/tsgo/binder/binder.go new file mode 100644 index 0000000..f251cb9 --- /dev/null +++ b/kitcom/internal/tsgo/binder/binder.go @@ -0,0 +1,2820 @@ +package binder + +import ( + "slices" + "strconv" + "sync" + + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/ast" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/collections" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/core" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/debug" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/diagnostics" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/scanner" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/tspath" +) + +type ContainerFlags int32 + +const ( + // The current node is not a container, and no container manipulation should happen before + // recursing into it. + ContainerFlagsNone ContainerFlags = 0 + // The current node is a container. It should be set as the current container (and block- + // container) before recursing into it. The current node does not have locals. Examples: + // + // Classes, ObjectLiterals, TypeLiterals, Interfaces... + ContainerFlagsIsContainer ContainerFlags = 1 << 0 + // The current node is a block-scoped-container. It should be set as the current block- + // container before recursing into it. Examples: + // + // Blocks (when not parented by functions), Catch clauses, For/For-in/For-of statements... + ContainerFlagsIsBlockScopedContainer ContainerFlags = 1 << 1 + // The current node is the container of a control flow path. The current control flow should + // be saved and restored, and a new control flow initialized within the container. + ContainerFlagsIsControlFlowContainer ContainerFlags = 1 << 2 + ContainerFlagsIsFunctionLike ContainerFlags = 1 << 3 + ContainerFlagsIsFunctionExpression ContainerFlags = 1 << 4 + ContainerFlagsHasLocals ContainerFlags = 1 << 5 + ContainerFlagsIsInterface ContainerFlags = 1 << 6 + ContainerFlagsIsObjectLiteralOrClassExpressionMethodOrAccessor ContainerFlags = 1 << 7 + ContainerFlagsIsThisContainer ContainerFlags = 1 << 8 +) + +type Binder struct { + file *ast.SourceFile + bindFunc func(*ast.Node) bool + unreachableFlow *ast.FlowNode + reportedUnreachableFlow *ast.FlowNode + + container *ast.Node + thisContainer *ast.Node + blockScopeContainer *ast.Node + lastContainer *ast.Node + currentFlow *ast.FlowNode + currentBreakTarget *ast.FlowLabel + currentContinueTarget *ast.FlowLabel + currentReturnTarget *ast.FlowLabel + currentTrueTarget *ast.FlowLabel + currentFalseTarget *ast.FlowLabel + currentExceptionTarget *ast.FlowLabel + preSwitchCaseFlow *ast.FlowNode + activeLabelList *ActiveLabel + emitFlags ast.NodeFlags + seenThisKeyword bool + hasExplicitReturn bool + hasFlowEffects bool + inStrictMode bool + inAssignmentPattern bool + seenParseError bool + symbolCount int + classifiableNames collections.Set[string] + symbolPool core.Pool[ast.Symbol] + flowNodePool core.Pool[ast.FlowNode] + flowListPool core.Pool[ast.FlowList] + singleDeclarationsPool core.Pool[*ast.Node] +} + +func (b *Binder) options() core.SourceFileAffectingCompilerOptions { + return b.file.ParseOptions().CompilerOptions +} + +type ActiveLabel struct { + next *ActiveLabel + breakTarget *ast.FlowLabel + continueTarget *ast.FlowLabel + name string + referenced bool +} + +func (label *ActiveLabel) BreakTarget() *ast.FlowNode { return label.breakTarget } +func (label *ActiveLabel) ContinueTarget() *ast.FlowNode { return label.continueTarget } + +func BindSourceFile(file *ast.SourceFile) { + // This is constructed this way to make the compiler "out-line" the function, + // avoiding most work in the common case where the file has already been bound. + if !file.IsBound() { + bindSourceFile(file) + } +} + +var binderPool = sync.Pool{ + New: func() any { + b := &Binder{} + b.bindFunc = b.bind // Allocate closure once + return b + }, +} + +func getBinder() *Binder { + return binderPool.Get().(*Binder) +} + +func putBinder(b *Binder) { + *b = Binder{bindFunc: b.bindFunc} + binderPool.Put(b) +} + +func bindSourceFile(file *ast.SourceFile) { + file.BindOnce(func() { + b := getBinder() + defer putBinder(b) + b.file = file + b.inStrictMode = b.options().BindInStrictMode && !file.IsDeclarationFile || ast.IsExternalModule(file) + b.unreachableFlow = b.newFlowNode(ast.FlowFlagsUnreachable) + b.reportedUnreachableFlow = b.newFlowNode(ast.FlowFlagsUnreachable) + b.bind(file.AsNode()) + file.SymbolCount = b.symbolCount + file.ClassifiableNames = b.classifiableNames + }) +} + +func (b *Binder) newSymbol(flags ast.SymbolFlags, name string) *ast.Symbol { + b.symbolCount++ + result := b.symbolPool.New() + result.Flags = flags + result.Name = name + return result +} + +/** + * Declares a Symbol for the node and adds it to symbols. Reports errors for conflicting identifier names. + * @param symbolTable - The symbol table which node will be added to. + * @param parent - node's parent declaration. + * @param node - The declaration to be added to the symbol table + * @param includes - The SymbolFlags that node has in addition to its declaration type (eg: export, ambient, etc.) + * @param excludes - The flags which node cannot be declared alongside in a symbol table. Used to report forbidden declarations. + */ +func (b *Binder) declareSymbol(symbolTable ast.SymbolTable, parent *ast.Symbol, node *ast.Node, includes ast.SymbolFlags, excludes ast.SymbolFlags) *ast.Symbol { + return b.declareSymbolEx(symbolTable, parent, node, includes, excludes, false /*isReplaceableByMethod*/, false /*isComputedName*/) +} + +func (b *Binder) declareSymbolEx(symbolTable ast.SymbolTable, parent *ast.Symbol, node *ast.Node, includes ast.SymbolFlags, excludes ast.SymbolFlags, isReplaceableByMethod bool, isComputedName bool) *ast.Symbol { + debug.Assert(isComputedName || !ast.HasDynamicName(node)) + isDefaultExport := ast.HasSyntacticModifier(node, ast.ModifierFlagsDefault) || ast.IsExportSpecifier(node) && ast.ModuleExportNameIsDefault(node.AsExportSpecifier().Name()) + // The exported symbol for an export default function/class node is always named "default" + var name string + switch { + case isComputedName: + name = ast.InternalSymbolNameComputed + case isDefaultExport && parent != nil: + name = ast.InternalSymbolNameDefault + default: + name = b.getDeclarationName(node) + } + var symbol *ast.Symbol + if name == ast.InternalSymbolNameMissing { + symbol = b.newSymbol(ast.SymbolFlagsNone, ast.InternalSymbolNameMissing) + } else { + // Check and see if the symbol table already has a symbol with this name. If not, + // create a new symbol with this name and add it to the table. Note that we don't + // give the new symbol any flags *yet*. This ensures that it will not conflict + // with the 'excludes' flags we pass in. + // + // If we do get an existing symbol, see if it conflicts with the new symbol we're + // creating. For example, a 'var' symbol and a 'class' symbol will conflict within + // the same symbol table. If we have a conflict, report the issue on each + // declaration we have for this symbol, and then create a new symbol for this + // declaration. + // + // Note that when properties declared in Javascript constructors + // (marked by isReplaceableByMethod) conflict with another symbol, the property loses. + // Always. This allows the common Javascript pattern of overwriting a prototype method + // with an bound instance method of the same type: `this.method = this.method.bind(this)` + // + // If we created a new symbol, either because we didn't have a symbol with this name + // in the symbol table, or we conflicted with an existing symbol, then just add this + // node as the sole declaration of the new symbol. + // + // Otherwise, we'll be merging into a compatible existing symbol (for example when + // you have multiple 'vars' with the same name in the same container). In this case + // just add this node into the declarations list of the symbol. + symbol = symbolTable[name] + if includes&ast.SymbolFlagsClassifiable != 0 { + b.classifiableNames.Add(name) + } + if symbol == nil { + symbol = b.newSymbol(ast.SymbolFlagsNone, name) + symbolTable[name] = symbol + if isReplaceableByMethod { + symbol.Flags |= ast.SymbolFlagsReplaceableByMethod + } + } else if isReplaceableByMethod && symbol.Flags&ast.SymbolFlagsReplaceableByMethod == 0 { + // A symbol already exists, so don't add this as a declaration. + return symbol + } else if symbol.Flags&excludes != 0 { + if symbol.Flags&ast.SymbolFlagsReplaceableByMethod != 0 { + // Javascript constructor-declared symbols can be discarded in favor of + // prototype symbols like methods. + symbol = b.newSymbol(ast.SymbolFlagsNone, name) + symbolTable[name] = symbol + } else if !(includes&ast.SymbolFlagsVariable != 0 && symbol.Flags&ast.SymbolFlagsAssignment != 0 || + includes&ast.SymbolFlagsAssignment != 0 && symbol.Flags&ast.SymbolFlagsVariable != 0) { + // Assignment declarations are allowed to merge with variables, no matter what other flags they have. + // Report errors every position with duplicate declaration + // Report errors on previous encountered declarations + var message *diagnostics.Message + if symbol.Flags&ast.SymbolFlagsBlockScopedVariable != 0 { + message = diagnostics.Cannot_redeclare_block_scoped_variable_0 + } else { + message = diagnostics.Duplicate_identifier_0 + } + messageNeedsName := true + if symbol.Flags&ast.SymbolFlagsEnum != 0 || includes&ast.SymbolFlagsEnum != 0 { + message = diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations + messageNeedsName = false + } + multipleDefaultExports := false + if len(symbol.Declarations) != 0 { + // If the current node is a default export of some sort, then check if + // there are any other default exports that we need to error on. + // We'll know whether we have other default exports depending on if `symbol` already has a declaration list set. + if isDefaultExport { + message = diagnostics.A_module_cannot_have_multiple_default_exports + messageNeedsName = false + multipleDefaultExports = true + } else { + // This is to properly report an error in the case "export default { }" is after export default of class declaration or function declaration. + // Error on multiple export default in the following case: + // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default + // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers) + if len(symbol.Declarations) != 0 && ast.IsExportAssignment(node) && !node.AsExportAssignment().IsExportEquals { + message = diagnostics.A_module_cannot_have_multiple_default_exports + messageNeedsName = false + multipleDefaultExports = true + } + } + } + var declarationName *ast.Node = ast.GetNameOfDeclaration(node) + if declarationName == nil { + declarationName = node + } + var diag *ast.Diagnostic + if messageNeedsName { + diag = b.createDiagnosticForNode(declarationName, message, b.getDisplayName(node)) + } else { + diag = b.createDiagnosticForNode(declarationName, message) + } + if ast.IsTypeAliasDeclaration(node) && ast.NodeIsMissing(node.AsTypeAliasDeclaration().Type) && ast.HasSyntacticModifier(node, ast.ModifierFlagsExport) && symbol.Flags&(ast.SymbolFlagsAlias|ast.SymbolFlagsType|ast.SymbolFlagsNamespace) != 0 { + // export type T; - may have meant export type { T }? + diag.AddRelatedInfo(b.createDiagnosticForNode(node, diagnostics.Did_you_mean_0, "export type { "+node.AsTypeAliasDeclaration().Name().AsIdentifier().Text+" }")) + } + for index, declaration := range symbol.Declarations { + var decl *ast.Node = ast.GetNameOfDeclaration(declaration) + if decl == nil { + decl = declaration + } + var d *ast.Diagnostic + if messageNeedsName { + d = b.createDiagnosticForNode(decl, message, b.getDisplayName(declaration)) + } else { + d = b.createDiagnosticForNode(decl, message) + } + if multipleDefaultExports { + d.AddRelatedInfo(b.createDiagnosticForNode(declarationName, core.IfElse(index == 0, diagnostics.Another_export_default_is_here, diagnostics.X_and_here))) + } + b.addDiagnostic(d) + if multipleDefaultExports { + diag.AddRelatedInfo(b.createDiagnosticForNode(decl, diagnostics.The_first_export_default_is_here)) + } + } + b.addDiagnostic(diag) + // When get or set accessor conflicts with a non-accessor or an accessor of a different kind, we mark + // the symbol as a full accessor such that all subsequent declarations are considered conflicting. This + // for example ensures that a get accessor followed by a non-accessor followed by a set accessor with the + // same name are all marked as duplicates. + if symbol.Flags&ast.SymbolFlagsAccessor != 0 && symbol.Flags&ast.SymbolFlagsAccessor != includes&ast.SymbolFlagsAccessor { + symbol.Flags |= ast.SymbolFlagsAccessor + } + symbol = b.newSymbol(ast.SymbolFlagsNone, name) + } + } + } + b.addDeclarationToSymbol(symbol, node, includes) + if symbol.Parent == nil { + symbol.Parent = parent + } else if symbol.Parent != parent { + panic("Existing symbol parent should match new one") + } + return symbol +} + +// Should not be called on a declaration with a computed property name, +// unless it is a well known Symbol. +func (b *Binder) getDeclarationName(node *ast.Node) string { + if ast.IsExportAssignment(node) { + return core.IfElse(node.AsExportAssignment().IsExportEquals, ast.InternalSymbolNameExportEquals, ast.InternalSymbolNameDefault) + } else if ast.IsJSExportAssignment(node) { + return ast.InternalSymbolNameExportEquals + } + name := ast.GetNameOfDeclaration(node) + if name != nil { + if ast.IsAmbientModule(node) { + moduleName := name.Text() + if ast.IsGlobalScopeAugmentation(node) { + return ast.InternalSymbolNameGlobal + } + return "\"" + moduleName + "\"" + } + if ast.IsPrivateIdentifier(name) { + // containingClass exists because private names only allowed inside classes + containingClass := ast.GetContainingClass(node) + if containingClass == nil { + // we can get here in cases where there is already a parse error. + return ast.InternalSymbolNameMissing + } + return GetSymbolNameForPrivateIdentifier(containingClass.Symbol(), name.Text()) + } + if ast.IsPropertyNameLiteral(name) || ast.IsJsxNamespacedName(name) { + return name.Text() + } + if ast.IsComputedPropertyName(name) { + nameExpression := name.AsComputedPropertyName().Expression + // treat computed property names where expression is string/numeric literal as just string/numeric literal + if ast.IsStringOrNumericLiteralLike(nameExpression) { + return nameExpression.Text() + } + if ast.IsSignedNumericLiteral(nameExpression) { + unaryExpression := nameExpression.AsPrefixUnaryExpression() + return scanner.TokenToString(unaryExpression.Operator) + unaryExpression.Operand.Text() + } + panic("Only computed properties with literal names have declaration names") + } + return ast.InternalSymbolNameMissing + } + switch node.Kind { + case ast.KindConstructor: + return ast.InternalSymbolNameConstructor + case ast.KindFunctionType, ast.KindCallSignature: + return ast.InternalSymbolNameCall + case ast.KindConstructorType, ast.KindConstructSignature: + return ast.InternalSymbolNameNew + case ast.KindIndexSignature: + return ast.InternalSymbolNameIndex + case ast.KindExportDeclaration: + return ast.InternalSymbolNameExportStar + case ast.KindSourceFile: + return ast.InternalSymbolNameExportEquals + } + return ast.InternalSymbolNameMissing +} + +func (b *Binder) getDisplayName(node *ast.Node) string { + nameNode := node.Name() + if nameNode != nil { + return scanner.DeclarationNameToString(nameNode) + } + name := b.getDeclarationName(node) + if name != ast.InternalSymbolNameMissing { + return name + } + return "(Missing)" +} + +func GetSymbolNameForPrivateIdentifier(containingClassSymbol *ast.Symbol, description string) string { + return ast.InternalSymbolNamePrefix + "#" + strconv.Itoa(int(ast.GetSymbolId(containingClassSymbol))) + "@" + description +} + +func (b *Binder) declareModuleMember(node *ast.Node, symbolFlags ast.SymbolFlags, symbolExcludes ast.SymbolFlags) *ast.Symbol { + container := b.container + if node.Kind == ast.KindCommonJSExport { + container = b.file.AsNode() + } + hasExportModifier := ast.GetCombinedModifierFlags(node)&ast.ModifierFlagsExport != 0 + if symbolFlags&ast.SymbolFlagsAlias != 0 { + if node.Kind == ast.KindExportSpecifier || (node.Kind == ast.KindImportEqualsDeclaration && hasExportModifier) { + return b.declareSymbol(ast.GetExports(container.Symbol()), container.Symbol(), node, symbolFlags, symbolExcludes) + } + return b.declareSymbol(ast.GetLocals(container), nil /*parent*/, node, symbolFlags, symbolExcludes) + } + // Exported module members are given 2 symbols: A local symbol that is classified with an ExportValue flag, + // and an associated export symbol with all the correct flags set on it. There are 2 main reasons: + // + // 1. We treat locals and exports of the same name as mutually exclusive within a container. + // That means the binder will issue a Duplicate Identifier error if you mix locals and exports + // with the same name in the same container. + // TODO: Make this a more specific error and decouple it from the exclusion logic. + // 2. When we checkIdentifier in the checker, we set its resolved symbol to the local symbol, + // but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way + // when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope. + // + // NOTE: Nested ambient modules always should go to to 'locals' table to prevent their automatic merge + // during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation + // and this case is specially handled. Module augmentations should only be merged with original module definition + // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. + if !ast.IsAmbientModule(node) && (hasExportModifier || container.Flags&ast.NodeFlagsExportContext != 0) { + if !ast.IsLocalsContainer(container) || (ast.HasSyntacticModifier(node, ast.ModifierFlagsDefault) && b.getDeclarationName(node) == ast.InternalSymbolNameMissing) || ast.IsCommonJSExport(node) { + return b.declareSymbol(ast.GetExports(container.Symbol()), container.Symbol(), node, symbolFlags, symbolExcludes) + // No local symbol for an unnamed default! + } + exportKind := ast.SymbolFlagsNone + if symbolFlags&ast.SymbolFlagsValue != 0 { + exportKind = ast.SymbolFlagsExportValue + } + local := b.declareSymbol(ast.GetLocals(container), nil /*parent*/, node, exportKind, symbolExcludes) + local.ExportSymbol = b.declareSymbol(ast.GetExports(container.Symbol()), container.Symbol(), node, symbolFlags, symbolExcludes) + node.ExportableData().LocalSymbol = local + return local + } + return b.declareSymbol(ast.GetLocals(container), nil /*parent*/, node, symbolFlags, symbolExcludes) +} + +func (b *Binder) declareClassMember(node *ast.Node, symbolFlags ast.SymbolFlags, symbolExcludes ast.SymbolFlags) *ast.Symbol { + if ast.IsStatic(node) { + return b.declareSymbol(ast.GetExports(b.container.Symbol()), b.container.Symbol(), node, symbolFlags, symbolExcludes) + } + return b.declareSymbol(ast.GetMembers(b.container.Symbol()), b.container.Symbol(), node, symbolFlags, symbolExcludes) +} + +func (b *Binder) declareSourceFileMember(node *ast.Node, symbolFlags ast.SymbolFlags, symbolExcludes ast.SymbolFlags) *ast.Symbol { + if ast.IsExternalOrCommonJSModule(b.file) { + return b.declareModuleMember(node, symbolFlags, symbolExcludes) + } + return b.declareSymbol(ast.GetLocals(b.file.AsNode()), nil /*parent*/, node, symbolFlags, symbolExcludes) +} + +func (b *Binder) declareSymbolAndAddToSymbolTable(node *ast.Node, symbolFlags ast.SymbolFlags, symbolExcludes ast.SymbolFlags) *ast.Symbol { + switch b.container.Kind { + case ast.KindModuleDeclaration: + return b.declareModuleMember(node, symbolFlags, symbolExcludes) + case ast.KindSourceFile: + return b.declareSourceFileMember(node, symbolFlags, symbolExcludes) + case ast.KindClassExpression, ast.KindClassDeclaration: + return b.declareClassMember(node, symbolFlags, symbolExcludes) + case ast.KindEnumDeclaration: + return b.declareSymbol(ast.GetExports(b.container.Symbol()), b.container.Symbol(), node, symbolFlags, symbolExcludes) + case ast.KindTypeLiteral, ast.KindObjectLiteralExpression, ast.KindInterfaceDeclaration, ast.KindJsxAttributes: + return b.declareSymbol(ast.GetMembers(b.container.Symbol()), b.container.Symbol(), node, symbolFlags, symbolExcludes) + case ast.KindFunctionType, ast.KindConstructorType, ast.KindCallSignature, ast.KindConstructSignature, + ast.KindIndexSignature, ast.KindMethodDeclaration, ast.KindMethodSignature, ast.KindConstructor, ast.KindGetAccessor, + ast.KindSetAccessor, ast.KindFunctionDeclaration, ast.KindFunctionExpression, ast.KindArrowFunction, + ast.KindClassStaticBlockDeclaration, ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration, ast.KindMappedType: + return b.declareSymbol(ast.GetLocals(b.container), nil /*parent*/, node, symbolFlags, symbolExcludes) + } + panic("Unhandled case in declareSymbolAndAddToSymbolTable") +} + +func (b *Binder) newFlowNode(flags ast.FlowFlags) *ast.FlowNode { + result := b.flowNodePool.New() + result.Flags = flags + return result +} + +func (b *Binder) newFlowNodeEx(flags ast.FlowFlags, node *ast.Node, antecedent *ast.FlowNode) *ast.FlowNode { + result := b.newFlowNode(flags) + result.Node = node + result.Antecedent = antecedent + return result +} + +func (b *Binder) createLoopLabel() *ast.FlowLabel { + return b.newFlowNode(ast.FlowFlagsLoopLabel) +} + +func (b *Binder) createBranchLabel() *ast.FlowLabel { + return b.newFlowNode(ast.FlowFlagsBranchLabel) +} + +func (b *Binder) createReduceLabel(target *ast.FlowLabel, antecedents *ast.FlowList, antecedent *ast.FlowNode) *ast.FlowNode { + return b.newFlowNodeEx(ast.FlowFlagsReduceLabel, ast.NewFlowReduceLabelData(target, antecedents), antecedent) +} + +func (b *Binder) createFlowCondition(flags ast.FlowFlags, antecedent *ast.FlowNode, expression *ast.Node) *ast.FlowNode { + if antecedent.Flags&ast.FlowFlagsUnreachable != 0 { + return antecedent + } + if expression == nil { + if flags&ast.FlowFlagsTrueCondition != 0 { + return antecedent + } + return b.unreachableFlow + } + if (expression.Kind == ast.KindTrueKeyword && flags&ast.FlowFlagsFalseCondition != 0 || expression.Kind == ast.KindFalseKeyword && flags&ast.FlowFlagsTrueCondition != 0) && !ast.IsExpressionOfOptionalChainRoot(expression) && !ast.IsNullishCoalesce(expression.Parent) { + return b.unreachableFlow + } + if !isNarrowingExpression(expression) { + return antecedent + } + setFlowNodeReferenced(antecedent) + return b.newFlowNodeEx(flags, expression, antecedent) +} + +func (b *Binder) createFlowMutation(flags ast.FlowFlags, antecedent *ast.FlowNode, node *ast.Node) *ast.FlowNode { + setFlowNodeReferenced(antecedent) + b.hasFlowEffects = true + result := b.newFlowNodeEx(flags, node, antecedent) + if b.currentExceptionTarget != nil { + b.addAntecedent(b.currentExceptionTarget, result) + } + return result +} + +func (b *Binder) createFlowSwitchClause(antecedent *ast.FlowNode, switchStatement *ast.Node, clauseStart int, clauseEnd int) *ast.FlowNode { + setFlowNodeReferenced(antecedent) + return b.newFlowNodeEx(ast.FlowFlagsSwitchClause, ast.NewFlowSwitchClauseData(switchStatement, clauseStart, clauseEnd), antecedent) +} + +func (b *Binder) createFlowCall(antecedent *ast.FlowNode, node *ast.Node) *ast.FlowNode { + setFlowNodeReferenced(antecedent) + b.hasFlowEffects = true + return b.newFlowNodeEx(ast.FlowFlagsCall, node, antecedent) +} + +func (b *Binder) newFlowList(head *ast.FlowNode, tail *ast.FlowList) *ast.FlowList { + result := b.flowListPool.New() + result.Flow = head + result.Next = tail + return result +} + +func (b *Binder) combineFlowLists(head *ast.FlowList, tail *ast.FlowList) *ast.FlowList { + if head == nil { + return tail + } + return b.newFlowList(head.Flow, b.combineFlowLists(head.Next, tail)) +} + +func (b *Binder) newSingleDeclaration(declaration *ast.Node) []*ast.Node { + return b.singleDeclarationsPool.NewSlice1(declaration) +} + +func setFlowNodeReferenced(flow *ast.FlowNode) { + // On first reference we set the Referenced flag, thereafter we set the Shared flag + if flow.Flags&ast.FlowFlagsReferenced == 0 { + flow.Flags |= ast.FlowFlagsReferenced + } else { + flow.Flags |= ast.FlowFlagsShared + } +} + +func (b *Binder) addAntecedent(label *ast.FlowLabel, antecedent *ast.FlowNode) { + if antecedent.Flags&ast.FlowFlagsUnreachable != 0 { + return + } + // If antecedent isn't already on the Antecedents list, add it to the end of the list + var last *ast.FlowList + for list := label.Antecedents; list != nil; list = list.Next { + if list.Flow == antecedent { + return + } + last = list + } + if last == nil { + label.Antecedents = b.newFlowList(antecedent, nil) + } else { + last.Next = b.newFlowList(antecedent, nil) + } + setFlowNodeReferenced(antecedent) +} + +func (b *Binder) finishFlowLabel(label *ast.FlowLabel) *ast.FlowNode { + if label.Antecedents == nil { + return b.unreachableFlow + } + if label.Antecedents.Next == nil { + return label.Antecedents.Flow + } + return label +} + +func (b *Binder) bind(node *ast.Node) bool { + if node == nil { + return false + } + saveInStrictMode := b.inStrictMode + // Even though in the AST the jsdoc @typedef node belongs to the current node, + // its symbol might be in the same scope with the current node's symbol. Consider: + // + // /** @typedef {string | number} MyType */ + // function foo(); + // + // Here the current node is "foo", which is a container, but the scope of "MyType" should + // not be inside "foo". Therefore we always bind @typedef before bind the parent node, + // and skip binding this tag later when binding all the other jsdoc tags. + + // First we bind declaration nodes to a symbol if possible. We'll both create a symbol + // and then potentially add the symbol to an appropriate symbol table. Possible + // destination symbol tables are: + // + // 1) The 'exports' table of the current container's symbol. + // 2) The 'members' table of the current container's symbol. + // 3) The 'locals' table of the current container. + // + // However, not all symbols will end up in any of these tables. 'Anonymous' symbols + // (like TypeLiterals for example) will not be put in any table. + switch node.Kind { + case ast.KindIdentifier: + node.AsIdentifier().FlowNode = b.currentFlow + b.checkContextualIdentifier(node) + case ast.KindThisKeyword, ast.KindSuperKeyword: + node.AsKeywordExpression().FlowNode = b.currentFlow + case ast.KindQualifiedName: + if b.currentFlow != nil && ast.IsPartOfTypeQuery(node) { + node.AsQualifiedName().FlowNode = b.currentFlow + } + case ast.KindMetaProperty: + node.AsMetaProperty().FlowNode = b.currentFlow + case ast.KindPrivateIdentifier: + b.checkPrivateIdentifier(node) + case ast.KindPropertyAccessExpression, ast.KindElementAccessExpression: + if b.currentFlow != nil && isNarrowableReference(node) { + setFlowNode(node, b.currentFlow) + } + case ast.KindBinaryExpression: + switch ast.GetAssignmentDeclarationKind(node.AsBinaryExpression()) { + case ast.JSDeclarationKindProperty: + b.bindExpandoPropertyAssignment(node) + case ast.JSDeclarationKindThisProperty: + b.bindThisPropertyAssignment(node) + } + b.checkStrictModeBinaryExpression(node) + case ast.KindCatchClause: + b.checkStrictModeCatchClause(node) + case ast.KindDeleteExpression: + b.checkStrictModeDeleteExpression(node) + case ast.KindPostfixUnaryExpression: + b.checkStrictModePostfixUnaryExpression(node) + case ast.KindPrefixUnaryExpression: + b.checkStrictModePrefixUnaryExpression(node) + case ast.KindWithStatement: + b.checkStrictModeWithStatement(node) + case ast.KindLabeledStatement: + b.checkStrictModeLabeledStatement(node) + case ast.KindThisType: + b.seenThisKeyword = true + case ast.KindTypeParameter: + b.bindTypeParameter(node) + case ast.KindParameter: + b.bindParameter(node) + case ast.KindVariableDeclaration: + b.bindVariableDeclarationOrBindingElement(node) + case ast.KindBindingElement: + node.AsBindingElement().FlowNode = b.currentFlow + b.bindVariableDeclarationOrBindingElement(node) + case ast.KindCommonJSExport: + b.declareModuleMember(node, ast.SymbolFlagsFunctionScopedVariable, ast.SymbolFlagsFunctionScopedVariableExcludes) + case ast.KindPropertyDeclaration, ast.KindPropertySignature: + b.bindPropertyWorker(node) + case ast.KindPropertyAssignment, ast.KindShorthandPropertyAssignment: + b.bindPropertyOrMethodOrAccessor(node, ast.SymbolFlagsProperty, ast.SymbolFlagsPropertyExcludes) + case ast.KindEnumMember: + b.bindPropertyOrMethodOrAccessor(node, ast.SymbolFlagsEnumMember, ast.SymbolFlagsEnumMemberExcludes) + case ast.KindCallSignature, ast.KindConstructSignature, ast.KindIndexSignature: + b.declareSymbolAndAddToSymbolTable(node, ast.SymbolFlagsSignature, ast.SymbolFlagsNone) + case ast.KindMethodDeclaration, ast.KindMethodSignature: + b.bindPropertyOrMethodOrAccessor(node, ast.SymbolFlagsMethod|getOptionalSymbolFlagForNode(node), core.IfElse(ast.IsObjectLiteralMethod(node), ast.SymbolFlagsPropertyExcludes, ast.SymbolFlagsMethodExcludes)) + case ast.KindFunctionDeclaration: + b.bindFunctionDeclaration(node) + case ast.KindConstructor: + b.declareSymbolAndAddToSymbolTable(node, ast.SymbolFlagsConstructor, ast.SymbolFlagsNone) + case ast.KindGetAccessor: + b.bindPropertyOrMethodOrAccessor(node, ast.SymbolFlagsGetAccessor, ast.SymbolFlagsGetAccessorExcludes) + case ast.KindSetAccessor: + b.bindPropertyOrMethodOrAccessor(node, ast.SymbolFlagsSetAccessor, ast.SymbolFlagsSetAccessorExcludes) + case ast.KindFunctionType, ast.KindConstructorType: + b.bindFunctionOrConstructorType(node) + case ast.KindTypeLiteral, ast.KindMappedType: + b.bindAnonymousDeclaration(node, ast.SymbolFlagsTypeLiteral, ast.InternalSymbolNameType) + case ast.KindObjectLiteralExpression: + b.bindAnonymousDeclaration(node, ast.SymbolFlagsObjectLiteral, ast.InternalSymbolNameObject) + case ast.KindFunctionExpression, ast.KindArrowFunction: + b.bindFunctionExpression(node) + case ast.KindClassExpression, ast.KindClassDeclaration: + b.inStrictMode = true + b.bindClassLikeDeclaration(node) + case ast.KindInterfaceDeclaration: + b.bindBlockScopedDeclaration(node, ast.SymbolFlagsInterface, ast.SymbolFlagsInterfaceExcludes) + case ast.KindCallExpression: + b.bindCallExpression(node) + case ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration: + b.bindBlockScopedDeclaration(node, ast.SymbolFlagsTypeAlias, ast.SymbolFlagsTypeAliasExcludes) + case ast.KindEnumDeclaration: + b.bindEnumDeclaration(node) + case ast.KindModuleDeclaration: + b.bindModuleDeclaration(node) + case ast.KindImportEqualsDeclaration, ast.KindNamespaceImport, ast.KindImportSpecifier, ast.KindExportSpecifier: + b.declareSymbolAndAddToSymbolTable(node, ast.SymbolFlagsAlias, ast.SymbolFlagsAliasExcludes) + case ast.KindNamespaceExportDeclaration: + b.bindNamespaceExportDeclaration(node) + case ast.KindImportClause: + b.bindImportClause(node) + case ast.KindExportDeclaration: + b.bindExportDeclaration(node) + case ast.KindExportAssignment, ast.KindJSExportAssignment: + b.bindExportAssignment(node) + case ast.KindSourceFile: + b.updateStrictModeStatementList(node.AsSourceFile().Statements) + b.bindSourceFileIfExternalModule() + case ast.KindBlock: + if ast.IsFunctionLikeOrClassStaticBlockDeclaration(node.Parent) { + b.updateStrictModeStatementList(node.AsBlock().Statements) + } + case ast.KindModuleBlock: + b.updateStrictModeStatementList(node.AsModuleBlock().Statements) + case ast.KindJsxAttributes: + b.bindJsxAttributes(node) + case ast.KindJsxAttribute: + b.bindJsxAttribute(node, ast.SymbolFlagsProperty, ast.SymbolFlagsPropertyExcludes) + } + // Then we recurse into the children of the node to bind them as well. For certain + // symbols we do specialized work when we recurse. For example, we'll keep track of + // the current 'container' node when it changes. This helps us know which symbol table + // a local should go into for example. Since terminal nodes are known not to have + // children, as an optimization we don't process those. + thisNodeOrAnySubnodesHasError := node.Flags&ast.NodeFlagsThisNodeHasError != 0 + if node.Kind > ast.KindLastToken { + saveSeenParseError := b.seenParseError + b.seenParseError = false + containerFlags := GetContainerFlags(node) + if containerFlags == ContainerFlagsNone { + b.bindChildren(node) + } else { + b.bindContainer(node, containerFlags) + } + if b.seenParseError { + thisNodeOrAnySubnodesHasError = true + } + b.seenParseError = saveSeenParseError + } + if thisNodeOrAnySubnodesHasError { + node.Flags |= ast.NodeFlagsThisNodeOrAnySubNodesHasError + b.seenParseError = true + } + b.inStrictMode = saveInStrictMode + return false +} + +func (b *Binder) bindPropertyWorker(node *ast.Node) { + isAutoAccessor := ast.IsAutoAccessorPropertyDeclaration(node) + includes := core.IfElse(isAutoAccessor, ast.SymbolFlagsAccessor, ast.SymbolFlagsProperty) + excludes := core.IfElse(isAutoAccessor, ast.SymbolFlagsAccessorExcludes, ast.SymbolFlagsPropertyExcludes) + b.bindPropertyOrMethodOrAccessor(node, includes|getOptionalSymbolFlagForNode(node), excludes) +} + +func (b *Binder) bindSourceFileIfExternalModule() { + b.setExportContextFlag(b.file.AsNode()) + if ast.IsExternalOrCommonJSModule(b.file) { + b.bindSourceFileAsExternalModule() + } else if ast.IsJsonSourceFile(b.file) { + b.bindSourceFileAsExternalModule() + // Create symbol equivalent for the module.exports = {} + originalSymbol := b.file.Symbol + b.declareSymbol(ast.GetSymbolTable(&b.file.Symbol.Exports), b.file.Symbol, b.file.AsNode(), ast.SymbolFlagsProperty, ast.SymbolFlagsAll) + b.file.Symbol = originalSymbol + } +} + +func (b *Binder) bindSourceFileAsExternalModule() { + b.bindAnonymousDeclaration(b.file.AsNode(), ast.SymbolFlagsValueModule, "\""+tspath.RemoveFileExtension(b.file.FileName())+"\"") +} + +func (b *Binder) bindModuleDeclaration(node *ast.Node) { + b.setExportContextFlag(node) + if ast.IsAmbientModule(node) { + if ast.HasSyntacticModifier(node, ast.ModifierFlagsExport) { + b.errorOnFirstToken(node, diagnostics.X_export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible) + } + if ast.IsModuleAugmentationExternal(node) { + b.declareModuleSymbol(node) + } else { + name := node.AsModuleDeclaration().Name() + symbol := b.declareSymbolAndAddToSymbolTable(node, ast.SymbolFlagsValueModule, ast.SymbolFlagsValueModuleExcludes) + + if ast.IsStringLiteral(name) { + pattern := core.TryParsePattern(name.AsStringLiteral().Text) + if !pattern.IsValid() { + // An invalid pattern - must have multiple wildcards. + b.errorOnFirstToken(name, diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, name.AsStringLiteral().Text) + } else if pattern.StarIndex >= 0 { + b.file.PatternAmbientModules = append(b.file.PatternAmbientModules, &ast.PatternAmbientModule{Pattern: pattern, Symbol: symbol}) + } + } + } + } else { + state := b.declareModuleSymbol(node) + if state != ast.ModuleInstanceStateNonInstantiated { + symbol := node.AsModuleDeclaration().Symbol + if symbol.Flags&(ast.SymbolFlagsFunction|ast.SymbolFlagsClass|ast.SymbolFlagsRegularEnum) != 0 || state != ast.ModuleInstanceStateConstEnumOnly { + // if module was already merged with some function, class or non-const enum, treat it as non-const-enum-only + symbol.Flags &^= ast.SymbolFlagsConstEnumOnlyModule + } + } + } +} + +func (b *Binder) declareModuleSymbol(node *ast.Node) ast.ModuleInstanceState { + state := ast.GetModuleInstanceState(node) + instantiated := state != ast.ModuleInstanceStateNonInstantiated + b.declareSymbolAndAddToSymbolTable(node, core.IfElse(instantiated, ast.SymbolFlagsValueModule, ast.SymbolFlagsNamespaceModule), core.IfElse(instantiated, ast.SymbolFlagsValueModuleExcludes, ast.SymbolFlagsNamespaceModuleExcludes)) + return state +} + +func (b *Binder) bindNamespaceExportDeclaration(node *ast.Node) { + if node.Modifiers() != nil { + b.errorOnNode(node, diagnostics.Modifiers_cannot_appear_here) + } + switch { + case !ast.IsSourceFile(node.Parent): + b.errorOnNode(node, diagnostics.Global_module_exports_may_only_appear_at_top_level) + case !ast.IsExternalModule(node.Parent.AsSourceFile()): + b.errorOnNode(node, diagnostics.Global_module_exports_may_only_appear_in_module_files) + case !node.Parent.AsSourceFile().IsDeclarationFile: + b.errorOnNode(node, diagnostics.Global_module_exports_may_only_appear_in_declaration_files) + default: + b.declareSymbol(ast.GetSymbolTable(&b.file.Symbol.GlobalExports), b.file.Symbol, node, ast.SymbolFlagsAlias, ast.SymbolFlagsAliasExcludes) + } +} + +func (b *Binder) bindImportClause(node *ast.Node) { + if node.AsImportClause().Name() != nil { + b.declareSymbolAndAddToSymbolTable(node, ast.SymbolFlagsAlias, ast.SymbolFlagsAliasExcludes) + } +} + +func (b *Binder) bindExportDeclaration(node *ast.Node) { + decl := node.AsExportDeclaration() + if b.container.Symbol() == nil { + // Export * in some sort of block construct + b.bindAnonymousDeclaration(node, ast.SymbolFlagsExportStar, b.getDeclarationName(node)) + } else if decl.ExportClause == nil { + // All export * declarations are collected in an __export symbol + b.declareSymbol(ast.GetExports(b.container.Symbol()), b.container.Symbol(), node, ast.SymbolFlagsExportStar, ast.SymbolFlagsNone) + } else if ast.IsNamespaceExport(decl.ExportClause) { + b.declareSymbol(ast.GetExports(b.container.Symbol()), b.container.Symbol(), decl.ExportClause, ast.SymbolFlagsAlias, ast.SymbolFlagsAliasExcludes) + } +} + +func (b *Binder) bindExportAssignment(node *ast.Node) { + container := b.container + if ast.IsJSExportAssignment(node) { + container = b.file.AsNode() + } + if container.Symbol() == nil && ast.IsExportAssignment(node) { + // Incorrect export assignment in some sort of block construct + b.bindAnonymousDeclaration(node, ast.SymbolFlagsValue, b.getDeclarationName(node)) + } else { + flags := ast.SymbolFlagsProperty + if ast.ExportAssignmentIsAlias(node) { + flags = ast.SymbolFlagsAlias + } + // If there is an `export default x;` alias declaration, can't `export default` anything else. + // (In contrast, you can still have `export default function f() {}` and `export default interface I {}`.) + symbol := b.declareSymbol(ast.GetExports(container.Symbol()), container.Symbol(), node, flags, ast.SymbolFlagsAll) + if ast.IsJSExportAssignment(node) || node.AsExportAssignment().IsExportEquals { + // Will be an error later, since the module already has other exports. Just make sure this has a valueDeclaration set. + SetValueDeclaration(symbol, node) + } + } +} + +func (b *Binder) bindJsxAttributes(node *ast.Node) { + b.bindAnonymousDeclaration(node, ast.SymbolFlagsObjectLiteral, ast.InternalSymbolNameJSXAttributes) +} + +func (b *Binder) bindJsxAttribute(node *ast.Node, symbolFlags ast.SymbolFlags, symbolExcludes ast.SymbolFlags) { + b.declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) +} + +func (b *Binder) setExportContextFlag(node *ast.Node) { + // A declaration source file or ambient module declaration that contains no export declarations (but possibly regular + // declarations with export modifiers) is an export context in which declarations are implicitly exported. + if node.Flags&ast.NodeFlagsAmbient != 0 && !b.hasExportDeclarations(node) { + node.Flags |= ast.NodeFlagsExportContext + } else { + node.Flags &= ^ast.NodeFlagsExportContext + } +} + +func (b *Binder) hasExportDeclarations(node *ast.Node) bool { + var statements []*ast.Node + switch node.Kind { + case ast.KindSourceFile: + statements = node.AsSourceFile().Statements.Nodes + case ast.KindModuleDeclaration: + body := node.AsModuleDeclaration().Body + if body != nil && ast.IsModuleBlock(body) { + statements = body.AsModuleBlock().Statements.Nodes + } + } + return core.Some(statements, func(s *ast.Node) bool { + return ast.IsExportDeclaration(s) || ast.IsExportAssignment(s) || ast.IsJSExportAssignment(s) + }) +} + +func (b *Binder) bindFunctionExpression(node *ast.Node) { + setFlowNode(node, b.currentFlow) + bindingName := ast.InternalSymbolNameFunction + if ast.IsFunctionExpression(node) && node.AsFunctionExpression().Name() != nil { + b.checkStrictModeFunctionName(node) + bindingName = node.AsFunctionExpression().Name().AsIdentifier().Text + } + b.bindAnonymousDeclaration(node, ast.SymbolFlagsFunction, bindingName) +} + +func (b *Binder) bindCallExpression(node *ast.Node) { + // !!! for ModuleDetectionKind.Force, external module indicator is forced to `true` in Strada for source files, in which case + // we should set the commonjs module indicator but not call b.bindSourceFileAsExternalModule + // !!! && file.externalModuleIndicator !== true (used for ModuleDetectionKind.Force) + if ast.IsInJSFile(node) && + b.file.ExternalModuleIndicator == nil && + b.file.CommonJSModuleIndicator == nil && + ast.IsRequireCall(node, false /*requireStringLiteralLikeArgument*/) { + b.file.CommonJSModuleIndicator = node + b.bindSourceFileAsExternalModule() + } +} + +func (b *Binder) bindClassLikeDeclaration(node *ast.Node) { + name := node.Name() + switch node.Kind { + case ast.KindClassDeclaration: + b.bindBlockScopedDeclaration(node, ast.SymbolFlagsClass, ast.SymbolFlagsClassExcludes) + case ast.KindClassExpression: + nameText := ast.InternalSymbolNameClass + if name != nil { + nameText = name.AsIdentifier().Text + b.classifiableNames.Add(nameText) + } + b.bindAnonymousDeclaration(node, ast.SymbolFlagsClass, nameText) + } + symbol := node.Symbol() + // TypeScript 1.0 spec (April 2014): 8.4 + // Every class automatically contains a static property member named 'prototype', the + // type of which is an instantiation of the class type with type Any supplied as a type + // argument for each type parameter. It is an error to explicitly declare a static + // property member with the name 'prototype'. + // + // Note: we check for this here because this class may be merging into a module. The + // module might have an exported variable called 'prototype'. We can't allow that as + // that would clash with the built-in 'prototype' for the class. + prototypeSymbol := b.newSymbol(ast.SymbolFlagsProperty|ast.SymbolFlagsPrototype, "prototype") + symbolExport := ast.GetExports(symbol)[prototypeSymbol.Name] + if symbolExport != nil { + b.errorOnNode(symbolExport.Declarations[0], diagnostics.Duplicate_identifier_0, ast.SymbolName(prototypeSymbol)) + } + ast.GetExports(symbol)[prototypeSymbol.Name] = prototypeSymbol + prototypeSymbol.Parent = symbol +} + +func (b *Binder) bindPropertyOrMethodOrAccessor(node *ast.Node, symbolFlags ast.SymbolFlags, symbolExcludes ast.SymbolFlags) { + if b.currentFlow != nil && ast.IsObjectLiteralOrClassExpressionMethodOrAccessor(node) { + setFlowNode(node, b.currentFlow) + } + if ast.HasDynamicName(node) { + b.bindAnonymousDeclaration(node, symbolFlags, ast.InternalSymbolNameComputed) + } else { + b.declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) + } +} + +func (b *Binder) bindFunctionOrConstructorType(node *ast.Node) { + // For a given function symbol "<...>(...) => T" we want to generate a symbol identical + // to the one we would get for: { <...>(...): T } + // + // We do that by making an anonymous type literal symbol, and then setting the function + // symbol as its sole member. To the rest of the system, this symbol will be indistinguishable + // from an actual type literal symbol you would have gotten had you used the long form. + symbol := b.newSymbol(ast.SymbolFlagsSignature, b.getDeclarationName(node)) + b.addDeclarationToSymbol(symbol, node, ast.SymbolFlagsSignature) + typeLiteralSymbol := b.newSymbol(ast.SymbolFlagsTypeLiteral, ast.InternalSymbolNameType) + b.addDeclarationToSymbol(typeLiteralSymbol, node, ast.SymbolFlagsTypeLiteral) + typeLiteralSymbol.Members = make(ast.SymbolTable) + typeLiteralSymbol.Members[symbol.Name] = symbol +} + +func addLateBoundAssignmentDeclarationToSymbol(node *ast.Node, symbol *ast.Symbol) { + symbol.AssignmentDeclarationMembers.Add(node) +} + +func (b *Binder) bindExpandoPropertyAssignment(node *ast.Node) { + expr := node.AsBinaryExpression() + parent := expr.Left.Expression() + symbol := b.lookupEntity(parent, b.blockScopeContainer) + if symbol == nil { + symbol = b.lookupEntity(parent, b.container) + } + if symbol = getInitializerSymbol(symbol); symbol != nil { + if ast.HasDynamicName(node) { + b.bindAnonymousDeclaration(node, ast.SymbolFlagsProperty|ast.SymbolFlagsAssignment, ast.InternalSymbolNameComputed) + addLateBoundAssignmentDeclarationToSymbol(node, symbol) + } else { + b.declareSymbol(ast.GetExports(symbol), symbol, node, ast.SymbolFlagsProperty|ast.SymbolFlagsAssignment, ast.SymbolFlagsPropertyExcludes) + } + } +} + +func getInitializerSymbol(symbol *ast.Symbol) *ast.Symbol { + if symbol == nil || symbol.ValueDeclaration == nil { + return nil + } + declaration := symbol.ValueDeclaration + // For an assignment 'fn.xxx = ...', where 'fn' is a previously declared function or a previously + // declared const variable initialized with a function expression or arrow function, we add expando + // property declarations to the function's symbol. + // This also applies to class expressions and empty object literals. + switch { + case ast.IsFunctionDeclaration(declaration) || ast.IsInJSFile(declaration) && ast.IsClassDeclaration(declaration): + return symbol + case ast.IsVariableDeclaration(declaration) && + (declaration.Parent.Flags&ast.NodeFlagsConst != 0 || ast.IsInJSFile(declaration)): + initializer := declaration.Initializer() + if ast.IsExpandoInitializer(initializer) { + return initializer.Symbol() + } + case ast.IsBinaryExpression(declaration) && ast.IsInJSFile(declaration): + initializer := declaration.AsBinaryExpression().Right + if ast.IsExpandoInitializer(initializer) { + return initializer.Symbol() + } + } + return nil +} + +func (b *Binder) bindThisPropertyAssignment(node *ast.Node) { + if !ast.IsInJSFile(node) { + return + } + bin := node.AsBinaryExpression() + if ast.IsPropertyAccessExpression(bin.Left) && ast.IsPrivateIdentifier(bin.Left.AsPropertyAccessExpression().Name()) || + b.thisContainer == nil { + return + } + if classSymbol, symbolTable := b.getThisClassAndSymbolTable(); symbolTable != nil { + if ast.HasDynamicName(node) { + b.declareSymbolEx(symbolTable, classSymbol, node, ast.SymbolFlagsProperty, ast.SymbolFlagsNone, true /*isReplaceableByMethod*/, true /*isComputedName*/) + addLateBoundAssignmentDeclarationToSymbol(node, classSymbol) + } else { + b.declareSymbolEx(symbolTable, classSymbol, node, ast.SymbolFlagsProperty|ast.SymbolFlagsAssignment, ast.SymbolFlagsNone, true /*isReplaceableByMethod*/, false /*isComputedName*/) + } + } else if b.thisContainer.Kind != ast.KindFunctionDeclaration && b.thisContainer.Kind != ast.KindFunctionExpression { + // !!! constructor functions + panic("Unhandled case in bindThisPropertyAssignment: " + b.thisContainer.Kind.String()) + } +} + +func (b *Binder) getThisClassAndSymbolTable() (classSymbol *ast.Symbol, symbolTable ast.SymbolTable) { + if b.thisContainer == nil { + return nil, nil + } + switch b.thisContainer.Kind { + case ast.KindFunctionDeclaration, ast.KindFunctionExpression: + // !!! constructor functions + case ast.KindConstructor, ast.KindPropertyDeclaration, ast.KindMethodDeclaration, ast.KindGetAccessor, ast.KindSetAccessor, ast.KindClassStaticBlockDeclaration: + // this.property assignment in class member -- bind to the containing class + classSymbol = b.thisContainer.Parent.Symbol() + if ast.IsStatic(b.thisContainer) { + symbolTable = ast.GetExports(classSymbol) + } else { + symbolTable = ast.GetMembers(classSymbol) + } + } + return classSymbol, symbolTable +} + +func (b *Binder) bindEnumDeclaration(node *ast.Node) { + if ast.IsEnumConst(node) { + b.bindBlockScopedDeclaration(node, ast.SymbolFlagsConstEnum, ast.SymbolFlagsConstEnumExcludes) + } else { + b.bindBlockScopedDeclaration(node, ast.SymbolFlagsRegularEnum, ast.SymbolFlagsRegularEnumExcludes) + } +} + +func (b *Binder) bindVariableDeclarationOrBindingElement(node *ast.Node) { + if b.inStrictMode { + b.checkStrictModeEvalOrArguments(node, node.Name()) + } + if name := node.Name(); name != nil && !ast.IsBindingPattern(name) { + switch { + case ast.IsVariableDeclarationInitializedToRequire(node): + b.declareSymbolAndAddToSymbolTable(node, ast.SymbolFlagsAlias, ast.SymbolFlagsAliasExcludes) + case ast.IsBlockOrCatchScoped(node): + b.bindBlockScopedDeclaration(node, ast.SymbolFlagsBlockScopedVariable, ast.SymbolFlagsBlockScopedVariableExcludes) + case ast.IsPartOfParameterDeclaration(node): + // It is safe to walk up parent chain to find whether the node is a destructuring parameter declaration + // because its parent chain has already been set up, since parents are set before descending into children. + // + // If node is a binding element in parameter declaration, we need to use ParameterExcludes. + // Using ParameterExcludes flag allows the compiler to report an error on duplicate identifiers in Parameter Declaration + // For example: + // function foo([a,a]) {} // Duplicate Identifier error + // function bar(a,a) {} // Duplicate Identifier error, parameter declaration in this case is handled in bindParameter + // // which correctly set excluded symbols + b.declareSymbolAndAddToSymbolTable(node, ast.SymbolFlagsFunctionScopedVariable, ast.SymbolFlagsParameterExcludes) + default: + b.declareSymbolAndAddToSymbolTable(node, ast.SymbolFlagsFunctionScopedVariable, ast.SymbolFlagsFunctionScopedVariableExcludes) + } + } +} + +func (b *Binder) bindParameter(node *ast.Node) { + decl := node.AsParameterDeclaration() + if b.inStrictMode && node.Flags&ast.NodeFlagsAmbient == 0 { + // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a + // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) + b.checkStrictModeEvalOrArguments(node, decl.Name()) + } + if ast.IsBindingPattern(decl.Name()) { + index := slices.Index(node.Parent.Parameters(), node) + b.bindAnonymousDeclaration(node, ast.SymbolFlagsFunctionScopedVariable, "__"+strconv.Itoa(index)) + } else { + b.declareSymbolAndAddToSymbolTable(node, ast.SymbolFlagsFunctionScopedVariable, ast.SymbolFlagsParameterExcludes) + } + // If this is a property-parameter, then also declare the property symbol into the + // containing class. + if ast.IsParameterPropertyDeclaration(node, node.Parent) { + classDeclaration := node.Parent.Parent + flags := ast.SymbolFlagsProperty | core.IfElse(decl.QuestionToken != nil, ast.SymbolFlagsOptional, ast.SymbolFlagsNone) + b.declareSymbol(ast.GetMembers(classDeclaration.Symbol()), classDeclaration.Symbol(), node, flags, ast.SymbolFlagsPropertyExcludes) + } +} + +func (b *Binder) bindFunctionDeclaration(node *ast.Node) { + b.checkStrictModeFunctionName(node) + if b.inStrictMode { + b.bindBlockScopedDeclaration(node, ast.SymbolFlagsFunction, ast.SymbolFlagsFunctionExcludes) + } else { + b.declareSymbolAndAddToSymbolTable(node, ast.SymbolFlagsFunction, ast.SymbolFlagsFunctionExcludes) + } +} + +func (b *Binder) getInferTypeContainer(node *ast.Node) *ast.Node { + extendsType := ast.FindAncestor(node, func(n *ast.Node) bool { + parent := n.Parent + return parent != nil && ast.IsConditionalTypeNode(parent) && parent.AsConditionalTypeNode().ExtendsType == n + }) + if extendsType != nil { + return extendsType.Parent + } + return nil +} + +func (b *Binder) bindAnonymousDeclaration(node *ast.Node, symbolFlags ast.SymbolFlags, name string) { + symbol := b.newSymbol(symbolFlags, name) + if symbolFlags&(ast.SymbolFlagsEnumMember|ast.SymbolFlagsClassMember) != 0 { + symbol.Parent = b.container.Symbol() + } + b.addDeclarationToSymbol(symbol, node, symbolFlags) +} + +func (b *Binder) bindBlockScopedDeclaration(node *ast.Node, symbolFlags ast.SymbolFlags, symbolExcludes ast.SymbolFlags) { + switch b.blockScopeContainer.Kind { + case ast.KindModuleDeclaration: + b.declareModuleMember(node, symbolFlags, symbolExcludes) + case ast.KindSourceFile: + if ast.IsExternalOrCommonJSModule(b.container.AsSourceFile()) { + b.declareModuleMember(node, symbolFlags, symbolExcludes) + break + } + fallthrough + default: + b.declareSymbol(ast.GetLocals(b.blockScopeContainer), nil /*parent*/, node, symbolFlags, symbolExcludes) + } +} + +func (b *Binder) bindTypeParameter(node *ast.Node) { + if node.Parent.Kind == ast.KindInferType { + container := b.getInferTypeContainer(node.Parent) + if container != nil { + b.declareSymbol(ast.GetLocals(container), nil /*parent*/, node, ast.SymbolFlagsTypeParameter, ast.SymbolFlagsTypeParameterExcludes) + } else { + b.bindAnonymousDeclaration(node, ast.SymbolFlagsTypeParameter, b.getDeclarationName(node)) + } + } else { + b.declareSymbolAndAddToSymbolTable(node, ast.SymbolFlagsTypeParameter, ast.SymbolFlagsTypeParameterExcludes) + } +} + +func (b *Binder) lookupEntity(node *ast.Node, container *ast.Node) *ast.Symbol { + if ast.IsIdentifier(node) { + return b.lookupName(node.AsIdentifier().Text, container) + } + if ast.IsPropertyAccessExpression(node) && node.AsPropertyAccessExpression().Expression.Kind == ast.KindThisKeyword || + ast.IsElementAccessExpression(node) && node.AsElementAccessExpression().Expression.Kind == ast.KindThisKeyword { + if _, symbolTable := b.getThisClassAndSymbolTable(); symbolTable != nil { + if name := ast.GetElementOrPropertyAccessName(node); name != nil { + return symbolTable[name.Text()] + } + } + return nil + } + if symbol := getInitializerSymbol(b.lookupEntity(node.Expression(), container)); symbol != nil && symbol.Exports != nil { + if name := ast.GetElementOrPropertyAccessName(node); name != nil { + return symbol.Exports[name.Text()] + } + } + return nil +} + +func (b *Binder) lookupName(name string, container *ast.Node) *ast.Symbol { + if localsContainer := container.LocalsContainerData(); localsContainer != nil { + if local := localsContainer.Locals[name]; local != nil { + return core.OrElse(local.ExportSymbol, local) + } + } + + if declaration := container.DeclarationData(); declaration != nil && declaration.Symbol != nil { + return declaration.Symbol.Exports[name] + } + return nil +} + +// The binder visits every node in the syntax tree so it is a convenient place to perform a single localized +// check for reserved words used as identifiers in strict mode code, as well as `yield` or `await` in +// [Yield] or [Await] contexts, respectively. +func (b *Binder) checkContextualIdentifier(node *ast.Node) { + // Report error only if there are no parse errors in file + if len(b.file.Diagnostics()) == 0 && node.Flags&ast.NodeFlagsAmbient == 0 && node.Flags&ast.NodeFlagsJSDoc == 0 && !ast.IsIdentifierName(node) { + // strict mode identifiers + originalKeywordKind := scanner.GetIdentifierToken(node.AsIdentifier().Text) + if originalKeywordKind == ast.KindIdentifier { + return + } + if b.inStrictMode && originalKeywordKind >= ast.KindFirstFutureReservedWord && originalKeywordKind <= ast.KindLastFutureReservedWord { + b.errorOnNode(node, b.getStrictModeIdentifierMessage(node), scanner.DeclarationNameToString(node)) + } else if originalKeywordKind == ast.KindAwaitKeyword { + if ast.IsExternalModule(b.file) && ast.IsInTopLevelContext(node) { + b.errorOnNode(node, diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, scanner.DeclarationNameToString(node)) + } else if node.Flags&ast.NodeFlagsAwaitContext != 0 { + b.errorOnNode(node, diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, scanner.DeclarationNameToString(node)) + } + } else if originalKeywordKind == ast.KindYieldKeyword && node.Flags&ast.NodeFlagsYieldContext != 0 { + b.errorOnNode(node, diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, scanner.DeclarationNameToString(node)) + } + } +} + +func (b *Binder) checkPrivateIdentifier(node *ast.Node) { + if node.AsPrivateIdentifier().Text == "#constructor" { + // Report error only if there are no parse errors in file + if len(b.file.Diagnostics()) == 0 { + b.errorOnNode(node, diagnostics.X_constructor_is_a_reserved_word, scanner.DeclarationNameToString(node)) + } + } +} + +func (b *Binder) getStrictModeIdentifierMessage(node *ast.Node) *diagnostics.Message { + // Provide specialized messages to help the user understand why we think they're in + // strict mode. + if ast.GetContainingClass(node) != nil { + return diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode + } + if b.file.ExternalModuleIndicator != nil { + return diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode + } + return diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode +} + +func (b *Binder) updateStrictModeStatementList(statements *ast.NodeList) { + if !b.inStrictMode { + useStrictDirective := FindUseStrictPrologue(b.file, statements.Nodes) + if useStrictDirective != nil { + b.inStrictMode = true + } + } +} + +// Should be called only on prologue directives (ast.IsPrologueDirective(node) should be true) +func isUseStrictPrologueDirective(sourceFile *ast.SourceFile, node *ast.Node) bool { + nodeText := scanner.GetSourceTextOfNodeFromSourceFile(sourceFile, node.AsExpressionStatement().Expression, false /*includeTrivia*/) + // Note: the node text must be exactly "use strict" or 'use strict'. It is not ok for the + // string to contain unicode escapes (as per ES5). + return nodeText == "\"use strict\"" || nodeText == "'use strict'" +} + +func FindUseStrictPrologue(sourceFile *ast.SourceFile, statements []*ast.Node) *ast.Node { + for _, statement := range statements { + if ast.IsPrologueDirective(statement) { + if isUseStrictPrologueDirective(sourceFile, statement) { + return statement + } + } else { + return nil + } + } + + return nil +} + +func (b *Binder) checkStrictModeFunctionName(node *ast.Node) { + if b.inStrictMode && node.Flags&ast.NodeFlagsAmbient == 0 { + // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a strict mode FunctionDeclaration or FunctionExpression (13.1)) + b.checkStrictModeEvalOrArguments(node, node.Name()) + } +} + +func (b *Binder) getStrictModeBlockScopeFunctionDeclarationMessage(node *ast.Node) *diagnostics.Message { + // Provide specialized messages to help the user understand why we think they're in strict mode. + if ast.GetContainingClass(node) != nil { + return diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES5_Class_definitions_are_automatically_in_strict_mode + } + if b.file.ExternalModuleIndicator != nil { + return diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES5_Modules_are_automatically_in_strict_mode + } + return diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES5 +} + +func (b *Binder) checkStrictModeBinaryExpression(node *ast.Node) { + expr := node.AsBinaryExpression() + if b.inStrictMode && ast.IsLeftHandSideExpression(expr.Left) && ast.IsAssignmentOperator(expr.OperatorToken.Kind) { + // ECMA 262 (Annex C) The identifier eval or arguments may not appear as the LeftHandSideExpression of an + // Assignment operator(11.13) or of a PostfixExpression(11.3) + b.checkStrictModeEvalOrArguments(node, expr.Left) + } +} + +func (b *Binder) checkStrictModeCatchClause(node *ast.Node) { + // It is a SyntaxError if a TryStatement with a Catch occurs within strict code and the Identifier of the + // Catch production is eval or arguments + clause := node.AsCatchClause() + if b.inStrictMode && clause.VariableDeclaration != nil { + b.checkStrictModeEvalOrArguments(node, clause.VariableDeclaration.AsVariableDeclaration().Name()) + } +} + +func (b *Binder) checkStrictModeDeleteExpression(node *ast.Node) { + // Grammar checking + expr := node.AsDeleteExpression() + if b.inStrictMode && expr.Expression.Kind == ast.KindIdentifier { + // When a delete operator occurs within strict mode code, a SyntaxError is thrown if its + // UnaryExpression is a direct reference to a variable, function argument, or function name + b.errorOnNode(expr.Expression, diagnostics.X_delete_cannot_be_called_on_an_identifier_in_strict_mode) + } +} + +func (b *Binder) checkStrictModePostfixUnaryExpression(node *ast.Node) { + // Grammar checking + // The identifier eval or arguments may not appear as the LeftHandSideExpression of an + // Assignment operator(11.13) or of a PostfixExpression(11.3) or as the UnaryExpression + // operated upon by a Prefix Increment(11.4.4) or a Prefix Decrement(11.4.5) operator. + if b.inStrictMode { + b.checkStrictModeEvalOrArguments(node, node.AsPostfixUnaryExpression().Operand) + } +} + +func (b *Binder) checkStrictModePrefixUnaryExpression(node *ast.Node) { + // Grammar checking + if b.inStrictMode { + expr := node.AsPrefixUnaryExpression() + if expr.Operator == ast.KindPlusPlusToken || expr.Operator == ast.KindMinusMinusToken { + b.checkStrictModeEvalOrArguments(node, expr.Operand) + } + } +} + +func (b *Binder) checkStrictModeWithStatement(node *ast.Node) { + // Grammar checking for withStatement + if b.inStrictMode { + b.errorOnFirstToken(node, diagnostics.X_with_statements_are_not_allowed_in_strict_mode) + } +} + +func (b *Binder) checkStrictModeLabeledStatement(node *ast.Node) { + // Grammar checking for labeledStatement + if b.inStrictMode { + data := node.AsLabeledStatement() + if ast.IsDeclarationStatement(data.Statement) || ast.IsVariableStatement(data.Statement) { + b.errorOnFirstToken(data.Label, diagnostics.A_label_is_not_allowed_here) + } + } +} + +func isEvalOrArgumentsIdentifier(node *ast.Node) bool { + if ast.IsIdentifier(node) { + text := node.AsIdentifier().Text + return text == "eval" || text == "arguments" + } + return false +} + +func (b *Binder) checkStrictModeEvalOrArguments(contextNode *ast.Node, name *ast.Node) { + if name != nil && isEvalOrArgumentsIdentifier(name) { + // We check first if the name is inside class declaration or class expression; if so give explicit message + // otherwise report generic error message. + b.errorOnNode(name, b.getStrictModeEvalOrArgumentsMessage(contextNode), name.AsIdentifier().Text) + } +} + +func (b *Binder) getStrictModeEvalOrArgumentsMessage(node *ast.Node) *diagnostics.Message { + // Provide specialized messages to help the user understand why we think they're in strict mode + if ast.GetContainingClass(node) != nil { + return diagnostics.Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode + } + if b.file.ExternalModuleIndicator != nil { + return diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode + } + return diagnostics.Invalid_use_of_0_in_strict_mode +} + +// All container nodes are kept on a linked list in declaration order. This list is used by +// the getLocalNameOfContainer function in the type checker to validate that the local name +// used for a container is unique. +func (b *Binder) bindContainer(node *ast.Node, containerFlags ContainerFlags) { + // Before we recurse into a node's children, we first save the existing parent, container + // and block-container. Then after we pop out of processing the children, we restore + // these saved values. + saveContainer := b.container + saveThisContainer := b.thisContainer + savedBlockScopeContainer := b.blockScopeContainer + // Depending on what kind of node this is, we may have to adjust the current container + // and block-container. If the current node is a container, then it is automatically + // considered the current block-container as well. Also, for containers that we know + // may contain locals, we eagerly initialize the .locals field. We do this because + // it's highly likely that the .locals will be needed to place some child in (for example, + // a parameter, or variable declaration). + // + // However, we do not proactively create the .locals for block-containers because it's + // totally normal and common for block-containers to never actually have a block-scoped + // variable in them. We don't want to end up allocating an object for every 'block' we + // run into when most of them won't be necessary. + // + // Finally, if this is a block-container, then we clear out any existing .locals object + // it may contain within it. This happens in incremental scenarios. Because we can be + // reusing a node from a previous compilation, that node may have had 'locals' created + // for it. We must clear this so we don't accidentally move any stale data forward from + // a previous compilation. + if containerFlags&ContainerFlagsIsContainer != 0 { + b.container = node + b.blockScopeContainer = node + if containerFlags&ContainerFlagsHasLocals != 0 { + // localsContainer := node + // localsContainer.LocalsContainerData().locals = make(SymbolTable) + b.addToContainerChain(node) + } + } else if containerFlags&ContainerFlagsIsBlockScopedContainer != 0 { + b.blockScopeContainer = node + b.addToContainerChain(node) + } + if containerFlags&ContainerFlagsIsThisContainer != 0 { + b.thisContainer = node + } + if containerFlags&ContainerFlagsIsControlFlowContainer != 0 { + saveCurrentFlow := b.currentFlow + saveBreakTarget := b.currentBreakTarget + saveContinueTarget := b.currentContinueTarget + saveReturnTarget := b.currentReturnTarget + saveExceptionTarget := b.currentExceptionTarget + saveActiveLabelList := b.activeLabelList + saveHasExplicitReturn := b.hasExplicitReturn + isImmediatelyInvoked := (containerFlags&ContainerFlagsIsFunctionExpression != 0 && + !ast.HasSyntacticModifier(node, ast.ModifierFlagsAsync) && + !isGeneratorFunctionExpression(node) && + ast.GetImmediatelyInvokedFunctionExpression(node) != nil) || node.Kind == ast.KindClassStaticBlockDeclaration + // A non-async, non-generator IIFE is considered part of the containing control flow. Return statements behave + // similarly to break statements that exit to a label just past the statement body. + if !isImmediatelyInvoked { + flowStart := b.newFlowNode(ast.FlowFlagsStart) + b.currentFlow = flowStart + if containerFlags&(ContainerFlagsIsFunctionExpression|ContainerFlagsIsObjectLiteralOrClassExpressionMethodOrAccessor) != 0 { + flowStart.Node = node + } + } + // We create a return control flow graph for IIFEs and constructors. For constructors + // we use the return control flow graph in strict property initialization checks. + if isImmediatelyInvoked || node.Kind == ast.KindConstructor { + b.currentReturnTarget = b.newFlowNode(ast.FlowFlagsBranchLabel) + } else { + b.currentReturnTarget = nil + } + b.currentExceptionTarget = nil + b.currentBreakTarget = nil + b.currentContinueTarget = nil + b.activeLabelList = nil + b.hasExplicitReturn = false + b.bindChildren(node) + // Reset all reachability check related flags on node (for incremental scenarios) + node.Flags &= ^ast.NodeFlagsReachabilityCheckFlags + if b.currentFlow.Flags&ast.FlowFlagsUnreachable == 0 && containerFlags&ContainerFlagsIsFunctionLike != 0 { + bodyData := node.BodyData() + if bodyData != nil && ast.NodeIsPresent(bodyData.Body) { + node.Flags |= ast.NodeFlagsHasImplicitReturn + if b.hasExplicitReturn { + node.Flags |= ast.NodeFlagsHasExplicitReturn + } + bodyData.EndFlowNode = b.currentFlow + } + } + if node.Kind == ast.KindSourceFile { + node.Flags |= b.emitFlags + node.AsSourceFile().EndFlowNode = b.currentFlow + } + + if b.currentReturnTarget != nil { + b.addAntecedent(b.currentReturnTarget, b.currentFlow) + b.currentFlow = b.finishFlowLabel(b.currentReturnTarget) + if node.Kind == ast.KindConstructor || node.Kind == ast.KindClassStaticBlockDeclaration { + setReturnFlowNode(node, b.currentFlow) + } + } + if !isImmediatelyInvoked { + b.currentFlow = saveCurrentFlow + } + b.currentBreakTarget = saveBreakTarget + b.currentContinueTarget = saveContinueTarget + b.currentReturnTarget = saveReturnTarget + b.currentExceptionTarget = saveExceptionTarget + b.activeLabelList = saveActiveLabelList + b.hasExplicitReturn = saveHasExplicitReturn + } else if containerFlags&ContainerFlagsIsInterface != 0 { + b.seenThisKeyword = false + b.bindChildren(node) + // ContainsThis cannot overlap with HasExtendedUnicodeEscape on Identifier + if b.seenThisKeyword { + node.Flags |= ast.NodeFlagsContainsThis + } else { + node.Flags &= ^ast.NodeFlagsContainsThis + } + } else { + b.bindChildren(node) + } + b.container = saveContainer + b.thisContainer = saveThisContainer + b.blockScopeContainer = savedBlockScopeContainer +} + +func (b *Binder) bindChildren(node *ast.Node) { + saveInAssignmentPattern := b.inAssignmentPattern + // Most nodes aren't valid in an assignment pattern, so we clear the value here + // and set it before we descend into nodes that could actually be part of an assignment pattern. + b.inAssignmentPattern = false + if b.checkUnreachable(node) { + b.bindEachChild(node) + b.inAssignmentPattern = saveInAssignmentPattern + return + } + kind := node.Kind + if kind >= ast.KindFirstStatement && kind <= ast.KindLastStatement && (b.options().AllowUnreachableCode != core.TSTrue || kind == ast.KindReturnStatement) { + hasFlowNodeData := node.FlowNodeData() + if hasFlowNodeData != nil { + hasFlowNodeData.FlowNode = b.currentFlow + } + } + switch node.Kind { + case ast.KindWhileStatement: + b.bindWhileStatement(node) + case ast.KindDoStatement: + b.bindDoStatement(node) + case ast.KindForStatement: + b.bindForStatement(node) + case ast.KindForInStatement, ast.KindForOfStatement: + b.bindForInOrForOfStatement(node) + case ast.KindIfStatement: + b.bindIfStatement(node) + case ast.KindReturnStatement: + b.bindReturnStatement(node) + case ast.KindThrowStatement: + b.bindThrowStatement(node) + case ast.KindBreakStatement: + b.bindBreakStatement(node) + case ast.KindContinueStatement: + b.bindContinueStatement(node) + case ast.KindTryStatement: + b.bindTryStatement(node) + case ast.KindSwitchStatement: + b.bindSwitchStatement(node) + case ast.KindCaseBlock: + b.bindCaseBlock(node) + case ast.KindCaseClause, ast.KindDefaultClause: + b.bindCaseOrDefaultClause(node) + case ast.KindExpressionStatement: + b.bindExpressionStatement(node) + case ast.KindLabeledStatement: + b.bindLabeledStatement(node) + case ast.KindPrefixUnaryExpression: + b.bindPrefixUnaryExpressionFlow(node) + case ast.KindPostfixUnaryExpression: + b.bindPostfixUnaryExpressionFlow(node) + case ast.KindBinaryExpression: + if ast.IsDestructuringAssignment(node) { + // Carry over whether we are in an assignment pattern to + // binary expressions that could actually be an initializer + b.inAssignmentPattern = saveInAssignmentPattern + b.bindDestructuringAssignmentFlow(node) + return + } + b.bindBinaryExpressionFlow(node) + case ast.KindDeleteExpression: + b.bindDeleteExpressionFlow(node) + case ast.KindConditionalExpression: + b.bindConditionalExpressionFlow(node) + case ast.KindVariableDeclaration: + b.bindVariableDeclarationFlow(node) + case ast.KindPropertyAccessExpression, ast.KindElementAccessExpression: + b.bindAccessExpressionFlow(node) + case ast.KindCallExpression: + b.bindCallExpressionFlow(node) + case ast.KindNonNullExpression: + b.bindNonNullExpressionFlow(node) + case ast.KindSourceFile: + sourceFile := node.AsSourceFile() + b.bindEachStatementFunctionsFirst(sourceFile.Statements) + b.bind(sourceFile.EndOfFileToken) + case ast.KindBlock: + b.bindEachStatementFunctionsFirst(node.AsBlock().Statements) + case ast.KindModuleBlock: + b.bindEachStatementFunctionsFirst(node.AsModuleBlock().Statements) + case ast.KindBindingElement: + b.bindBindingElementFlow(node) + case ast.KindParameter: + b.bindParameterFlow(node) + case ast.KindObjectLiteralExpression, ast.KindArrayLiteralExpression, ast.KindPropertyAssignment, ast.KindSpreadElement: + b.inAssignmentPattern = saveInAssignmentPattern + b.bindEachChild(node) + default: + b.bindEachChild(node) + } + b.inAssignmentPattern = saveInAssignmentPattern +} + +func (b *Binder) bindEachChild(node *ast.Node) { + node.ForEachChild(b.bindFunc) +} + +func (b *Binder) bindEach(nodes []*ast.Node) { + for _, node := range nodes { + b.bind(node) + } +} + +func (b *Binder) bindNodeList(nodeList *ast.NodeList) { + if nodeList != nil { + b.bindEach(nodeList.Nodes) + } +} + +func (b *Binder) bindModifiers(modifiers *ast.ModifierList) { + if modifiers != nil { + b.bindEach(modifiers.Nodes) + } +} + +func (b *Binder) bindEachStatementFunctionsFirst(statements *ast.NodeList) { + for _, node := range statements.Nodes { + if node.Kind == ast.KindFunctionDeclaration { + b.bind(node) + } + } + for _, node := range statements.Nodes { + if node.Kind != ast.KindFunctionDeclaration { + b.bind(node) + } + } +} + +func (b *Binder) checkUnreachable(node *ast.Node) bool { + if b.currentFlow.Flags&ast.FlowFlagsUnreachable == 0 { + return false + } + if b.currentFlow == b.unreachableFlow { + // report errors on all statements except empty ones + // report errors on class declarations + // report errors on enums with preserved emit + // report errors on instantiated modules + reportError := ast.IsStatementButNotDeclaration(node) && !ast.IsEmptyStatement(node) || + ast.IsClassDeclaration(node) || + isEnumDeclarationWithPreservedEmit(node, b.options()) || + ast.IsModuleDeclaration(node) && b.shouldReportErrorOnModuleDeclaration(node) + if reportError { + b.currentFlow = b.reportedUnreachableFlow + if b.options().AllowUnreachableCode != core.TSTrue { + // unreachable code is reported if + // - user has explicitly asked about it AND + // - statement is in not ambient context (statements in ambient context is already an error + // so we should not report extras) AND + // - node is not variable statement OR + // - node is block scoped variable statement OR + // - node is not block scoped variable statement and at least one variable declaration has initializer + // Rationale: we don't want to report errors on non-initialized var's since they are hoisted + // On the other side we do want to report errors on non-initialized 'lets' because of TDZ + isError := unreachableCodeIsError(b.options()) && node.Flags&ast.NodeFlagsAmbient == 0 && (!ast.IsVariableStatement(node) || + ast.GetCombinedNodeFlags(node.AsVariableStatement().DeclarationList)&ast.NodeFlagsBlockScoped != 0 || + core.Some(node.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes, func(d *ast.Node) bool { + return d.AsVariableDeclaration().Initializer != nil + })) + b.errorOnEachUnreachableRange(node, isError) + } + } + } + return true +} + +func (b *Binder) shouldReportErrorOnModuleDeclaration(node *ast.Node) bool { + instanceState := ast.GetModuleInstanceState(node) + return instanceState == ast.ModuleInstanceStateInstantiated || (instanceState == ast.ModuleInstanceStateConstEnumOnly && b.options().ShouldPreserveConstEnums) +} + +func (b *Binder) errorOnEachUnreachableRange(node *ast.Node, isError bool) { + if b.isExecutableStatement(node) && ast.IsBlock(node.Parent) { + statements := node.Parent.AsBlock().Statements.Nodes + index := slices.Index(statements, node) + var first, last *ast.Node + for _, s := range statements[index:] { + if b.isExecutableStatement(s) { + if first == nil { + first = s + } + last = s + } else if first != nil { + b.errorOrSuggestionOnRange(isError, first, last, diagnostics.Unreachable_code_detected) + first = nil + } + } + if first != nil { + b.errorOrSuggestionOnRange(isError, first, last, diagnostics.Unreachable_code_detected) + } + } else { + b.errorOrSuggestionOnNode(isError, node, diagnostics.Unreachable_code_detected) + } +} + +// As opposed to a pure declaration like an `interface` +func (b *Binder) isExecutableStatement(s *ast.Node) bool { + // Don't remove statements that can validly be used before they appear. + return !ast.IsFunctionDeclaration(s) && !b.isPurelyTypeDeclaration(s) && !(ast.IsVariableStatement(s) && ast.GetCombinedNodeFlags(s)&ast.NodeFlagsBlockScoped == 0 && + core.Some(s.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes, func(d *ast.Node) bool { + return d.AsVariableDeclaration().Initializer == nil + })) +} + +func (b *Binder) isPurelyTypeDeclaration(s *ast.Node) bool { + switch s.Kind { + case ast.KindInterfaceDeclaration, ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration: + return true + case ast.KindModuleDeclaration: + return ast.GetModuleInstanceState(s) != ast.ModuleInstanceStateInstantiated + case ast.KindEnumDeclaration: + return !isEnumDeclarationWithPreservedEmit(s, b.options()) + default: + return false + } +} + +func (b *Binder) setContinueTarget(node *ast.Node, target *ast.FlowLabel) *ast.FlowLabel { + label := b.activeLabelList + for label != nil && node.Parent.Kind == ast.KindLabeledStatement { + label.continueTarget = target + label = label.next + node = node.Parent + } + return target +} + +func (b *Binder) doWithConditionalBranches(action func(b *Binder, value *ast.Node) bool, value *ast.Node, trueTarget *ast.FlowLabel, falseTarget *ast.FlowLabel) { + savedTrueTarget := b.currentTrueTarget + savedFalseTarget := b.currentFalseTarget + b.currentTrueTarget = trueTarget + b.currentFalseTarget = falseTarget + action(b, value) + b.currentTrueTarget = savedTrueTarget + b.currentFalseTarget = savedFalseTarget +} + +func (b *Binder) bindCondition(node *ast.Node, trueTarget *ast.FlowLabel, falseTarget *ast.FlowLabel) { + b.doWithConditionalBranches((*Binder).bind, node, trueTarget, falseTarget) + if node == nil || !isLogicalAssignmentExpression(node) && !ast.IsLogicalExpression(node) && !(ast.IsOptionalChain(node) && ast.IsOutermostOptionalChain(node)) { + b.addAntecedent(trueTarget, b.createFlowCondition(ast.FlowFlagsTrueCondition, b.currentFlow, node)) + b.addAntecedent(falseTarget, b.createFlowCondition(ast.FlowFlagsFalseCondition, b.currentFlow, node)) + } +} + +func (b *Binder) bindIterativeStatement(node *ast.Node, breakTarget *ast.FlowLabel, continueTarget *ast.FlowLabel) { + saveBreakTarget := b.currentBreakTarget + saveContinueTarget := b.currentContinueTarget + b.currentBreakTarget = breakTarget + b.currentContinueTarget = continueTarget + b.bind(node) + b.currentBreakTarget = saveBreakTarget + b.currentContinueTarget = saveContinueTarget +} + +func isLogicalAssignmentExpression(node *ast.Node) bool { + return ast.IsLogicalOrCoalescingAssignmentExpression(ast.SkipParentheses(node)) +} + +func (b *Binder) bindAssignmentTargetFlow(node *ast.Node) { + switch node.Kind { + case ast.KindArrayLiteralExpression: + for _, e := range node.AsArrayLiteralExpression().Elements.Nodes { + if e.Kind == ast.KindSpreadElement { + b.bindAssignmentTargetFlow(e.AsSpreadElement().Expression) + } else { + b.bindDestructuringTargetFlow(e) + } + } + case ast.KindObjectLiteralExpression: + for _, p := range node.AsObjectLiteralExpression().Properties.Nodes { + switch p.Kind { + case ast.KindPropertyAssignment: + b.bindDestructuringTargetFlow(p.AsPropertyAssignment().Initializer) + case ast.KindShorthandPropertyAssignment: + b.bindAssignmentTargetFlow(p.AsShorthandPropertyAssignment().Name()) + case ast.KindSpreadAssignment: + b.bindAssignmentTargetFlow(p.AsSpreadAssignment().Expression) + } + } + default: + if isNarrowableReference(node) { + b.currentFlow = b.createFlowMutation(ast.FlowFlagsAssignment, b.currentFlow, node) + } + } +} + +func (b *Binder) bindDestructuringTargetFlow(node *ast.Node) { + if ast.IsBinaryExpression(node) && node.AsBinaryExpression().OperatorToken.Kind == ast.KindEqualsToken { + b.bindAssignmentTargetFlow(node.AsBinaryExpression().Left) + } else { + b.bindAssignmentTargetFlow(node) + } +} + +func (b *Binder) bindWhileStatement(node *ast.Node) { + stmt := node.AsWhileStatement() + preWhileLabel := b.setContinueTarget(node, b.createLoopLabel()) + preBodyLabel := b.createBranchLabel() + postWhileLabel := b.createBranchLabel() + b.addAntecedent(preWhileLabel, b.currentFlow) + b.currentFlow = preWhileLabel + b.bindCondition(stmt.Expression, preBodyLabel, postWhileLabel) + b.currentFlow = b.finishFlowLabel(preBodyLabel) + b.bindIterativeStatement(stmt.Statement, postWhileLabel, preWhileLabel) + b.addAntecedent(preWhileLabel, b.currentFlow) + b.currentFlow = b.finishFlowLabel(postWhileLabel) +} + +func (b *Binder) bindDoStatement(node *ast.Node) { + stmt := node.AsDoStatement() + preDoLabel := b.createLoopLabel() + preConditionLabel := b.setContinueTarget(node, b.createBranchLabel()) + postDoLabel := b.createBranchLabel() + b.addAntecedent(preDoLabel, b.currentFlow) + b.currentFlow = preDoLabel + b.bindIterativeStatement(stmt.Statement, postDoLabel, preConditionLabel) + b.addAntecedent(preConditionLabel, b.currentFlow) + b.currentFlow = b.finishFlowLabel(preConditionLabel) + b.bindCondition(stmt.Expression, preDoLabel, postDoLabel) + b.currentFlow = b.finishFlowLabel(postDoLabel) +} + +func (b *Binder) bindForStatement(node *ast.Node) { + stmt := node.AsForStatement() + preLoopLabel := b.setContinueTarget(node, b.createLoopLabel()) + preBodyLabel := b.createBranchLabel() + preIncrementorLabel := b.createBranchLabel() + postLoopLabel := b.createBranchLabel() + b.bind(stmt.Initializer) + b.addAntecedent(preLoopLabel, b.currentFlow) + b.currentFlow = preLoopLabel + b.bindCondition(stmt.Condition, preBodyLabel, postLoopLabel) + b.currentFlow = b.finishFlowLabel(preBodyLabel) + b.bindIterativeStatement(stmt.Statement, postLoopLabel, preIncrementorLabel) + b.addAntecedent(preIncrementorLabel, b.currentFlow) + b.currentFlow = b.finishFlowLabel(preIncrementorLabel) + b.bind(stmt.Incrementor) + b.addAntecedent(preLoopLabel, b.currentFlow) + b.currentFlow = b.finishFlowLabel(postLoopLabel) +} + +func (b *Binder) bindForInOrForOfStatement(node *ast.Node) { + stmt := node.AsForInOrOfStatement() + preLoopLabel := b.setContinueTarget(node, b.createLoopLabel()) + postLoopLabel := b.createBranchLabel() + b.bind(stmt.Expression) + b.addAntecedent(preLoopLabel, b.currentFlow) + b.currentFlow = preLoopLabel + if node.Kind == ast.KindForOfStatement { + b.bind(stmt.AwaitModifier) + } + b.addAntecedent(postLoopLabel, b.currentFlow) + b.bind(stmt.Initializer) + if stmt.Initializer.Kind != ast.KindVariableDeclarationList { + b.bindAssignmentTargetFlow(stmt.Initializer) + } + b.bindIterativeStatement(stmt.Statement, postLoopLabel, preLoopLabel) + b.addAntecedent(preLoopLabel, b.currentFlow) + b.currentFlow = b.finishFlowLabel(postLoopLabel) +} + +func (b *Binder) bindIfStatement(node *ast.Node) { + stmt := node.AsIfStatement() + thenLabel := b.createBranchLabel() + elseLabel := b.createBranchLabel() + postIfLabel := b.createBranchLabel() + b.bindCondition(stmt.Expression, thenLabel, elseLabel) + b.currentFlow = b.finishFlowLabel(thenLabel) + b.bind(stmt.ThenStatement) + b.addAntecedent(postIfLabel, b.currentFlow) + b.currentFlow = b.finishFlowLabel(elseLabel) + b.bind(stmt.ElseStatement) + b.addAntecedent(postIfLabel, b.currentFlow) + b.currentFlow = b.finishFlowLabel(postIfLabel) +} + +func (b *Binder) bindReturnStatement(node *ast.Node) { + b.bind(node.AsReturnStatement().Expression) + if b.currentReturnTarget != nil { + b.addAntecedent(b.currentReturnTarget, b.currentFlow) + } + b.currentFlow = b.unreachableFlow + b.hasExplicitReturn = true + b.hasFlowEffects = true +} + +func (b *Binder) bindThrowStatement(node *ast.Node) { + b.bind(node.AsThrowStatement().Expression) + b.currentFlow = b.unreachableFlow + b.hasFlowEffects = true +} + +func (b *Binder) bindBreakStatement(node *ast.Node) { + b.bindBreakOrContinueStatement(node.AsBreakStatement().Label, b.currentBreakTarget, (*ActiveLabel).BreakTarget) +} + +func (b *Binder) bindContinueStatement(node *ast.Node) { + b.bindBreakOrContinueStatement(node.AsContinueStatement().Label, b.currentContinueTarget, (*ActiveLabel).ContinueTarget) +} + +func (b *Binder) bindBreakOrContinueStatement(label *ast.Node, currentTarget *ast.FlowNode, getTarget func(*ActiveLabel) *ast.FlowNode) { + b.bind(label) + if label != nil { + activeLabel := b.findActiveLabel(label.AsIdentifier().Text) + if activeLabel != nil { + activeLabel.referenced = true + b.bindBreakOrContinueFlow(getTarget(activeLabel)) + } + } else { + b.bindBreakOrContinueFlow(currentTarget) + } +} + +func (b *Binder) findActiveLabel(name string) *ActiveLabel { + for label := b.activeLabelList; label != nil; label = label.next { + if label.name == name { + return label + } + } + return nil +} + +func (b *Binder) bindBreakOrContinueFlow(flowLabel *ast.FlowLabel) { + if flowLabel != nil { + b.addAntecedent(flowLabel, b.currentFlow) + b.currentFlow = b.unreachableFlow + b.hasFlowEffects = true + } +} + +func (b *Binder) bindTryStatement(node *ast.Node) { + // We conservatively assume that *any* code in the try block can cause an exception, but we only need + // to track code that causes mutations (because only mutations widen the possible control flow type of + // a variable). The exceptionLabel is the target label for control flows that result from exceptions. + // We add all mutation flow nodes as antecedents of this label such that we can analyze them as possible + // antecedents of the start of catch or finally blocks. Furthermore, we add the current control flow to + // represent exceptions that occur before any mutations. + stmt := node.AsTryStatement() + saveReturnTarget := b.currentReturnTarget + saveExceptionTarget := b.currentExceptionTarget + normalExitLabel := b.createBranchLabel() + returnLabel := b.createBranchLabel() + exceptionLabel := b.createBranchLabel() + if stmt.FinallyBlock != nil { + b.currentReturnTarget = returnLabel + } + b.addAntecedent(exceptionLabel, b.currentFlow) + b.currentExceptionTarget = exceptionLabel + b.bind(stmt.TryBlock) + b.addAntecedent(normalExitLabel, b.currentFlow) + if stmt.CatchClause != nil { + // Start of catch clause is the target of exceptions from try block. + b.currentFlow = b.finishFlowLabel(exceptionLabel) + // The currentExceptionTarget now represents control flows from exceptions in the catch clause. + // Effectively, in a try-catch-finally, if an exception occurs in the try block, the catch block + // acts like a second try block. + exceptionLabel = b.createBranchLabel() + b.addAntecedent(exceptionLabel, b.currentFlow) + b.currentExceptionTarget = exceptionLabel + b.bind(stmt.CatchClause) + b.addAntecedent(normalExitLabel, b.currentFlow) + } + b.currentReturnTarget = saveReturnTarget + b.currentExceptionTarget = saveExceptionTarget + if stmt.FinallyBlock != nil { + // Possible ways control can reach the finally block: + // 1) Normal completion of try block of a try-finally or try-catch-finally + // 2) Normal completion of catch block (following exception in try block) of a try-catch-finally + // 3) Return in try or catch block of a try-finally or try-catch-finally + // 4) Exception in try block of a try-finally + // 5) Exception in catch block of a try-catch-finally + // When analyzing a control flow graph that starts inside a finally block we want to consider all + // five possibilities above. However, when analyzing a control flow graph that starts outside (past) + // the finally block, we only want to consider the first two (if we're past a finally block then it + // must have completed normally). Likewise, when analyzing a control flow graph from return statements + // in try or catch blocks in an IIFE, we only want to consider the third. To make this possible, we + // inject a ReduceLabel node into the control flow graph. This node contains an alternate reduced + // set of antecedents for the pre-finally label. As control flow analysis passes by a ReduceLabel + // node, the pre-finally label is temporarily switched to the reduced antecedent set. + finallyLabel := b.createBranchLabel() + finallyLabel.Antecedents = b.combineFlowLists(normalExitLabel.Antecedents, b.combineFlowLists(exceptionLabel.Antecedents, returnLabel.Antecedents)) + b.currentFlow = finallyLabel + b.bind(stmt.FinallyBlock) + if b.currentFlow.Flags&ast.FlowFlagsUnreachable != 0 { + // If the end of the finally block is unreachable, the end of the entire try statement is unreachable. + b.currentFlow = b.unreachableFlow + } else { + // If we have an IIFE return target and return statements in the try or catch blocks, add a control + // flow that goes back through the finally block and back through only the return statements. + if b.currentReturnTarget != nil && returnLabel.Antecedents != nil { + b.addAntecedent(b.currentReturnTarget, b.createReduceLabel(finallyLabel, returnLabel.Antecedents, b.currentFlow)) + } + // If we have an outer exception target (i.e. a containing try-finally or try-catch-finally), add a + // control flow that goes back through the finally block and back through each possible exception source. + if b.currentExceptionTarget != nil && exceptionLabel.Antecedents != nil { + b.addAntecedent(b.currentExceptionTarget, b.createReduceLabel(finallyLabel, exceptionLabel.Antecedents, b.currentFlow)) + } + // If the end of the finally block is reachable, but the end of the try and catch blocks are not, + // convert the current flow to unreachable. For example, 'try { return 1; } finally { ... }' should + // result in an unreachable current control flow. + if normalExitLabel.Antecedents != nil { + b.currentFlow = b.createReduceLabel(finallyLabel, normalExitLabel.Antecedents, b.currentFlow) + } else { + b.currentFlow = b.unreachableFlow + } + } + } else { + b.currentFlow = b.finishFlowLabel(normalExitLabel) + } +} + +func (b *Binder) bindSwitchStatement(node *ast.Node) { + stmt := node.AsSwitchStatement() + postSwitchLabel := b.createBranchLabel() + b.bind(stmt.Expression) + saveBreakTarget := b.currentBreakTarget + savePreSwitchCaseFlow := b.preSwitchCaseFlow + b.currentBreakTarget = postSwitchLabel + b.preSwitchCaseFlow = b.currentFlow + b.bind(stmt.CaseBlock) + b.addAntecedent(postSwitchLabel, b.currentFlow) + hasDefault := core.Some(stmt.CaseBlock.AsCaseBlock().Clauses.Nodes, func(c *ast.Node) bool { + return c.Kind == ast.KindDefaultClause + }) + if !hasDefault { + b.addAntecedent(postSwitchLabel, b.createFlowSwitchClause(b.preSwitchCaseFlow, node, 0, 0)) + } + b.currentBreakTarget = saveBreakTarget + b.preSwitchCaseFlow = savePreSwitchCaseFlow + b.currentFlow = b.finishFlowLabel(postSwitchLabel) +} + +func (b *Binder) bindCaseBlock(node *ast.Node) { + switchStatement := node.Parent + clauses := node.AsCaseBlock().Clauses.Nodes + isNarrowingSwitch := switchStatement.Expression().Kind == ast.KindTrueKeyword || isNarrowingExpression(switchStatement.Expression()) + var fallthroughFlow *ast.FlowNode = b.unreachableFlow + for i := 0; i < len(clauses); i++ { + clauseStart := i + for len(clauses[i].AsCaseOrDefaultClause().Statements.Nodes) == 0 && i+1 < len(clauses) { + if fallthroughFlow == b.unreachableFlow { + b.currentFlow = b.preSwitchCaseFlow + } + b.bind(clauses[i]) + i++ + } + preCaseLabel := b.createBranchLabel() + preCaseFlow := b.preSwitchCaseFlow + if isNarrowingSwitch { + preCaseFlow = b.createFlowSwitchClause(b.preSwitchCaseFlow, switchStatement, clauseStart, i+1) + } + b.addAntecedent(preCaseLabel, preCaseFlow) + b.addAntecedent(preCaseLabel, fallthroughFlow) + b.currentFlow = b.finishFlowLabel(preCaseLabel) + clause := clauses[i] + b.bind(clause) + fallthroughFlow = b.currentFlow + if b.currentFlow.Flags&ast.FlowFlagsUnreachable == 0 && i != len(clauses)-1 { + clause.AsCaseOrDefaultClause().FallthroughFlowNode = b.currentFlow + } + } +} + +func (b *Binder) bindCaseOrDefaultClause(node *ast.Node) { + clause := node.AsCaseOrDefaultClause() + if clause.Expression != nil { + saveCurrentFlow := b.currentFlow + b.currentFlow = b.preSwitchCaseFlow + b.bind(clause.Expression) + b.currentFlow = saveCurrentFlow + } + b.bindEach(clause.Statements.Nodes) +} + +func (b *Binder) bindExpressionStatement(node *ast.Node) { + stmt := node.AsExpressionStatement() + b.bind(stmt.Expression) + b.maybeBindExpressionFlowIfCall(stmt.Expression) +} + +func (b *Binder) maybeBindExpressionFlowIfCall(node *ast.Node) { + // A top level or comma expression call expression with a dotted function name and at least one argument + // is potentially an assertion and is therefore included in the control flow. + if ast.IsCallExpression(node) { + if node.Expression().Kind != ast.KindSuperKeyword && ast.IsDottedName(node.Expression()) { + b.currentFlow = b.createFlowCall(b.currentFlow, node) + } + } +} + +func (b *Binder) bindLabeledStatement(node *ast.Node) { + stmt := node.AsLabeledStatement() + postStatementLabel := b.createBranchLabel() + b.activeLabelList = &ActiveLabel{ + next: b.activeLabelList, + name: stmt.Label.AsIdentifier().Text, + breakTarget: postStatementLabel, + continueTarget: nil, + referenced: false, + } + b.bind(stmt.Label) + b.bind(stmt.Statement) + if !b.activeLabelList.referenced && b.options().AllowUnusedLabels != core.TSTrue { + b.errorOrSuggestionOnNode(unusedLabelIsError(b.options()), stmt.Label, diagnostics.Unused_label) + } + b.activeLabelList = b.activeLabelList.next + b.addAntecedent(postStatementLabel, b.currentFlow) + b.currentFlow = b.finishFlowLabel(postStatementLabel) +} + +func (b *Binder) bindPrefixUnaryExpressionFlow(node *ast.Node) { + expr := node.AsPrefixUnaryExpression() + if expr.Operator == ast.KindExclamationToken { + saveTrueTarget := b.currentTrueTarget + b.currentTrueTarget = b.currentFalseTarget + b.currentFalseTarget = saveTrueTarget + b.bindEachChild(node) + b.currentFalseTarget = b.currentTrueTarget + b.currentTrueTarget = saveTrueTarget + } else { + b.bindEachChild(node) + if expr.Operator == ast.KindPlusPlusToken || expr.Operator == ast.KindMinusMinusToken { + b.bindAssignmentTargetFlow(expr.Operand) + } + } +} + +func (b *Binder) bindPostfixUnaryExpressionFlow(node *ast.Node) { + expr := node.AsPostfixUnaryExpression() + b.bindEachChild(node) + if expr.Operator == ast.KindPlusPlusToken || expr.Operator == ast.KindMinusMinusToken { + b.bindAssignmentTargetFlow(expr.Operand) + } +} + +func (b *Binder) bindDestructuringAssignmentFlow(node *ast.Node) { + expr := node.AsBinaryExpression() + if b.inAssignmentPattern { + b.inAssignmentPattern = false + b.bind(expr.OperatorToken) + b.bind(expr.Right) + b.inAssignmentPattern = true + b.bind(expr.Left) + b.bind(expr.Type) + } else { + b.inAssignmentPattern = true + b.bind(expr.Left) + b.bind(expr.Type) + b.inAssignmentPattern = false + b.bind(expr.OperatorToken) + b.bind(expr.Right) + } + b.bindAssignmentTargetFlow(expr.Left) +} + +func (b *Binder) bindBinaryExpressionFlow(node *ast.Node) { + expr := node.AsBinaryExpression() + operator := expr.OperatorToken.Kind + if ast.IsLogicalOrCoalescingBinaryOperator(operator) || ast.IsLogicalOrCoalescingAssignmentOperator(operator) { + if isTopLevelLogicalExpression(node) { + postExpressionLabel := b.createBranchLabel() + saveCurrentFlow := b.currentFlow + saveHasFlowEffects := b.hasFlowEffects + b.hasFlowEffects = false + b.bindLogicalLikeExpression(node, postExpressionLabel, postExpressionLabel) + if b.hasFlowEffects { + b.currentFlow = b.finishFlowLabel(postExpressionLabel) + } else { + b.currentFlow = saveCurrentFlow + } + b.hasFlowEffects = b.hasFlowEffects || saveHasFlowEffects + } else { + b.bindLogicalLikeExpression(node, b.currentTrueTarget, b.currentFalseTarget) + } + } else { + b.bind(expr.Left) + b.bind(expr.Type) + if operator == ast.KindCommaToken { + b.maybeBindExpressionFlowIfCall(expr.Left) + } + b.bind(expr.OperatorToken) + b.bind(expr.Right) + if operator == ast.KindCommaToken { + b.maybeBindExpressionFlowIfCall(expr.Right) + } + if ast.IsAssignmentOperator(operator) && !ast.IsAssignmentTarget(node) { + b.bindAssignmentTargetFlow(expr.Left) + if operator == ast.KindEqualsToken && expr.Left.Kind == ast.KindElementAccessExpression { + elementAccess := expr.Left.AsElementAccessExpression() + if isNarrowableOperand(elementAccess.Expression) { + b.currentFlow = b.createFlowMutation(ast.FlowFlagsArrayMutation, b.currentFlow, node) + } + } + } + } +} + +func (b *Binder) bindLogicalLikeExpression(node *ast.Node, trueTarget *ast.FlowLabel, falseTarget *ast.FlowLabel) { + expr := node.AsBinaryExpression() + preRightLabel := b.createBranchLabel() + if expr.OperatorToken.Kind == ast.KindAmpersandAmpersandToken || expr.OperatorToken.Kind == ast.KindAmpersandAmpersandEqualsToken { + b.bindCondition(expr.Left, preRightLabel, falseTarget) + } else { + b.bindCondition(expr.Left, trueTarget, preRightLabel) + } + b.currentFlow = b.finishFlowLabel(preRightLabel) + b.bind(expr.OperatorToken) + if ast.IsLogicalOrCoalescingAssignmentOperator(expr.OperatorToken.Kind) { + b.doWithConditionalBranches((*Binder).bind, expr.Right, trueTarget, falseTarget) + b.bindAssignmentTargetFlow(expr.Left) + b.addAntecedent(trueTarget, b.createFlowCondition(ast.FlowFlagsTrueCondition, b.currentFlow, node)) + b.addAntecedent(falseTarget, b.createFlowCondition(ast.FlowFlagsFalseCondition, b.currentFlow, node)) + } else { + b.bindCondition(expr.Right, trueTarget, falseTarget) + } +} + +func (b *Binder) bindDeleteExpressionFlow(node *ast.Node) { + expr := node.AsDeleteExpression() + b.bindEachChild(node) + if expr.Expression.Kind == ast.KindPropertyAccessExpression { + b.bindAssignmentTargetFlow(expr.Expression) + } +} + +func (b *Binder) bindConditionalExpressionFlow(node *ast.Node) { + expr := node.AsConditionalExpression() + trueLabel := b.createBranchLabel() + falseLabel := b.createBranchLabel() + postExpressionLabel := b.createBranchLabel() + saveCurrentFlow := b.currentFlow + saveHasFlowEffects := b.hasFlowEffects + b.hasFlowEffects = false + b.bindCondition(expr.Condition, trueLabel, falseLabel) + b.currentFlow = b.finishFlowLabel(trueLabel) + b.bind(expr.QuestionToken) + b.bind(expr.WhenTrue) + b.addAntecedent(postExpressionLabel, b.currentFlow) + b.currentFlow = b.finishFlowLabel(falseLabel) + b.bind(expr.ColonToken) + b.bind(expr.WhenFalse) + b.addAntecedent(postExpressionLabel, b.currentFlow) + if b.hasFlowEffects { + b.currentFlow = b.finishFlowLabel(postExpressionLabel) + } else { + b.currentFlow = saveCurrentFlow + } + b.hasFlowEffects = b.hasFlowEffects || saveHasFlowEffects +} + +func (b *Binder) bindVariableDeclarationFlow(node *ast.Node) { + b.bindEachChild(node) + if node.AsVariableDeclaration().Initializer != nil || ast.IsForInOrOfStatement(node.Parent.Parent) { + b.bindInitializedVariableFlow(node) + } +} + +func (b *Binder) bindInitializedVariableFlow(node *ast.Node) { + var name *ast.Node + switch node.Kind { + case ast.KindVariableDeclaration: + name = node.AsVariableDeclaration().Name() + case ast.KindBindingElement: + name = node.AsBindingElement().Name() + } + if name != nil && ast.IsBindingPattern(name) { + for _, child := range name.AsBindingPattern().Elements.Nodes { + b.bindInitializedVariableFlow(child) + } + } else { + b.currentFlow = b.createFlowMutation(ast.FlowFlagsAssignment, b.currentFlow, node) + } +} + +func (b *Binder) bindAccessExpressionFlow(node *ast.Node) { + if ast.IsOptionalChain(node) { + b.bindOptionalChainFlow(node) + } else { + b.bindEachChild(node) + } +} + +func (b *Binder) bindOptionalChainFlow(node *ast.Node) { + if isTopLevelLogicalExpression(node) { + postExpressionLabel := b.createBranchLabel() + saveCurrentFlow := b.currentFlow + saveHasFlowEffects := b.hasFlowEffects + b.bindOptionalChain(node, postExpressionLabel, postExpressionLabel) + if b.hasFlowEffects { + b.currentFlow = b.finishFlowLabel(postExpressionLabel) + } else { + b.currentFlow = saveCurrentFlow + } + b.hasFlowEffects = b.hasFlowEffects || saveHasFlowEffects + } else { + b.bindOptionalChain(node, b.currentTrueTarget, b.currentFalseTarget) + } +} + +func (b *Binder) bindOptionalChain(node *ast.Node, trueTarget *ast.FlowLabel, falseTarget *ast.FlowLabel) { + // For an optional chain, we emulate the behavior of a logical expression: + // + // a?.b -> a && a.b + // a?.b.c -> a && a.b.c + // a?.b?.c -> a && a.b && a.b.c + // a?.[x = 1] -> a && a[x = 1] + // + // To do this we descend through the chain until we reach the root of a chain (the expression with a `?.`) + // and build it's CFA graph as if it were the first condition (`a && ...`). Then we bind the rest + // of the node as part of the "true" branch, and continue to do so as we ascend back up to the outermost + // chain node. We then treat the entire node as the right side of the expression. + var preChainLabel *ast.FlowLabel + if ast.IsOptionalChainRoot(node) { + preChainLabel = b.createBranchLabel() + } + b.bindOptionalExpression(node.Expression(), core.IfElse(preChainLabel != nil, preChainLabel, trueTarget), falseTarget) + if preChainLabel != nil { + b.currentFlow = b.finishFlowLabel(preChainLabel) + } + b.doWithConditionalBranches((*Binder).bindOptionalChainRest, node, trueTarget, falseTarget) + if ast.IsOutermostOptionalChain(node) { + b.addAntecedent(trueTarget, b.createFlowCondition(ast.FlowFlagsTrueCondition, b.currentFlow, node)) + b.addAntecedent(falseTarget, b.createFlowCondition(ast.FlowFlagsFalseCondition, b.currentFlow, node)) + } +} + +func (b *Binder) bindOptionalExpression(node *ast.Node, trueTarget *ast.FlowLabel, falseTarget *ast.FlowLabel) { + b.doWithConditionalBranches((*Binder).bind, node, trueTarget, falseTarget) + if !ast.IsOptionalChain(node) || ast.IsOutermostOptionalChain(node) { + b.addAntecedent(trueTarget, b.createFlowCondition(ast.FlowFlagsTrueCondition, b.currentFlow, node)) + b.addAntecedent(falseTarget, b.createFlowCondition(ast.FlowFlagsFalseCondition, b.currentFlow, node)) + } +} + +func (b *Binder) bindOptionalChainRest(node *ast.Node) bool { + switch node.Kind { + case ast.KindPropertyAccessExpression: + b.bind(node.AsPropertyAccessExpression().QuestionDotToken) + b.bind(node.AsPropertyAccessExpression().Name()) + case ast.KindElementAccessExpression: + b.bind(node.AsElementAccessExpression().QuestionDotToken) + b.bind(node.AsElementAccessExpression().ArgumentExpression) + case ast.KindCallExpression: + b.bind(node.AsCallExpression().QuestionDotToken) + b.bindNodeList(node.AsCallExpression().TypeArguments) + b.bindEach(node.AsCallExpression().Arguments.Nodes) + } + return false +} + +func (b *Binder) bindCallExpressionFlow(node *ast.Node) { + call := node.AsCallExpression() + if ast.IsOptionalChain(node) { + b.bindOptionalChainFlow(node) + } else { + // If the target of the call expression is a function expression or arrow function we have + // an immediately invoked function expression (IIFE). Initialize the flowNode property to + // the current control flow (which includes evaluation of the IIFE arguments). + expr := ast.SkipParentheses(call.Expression) + if expr.Kind == ast.KindFunctionExpression || expr.Kind == ast.KindArrowFunction { + b.bindNodeList(call.TypeArguments) + b.bindEach(call.Arguments.Nodes) + b.bind(call.Expression) + } else { + b.bindEachChild(node) + if call.Expression.Kind == ast.KindSuperKeyword { + b.currentFlow = b.createFlowCall(b.currentFlow, node) + } + } + } + if ast.IsPropertyAccessExpression(call.Expression) { + access := call.Expression.AsPropertyAccessExpression() + if ast.IsIdentifier(access.Name()) && isNarrowableOperand(access.Expression) && ast.IsPushOrUnshiftIdentifier(access.Name()) { + b.currentFlow = b.createFlowMutation(ast.FlowFlagsArrayMutation, b.currentFlow, node) + } + } +} + +func (b *Binder) bindNonNullExpressionFlow(node *ast.Node) { + if ast.IsOptionalChain(node) { + b.bindOptionalChainFlow(node) + } else { + b.bindEachChild(node) + } +} + +func (b *Binder) bindBindingElementFlow(node *ast.Node) { + // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: + // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + elem := node.AsBindingElement() + b.bind(elem.DotDotDotToken) + b.bind(elem.PropertyName) + b.bindInitializer(elem.Initializer) + b.bind(elem.Name()) +} + +func (b *Binder) bindParameterFlow(node *ast.Node) { + param := node.AsParameterDeclaration() + b.bindModifiers(param.Modifiers()) + b.bind(param.DotDotDotToken) + b.bind(param.QuestionToken) + b.bind(param.Type) + b.bindInitializer(param.Initializer) + b.bind(param.Name()) +} + +// a BindingElement/Parameter does not have side effects if initializers are not evaluated and used. (see GH#49759) +func (b *Binder) bindInitializer(node *ast.Node) { + if node == nil { + return + } + entryFlow := b.currentFlow + b.bind(node) + if entryFlow == b.unreachableFlow || entryFlow == b.currentFlow { + return + } + exitFlow := b.createBranchLabel() + b.addAntecedent(exitFlow, entryFlow) + b.addAntecedent(exitFlow, b.currentFlow) + b.currentFlow = b.finishFlowLabel(exitFlow) +} + +func isEnumDeclarationWithPreservedEmit(node *ast.Node, options core.SourceFileAffectingCompilerOptions) bool { + return node.Kind == ast.KindEnumDeclaration && (!ast.IsEnumConst(node) || options.ShouldPreserveConstEnums) +} + +func setFlowNode(node *ast.Node, flowNode *ast.FlowNode) { + data := node.FlowNodeData() + if data != nil { + data.FlowNode = flowNode + } +} + +func setReturnFlowNode(node *ast.Node, returnFlowNode *ast.FlowNode) { + switch node.Kind { + case ast.KindConstructor: + node.AsConstructorDeclaration().ReturnFlowNode = returnFlowNode + case ast.KindFunctionDeclaration: + node.AsFunctionDeclaration().ReturnFlowNode = returnFlowNode + case ast.KindFunctionExpression: + node.AsFunctionExpression().ReturnFlowNode = returnFlowNode + case ast.KindClassStaticBlockDeclaration: + node.AsClassStaticBlockDeclaration().ReturnFlowNode = returnFlowNode + } +} + +func isGeneratorFunctionExpression(node *ast.Node) bool { + return ast.IsFunctionExpression(node) && node.AsFunctionExpression().AsteriskToken != nil +} + +func (b *Binder) addToContainerChain(next *ast.Node) { + if b.lastContainer != nil { + b.lastContainer.LocalsContainerData().NextContainer = next + } + b.lastContainer = next +} + +func (b *Binder) addDeclarationToSymbol(symbol *ast.Symbol, node *ast.Node, symbolFlags ast.SymbolFlags) { + symbol.Flags |= symbolFlags + node.DeclarationData().Symbol = symbol + if symbol.Declarations == nil { + symbol.Declarations = b.newSingleDeclaration(node) + } else { + symbol.Declarations = core.AppendIfUnique(symbol.Declarations, node) + } + // On merge of const enum module with class or function, reset const enum only flag (namespaces will already recalculate) + if symbol.Flags&ast.SymbolFlagsConstEnumOnlyModule != 0 && symbol.Flags&(ast.SymbolFlagsFunction|ast.SymbolFlagsClass|ast.SymbolFlagsRegularEnum) != 0 { + symbol.Flags &^= ast.SymbolFlagsConstEnumOnlyModule + } + if symbolFlags&ast.SymbolFlagsValue != 0 { + SetValueDeclaration(symbol, node) + } +} + +func SetValueDeclaration(symbol *ast.Symbol, node *ast.Node) { + valueDeclaration := symbol.ValueDeclaration + if valueDeclaration == nil || + isAssignmentDeclaration(valueDeclaration) && !isAssignmentDeclaration(node) || + valueDeclaration.Kind != node.Kind && isEffectiveModuleDeclaration(valueDeclaration) { + // Non-assignment declarations take precedence over assignment declarations and + // non-namespace declarations take precedence over namespace declarations. + symbol.ValueDeclaration = node + } +} + +/** + * Declares a Symbol for the node and adds it to symbols. Reports errors for conflicting identifier names. + * @param symbolTable - The symbol table which node will be added to. + * @param parent - node's parent declaration. + * @param node - The declaration to be added to the symbol table + * @param includes - The SymbolFlags that node has in addition to its declaration type (eg: export, ambient, etc.) + * @param excludes - The flags which node cannot be declared alongside in a symbol table. Used to report forbidden declarations. + */ + +func GetContainerFlags(node *ast.Node) ContainerFlags { + switch node.Kind { + case ast.KindClassExpression, ast.KindClassDeclaration, ast.KindEnumDeclaration, ast.KindObjectLiteralExpression, ast.KindTypeLiteral, + ast.KindJsxAttributes: + return ContainerFlagsIsContainer + case ast.KindInterfaceDeclaration: + return ContainerFlagsIsContainer | ContainerFlagsIsInterface + case ast.KindModuleDeclaration, ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration, ast.KindMappedType, ast.KindIndexSignature: + return ContainerFlagsIsContainer | ContainerFlagsHasLocals + case ast.KindSourceFile: + return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals + case ast.KindGetAccessor, ast.KindSetAccessor, ast.KindMethodDeclaration: + if ast.IsObjectLiteralOrClassExpressionMethodOrAccessor(node) { + return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike | ContainerFlagsIsObjectLiteralOrClassExpressionMethodOrAccessor | ContainerFlagsIsThisContainer + } + fallthrough + case ast.KindConstructor, ast.KindClassStaticBlockDeclaration: + return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike | ContainerFlagsIsThisContainer + case ast.KindMethodSignature, ast.KindCallSignature, ast.KindFunctionType, ast.KindConstructSignature, ast.KindConstructorType: + return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike + case ast.KindFunctionDeclaration: + return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike | ContainerFlagsIsThisContainer + case ast.KindFunctionExpression: + return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike | ContainerFlagsIsFunctionExpression | ContainerFlagsIsThisContainer + case ast.KindArrowFunction: + return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike | ContainerFlagsIsFunctionExpression + case ast.KindModuleBlock: + return ContainerFlagsIsControlFlowContainer + case ast.KindPropertyDeclaration: + if node.AsPropertyDeclaration().Initializer != nil { + return ContainerFlagsIsControlFlowContainer | ContainerFlagsIsThisContainer + } else { + return ContainerFlagsNone + } + case ast.KindCatchClause, ast.KindForStatement, ast.KindForInStatement, ast.KindForOfStatement, ast.KindCaseBlock: + return ContainerFlagsIsBlockScopedContainer | ContainerFlagsHasLocals + case ast.KindBlock: + if ast.IsFunctionLike(node.Parent) || ast.IsClassStaticBlockDeclaration(node.Parent) { + return ContainerFlagsNone + } else { + return ContainerFlagsIsBlockScopedContainer | ContainerFlagsHasLocals + } + } + return ContainerFlagsNone +} + +func isNarrowingExpression(expr *ast.Node) bool { + switch expr.Kind { + case ast.KindIdentifier, ast.KindThisKeyword: + return true + case ast.KindPropertyAccessExpression, ast.KindElementAccessExpression: + return containsNarrowableReference(expr) + case ast.KindCallExpression: + return hasNarrowableArgument(expr) + case ast.KindParenthesizedExpression: + return isNarrowingExpression(expr.AsParenthesizedExpression().Expression) + case ast.KindNonNullExpression: + return isNarrowingExpression(expr.AsNonNullExpression().Expression) + case ast.KindBinaryExpression: + return isNarrowingBinaryExpression(expr.AsBinaryExpression()) + case ast.KindPrefixUnaryExpression: + return expr.AsPrefixUnaryExpression().Operator == ast.KindExclamationToken && isNarrowingExpression(expr.AsPrefixUnaryExpression().Operand) + case ast.KindTypeOfExpression: + return isNarrowingExpression(expr.AsTypeOfExpression().Expression) + } + return false +} + +func containsNarrowableReference(expr *ast.Node) bool { + if isNarrowableReference(expr) { + return true + } + if expr.Flags&ast.NodeFlagsOptionalChain != 0 { + switch expr.Kind { + case ast.KindPropertyAccessExpression: + return containsNarrowableReference(expr.AsPropertyAccessExpression().Expression) + case ast.KindElementAccessExpression: + return containsNarrowableReference(expr.AsElementAccessExpression().Expression) + case ast.KindCallExpression: + return containsNarrowableReference(expr.AsCallExpression().Expression) + case ast.KindNonNullExpression: + return containsNarrowableReference(expr.AsNonNullExpression().Expression) + } + } + return false +} + +func isNarrowableReference(node *ast.Node) bool { + switch node.Kind { + case ast.KindIdentifier, ast.KindThisKeyword, ast.KindSuperKeyword, ast.KindMetaProperty: + return true + case ast.KindPropertyAccessExpression: + return isNarrowableReference(node.AsPropertyAccessExpression().Expression) + case ast.KindParenthesizedExpression: + return isNarrowableReference(node.AsParenthesizedExpression().Expression) + case ast.KindNonNullExpression: + return isNarrowableReference(node.AsNonNullExpression().Expression) + case ast.KindElementAccessExpression: + expr := node.AsElementAccessExpression() + return ast.IsStringOrNumericLiteralLike(expr.ArgumentExpression) || + ast.IsEntityNameExpression(expr.ArgumentExpression) && isNarrowableReference(expr.Expression) + case ast.KindBinaryExpression: + expr := node.AsBinaryExpression() + return expr.OperatorToken.Kind == ast.KindCommaToken && isNarrowableReference(expr.Right) || + ast.IsAssignmentOperator(expr.OperatorToken.Kind) && ast.IsLeftHandSideExpression(expr.Left) + } + return false +} + +func hasNarrowableArgument(expr *ast.Node) bool { + call := expr.AsCallExpression() + for _, argument := range call.Arguments.Nodes { + if containsNarrowableReference(argument) { + return true + } + } + if ast.IsPropertyAccessExpression(call.Expression) { + if containsNarrowableReference(call.Expression.AsPropertyAccessExpression().Expression) { + return true + } + } + return false +} + +func isNarrowingBinaryExpression(expr *ast.BinaryExpression) bool { + switch expr.OperatorToken.Kind { + case ast.KindEqualsToken, ast.KindBarBarEqualsToken, ast.KindAmpersandAmpersandEqualsToken, ast.KindQuestionQuestionEqualsToken: + return containsNarrowableReference(expr.Left) + case ast.KindEqualsEqualsToken, ast.KindExclamationEqualsToken, ast.KindEqualsEqualsEqualsToken, ast.KindExclamationEqualsEqualsToken: + left := ast.SkipParentheses(expr.Left) + right := ast.SkipParentheses(expr.Right) + return isNarrowableOperand(left) || isNarrowableOperand(right) || + isNarrowingTypeOfOperands(right, left) || isNarrowingTypeOfOperands(left, right) || + (ast.IsBooleanLiteral(right) && isNarrowingExpression(left) || ast.IsBooleanLiteral(left) && isNarrowingExpression(right)) + case ast.KindInstanceOfKeyword: + return isNarrowableOperand(expr.Left) + case ast.KindInKeyword: + return isNarrowingExpression(expr.Right) + case ast.KindCommaToken: + return isNarrowingExpression(expr.Right) + } + return false +} + +func isNarrowableOperand(expr *ast.Node) bool { + switch expr.Kind { + case ast.KindParenthesizedExpression: + return isNarrowableOperand(expr.AsParenthesizedExpression().Expression) + case ast.KindBinaryExpression: + binary := expr.AsBinaryExpression() + switch binary.OperatorToken.Kind { + case ast.KindEqualsToken: + return isNarrowableOperand(binary.Left) + case ast.KindCommaToken: + return isNarrowableOperand(binary.Right) + } + } + return containsNarrowableReference(expr) +} + +func isNarrowingTypeOfOperands(expr1 *ast.Node, expr2 *ast.Node) bool { + return ast.IsTypeOfExpression(expr1) && isNarrowableOperand(expr1.AsTypeOfExpression().Expression) && ast.IsStringLiteralLike(expr2) +} + +func (b *Binder) errorOnNode(node *ast.Node, message *diagnostics.Message, args ...any) { + b.addDiagnostic(b.createDiagnosticForNode(node, message, args...)) +} + +func (b *Binder) errorOnFirstToken(node *ast.Node, message *diagnostics.Message, args ...any) { + span := scanner.GetRangeOfTokenAtPosition(b.file, node.Pos()) + b.addDiagnostic(ast.NewDiagnostic(b.file, span, message, args...)) +} + +func (b *Binder) errorOrSuggestionOnNode(isError bool, node *ast.Node, message *diagnostics.Message) { + b.errorOrSuggestionOnRange(isError, node, node, message) +} + +func (b *Binder) errorOrSuggestionOnRange(isError bool, startNode *ast.Node, endNode *ast.Node, message *diagnostics.Message) { + textRange := core.NewTextRange(scanner.GetRangeOfTokenAtPosition(b.file, startNode.Pos()).Pos(), endNode.End()) + diagnostic := ast.NewDiagnostic(b.file, textRange, message) + if isError { + b.addDiagnostic(diagnostic) + } else { + diagnostic.SetCategory(diagnostics.CategorySuggestion) + b.file.BindSuggestionDiagnostics = append(b.file.BindSuggestionDiagnostics, diagnostic) + } +} + +// Inside the binder, we may create a diagnostic for an as-yet unbound node (with potentially no parent pointers, implying no accessible source file) +// If so, the node _must_ be in the current file (as that's the only way anything could have traversed to it to yield it as the error node) +// This version of `createDiagnosticForNode` uses the binder's context to account for this, and always yields correct diagnostics even in these situations. +func (b *Binder) createDiagnosticForNode(node *ast.Node, message *diagnostics.Message, args ...any) *ast.Diagnostic { + return ast.NewDiagnostic(b.file, scanner.GetErrorRangeForNode(b.file, node), message, args...) +} + +func (b *Binder) addDiagnostic(diagnostic *ast.Diagnostic) { + b.file.SetBindDiagnostics(append(b.file.BindDiagnostics(), diagnostic)) +} + +func isSignedNumericLiteral(node *ast.Node) bool { + if node.Kind == ast.KindPrefixUnaryExpression { + node := node.AsPrefixUnaryExpression() + return (node.Operator == ast.KindPlusToken || node.Operator == ast.KindMinusToken) && ast.IsNumericLiteral(node.Operand) + } + return false +} + +func getOptionalSymbolFlagForNode(node *ast.Node) ast.SymbolFlags { + postfixToken := getPostfixTokenFromNode(node) + return core.IfElse(postfixToken != nil && postfixToken.Kind == ast.KindQuestionToken, ast.SymbolFlagsOptional, ast.SymbolFlagsNone) +} + +func getPostfixTokenFromNode(node *ast.Node) *ast.Node { + switch node.Kind { + case ast.KindPropertyDeclaration: + return node.AsPropertyDeclaration().PostfixToken + case ast.KindPropertySignature: + return node.AsPropertySignatureDeclaration().PostfixToken + case ast.KindMethodDeclaration: + return node.AsMethodDeclaration().PostfixToken + case ast.KindMethodSignature: + return node.AsMethodSignatureDeclaration().PostfixToken + } + panic("Unhandled case in getPostfixTokenFromNode") +} + +func isAsyncFunction(node *ast.Node) bool { + switch node.Kind { + case ast.KindFunctionDeclaration, ast.KindFunctionExpression, ast.KindArrowFunction, ast.KindMethodDeclaration: + data := node.BodyData() + return data.Body != nil && data.AsteriskToken == nil && ast.HasSyntacticModifier(node, ast.ModifierFlagsAsync) + } + return false +} + +func isFunctionSymbol(symbol *ast.Symbol) bool { + d := symbol.ValueDeclaration + if d != nil { + if ast.IsFunctionDeclaration(d) { + return true + } + if ast.IsVariableDeclaration(d) { + varDecl := d.AsVariableDeclaration() + if varDecl.Initializer != nil { + return ast.IsFunctionLike(varDecl.Initializer) + } + } + } + return false +} + +func unreachableCodeIsError(options core.SourceFileAffectingCompilerOptions) bool { + return options.AllowUnreachableCode == core.TSFalse +} + +func unusedLabelIsError(options core.SourceFileAffectingCompilerOptions) bool { + return options.AllowUnusedLabels == core.TSFalse +} + +func isStatementCondition(node *ast.Node) bool { + switch node.Parent.Kind { + case ast.KindIfStatement: + return node.Parent.AsIfStatement().Expression == node + case ast.KindWhileStatement: + return node.Parent.AsWhileStatement().Expression == node + case ast.KindDoStatement: + return node.Parent.AsDoStatement().Expression == node + case ast.KindForStatement: + return node.Parent.AsForStatement().Condition == node + case ast.KindConditionalExpression: + return node.Parent.AsConditionalExpression().Condition == node + } + return false +} + +func isTopLevelLogicalExpression(node *ast.Node) bool { + for ast.IsParenthesizedExpression(node.Parent) || ast.IsPrefixUnaryExpression(node.Parent) && node.Parent.AsPrefixUnaryExpression().Operator == ast.KindExclamationToken { + node = node.Parent + } + return !isStatementCondition(node) && !ast.IsLogicalExpression(node.Parent) && !(ast.IsOptionalChain(node.Parent) && node.Parent.Expression() == node) +} + +func isAssignmentDeclaration(decl *ast.Node) bool { + return ast.IsBinaryExpression(decl) || ast.IsAccessExpression(decl) || ast.IsIdentifier(decl) || ast.IsCallExpression(decl) +} + +func isEffectiveModuleDeclaration(node *ast.Node) bool { + return ast.IsModuleDeclaration(node) || ast.IsIdentifier(node) +} diff --git a/kitcom/internal/tsgo/binder/binder_test.go b/kitcom/internal/tsgo/binder/binder_test.go new file mode 100644 index 0000000..e0da3e5 --- /dev/null +++ b/kitcom/internal/tsgo/binder/binder_test.go @@ -0,0 +1,51 @@ +package binder + +import ( + "runtime" + "testing" + + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/ast" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/core" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/parser" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil/fixtures" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/tspath" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/vfs/osvfs" +) + +func BenchmarkBind(b *testing.B) { + for _, f := range fixtures.BenchFixtures { + b.Run(f.Name(), func(b *testing.B) { + f.SkipIfNotExist(b) + + fileName := tspath.GetNormalizedAbsolutePath(f.Path(), "/") + path := tspath.ToPath(fileName, "/", osvfs.FS().UseCaseSensitiveFileNames()) + sourceText := f.ReadFile(b) + + compilerOptions := &core.CompilerOptions{Target: core.ScriptTargetESNext, Module: core.ModuleKindNodeNext} + sourceAffecting := compilerOptions.SourceFileAffecting() + + parseOptions := ast.SourceFileParseOptions{ + FileName: fileName, + Path: path, + CompilerOptions: sourceAffecting, + JSDocParsingMode: ast.JSDocParsingModeParseAll, + } + scriptKind := core.GetScriptKindFromFileName(fileName) + + sourceFiles := make([]*ast.SourceFile, b.N) + for i := range b.N { + sourceFiles[i] = parser.ParseSourceFile(parseOptions, sourceText, scriptKind) + } + + // The above parses do a lot of work; ensure GC is finished before we start collecting performance data. + // GC must be called twice to allow things to settle. + runtime.GC() + runtime.GC() + + b.ResetTimer() + for i := range b.N { + BindSourceFile(sourceFiles[i]) + } + }) + } +} diff --git a/kitcom/internal/tsgo/binder/nameresolver.go b/kitcom/internal/tsgo/binder/nameresolver.go new file mode 100644 index 0000000..83ffa39 --- /dev/null +++ b/kitcom/internal/tsgo/binder/nameresolver.go @@ -0,0 +1,503 @@ +package binder + +import ( + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/ast" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/core" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/diagnostics" +) + +type NameResolver struct { + CompilerOptions *core.CompilerOptions + GetSymbolOfDeclaration func(node *ast.Node) *ast.Symbol + Error func(location *ast.Node, message *diagnostics.Message, args ...any) *ast.Diagnostic + Globals ast.SymbolTable + ArgumentsSymbol *ast.Symbol + RequireSymbol *ast.Symbol + GetModuleSymbol func(sourceFile *ast.Node) *ast.Symbol + Lookup func(symbols ast.SymbolTable, name string, meaning ast.SymbolFlags) *ast.Symbol + SymbolReferenced func(symbol *ast.Symbol, meaning ast.SymbolFlags) + SetRequiresScopeChangeCache func(node *ast.Node, value core.Tristate) + GetRequiresScopeChangeCache func(node *ast.Node) core.Tristate + OnPropertyWithInvalidInitializer func(location *ast.Node, name string, declaration *ast.Node, result *ast.Symbol) bool + OnFailedToResolveSymbol func(location *ast.Node, name string, meaning ast.SymbolFlags, nameNotFoundMessage *diagnostics.Message) + OnSuccessfullyResolvedSymbol func(location *ast.Node, result *ast.Symbol, meaning ast.SymbolFlags, lastLocation *ast.Node, associatedDeclarationForContainingInitializerOrBindingName *ast.Node, withinDeferredContext bool) +} + +func (r *NameResolver) Resolve(location *ast.Node, name string, meaning ast.SymbolFlags, nameNotFoundMessage *diagnostics.Message, isUse bool, excludeGlobals bool) *ast.Symbol { + var result *ast.Symbol + var lastLocation *ast.Node + var lastSelfReferenceLocation *ast.Node + var propertyWithInvalidInitializer *ast.Node + var associatedDeclarationForContainingInitializerOrBindingName *ast.Node + var withinDeferredContext bool + var grandparent *ast.Node + originalLocation := location // needed for did-you-mean error reporting, which gathers candidates starting from the original location + nameIsConst := name == "const" +loop: + for location != nil { + if nameIsConst && ast.IsConstAssertion(location) { + // `const` in an `as const` has no symbol, but issues no error because there is no *actual* lookup of the type + // (it refers to the constant type of the expression instead) + return nil + } + if ast.IsModuleOrEnumDeclaration(location) && lastLocation != nil && location.Name() == lastLocation { + // If lastLocation is the name of a namespace or enum, skip the parent since it will have is own locals that could + // conflict. + lastLocation = location + location = location.Parent + } + locals := location.Locals() + // Locals of a source file are not in scope (because they get merged into the global symbol table) + if locals != nil && !ast.IsGlobalSourceFile(location) { + result = r.lookup(locals, name, meaning) + if result != nil { + useResult := true + if ast.IsFunctionLike(location) && lastLocation != nil && lastLocation != location.Body() { + // symbol lookup restrictions for function-like declarations + // - Type parameters of a function are in scope in the entire function declaration, including the parameter + // list and return type. However, local types are only in scope in the function body. + // - parameters are only in the scope of function body + if meaning&result.Flags&ast.SymbolFlagsType != 0 { + useResult = result.Flags&ast.SymbolFlagsTypeParameter != 0 && (lastLocation == location.Type() || ast.IsParameterLike(lastLocation)) + } + if meaning&result.Flags&ast.SymbolFlagsVariable != 0 { + // expression inside parameter will lookup as normal variable scope when targeting es2015+ + if r.useOuterVariableScopeInParameter(result, location, lastLocation) { + useResult = false + } else if result.Flags&ast.SymbolFlagsFunctionScopedVariable != 0 { + // parameters are visible only inside function body, parameter list and return type + // technically for parameter list case here we might mix parameters and variables declared in function, + // however it is detected separately when checking initializers of parameters + // to make sure that they reference no variables declared after them. + useResult = lastLocation.Kind == ast.KindParameter || + lastLocation.Flags&ast.NodeFlagsSynthesized != 0 || + lastLocation == location.Type() && ast.FindAncestor(result.ValueDeclaration, ast.IsParameter) != nil + } + } + } else if location.Kind == ast.KindConditionalType { + // A type parameter declared using 'infer T' in a conditional type is visible only in + // the true branch of the conditional type. + useResult = lastLocation == location.AsConditionalTypeNode().TrueType + } + if useResult { + break loop + } + result = nil + } + } + withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation) + switch location.Kind { + case ast.KindSourceFile: + if !ast.IsExternalOrCommonJSModule(location.AsSourceFile()) { + break + } + fallthrough + case ast.KindModuleDeclaration: + moduleExports := r.getSymbolOfDeclaration(location).Exports + if ast.IsSourceFile(location) || (ast.IsModuleDeclaration(location) && location.Flags&ast.NodeFlagsAmbient != 0 && !ast.IsGlobalScopeAugmentation(location)) { + // It's an external module. First see if the module has an export default and if the local + // name of that export default matches. + result = moduleExports[ast.InternalSymbolNameDefault] + if result != nil { + localSymbol := GetLocalSymbolForExportDefault(result) + if localSymbol != nil && result.Flags&meaning != 0 && localSymbol.Name == name { + break loop + } + result = nil + } + // Because of module/namespace merging, a module's exports are in scope, + // yet we never want to treat an export specifier as putting a member in scope. + // Therefore, if the name we find is purely an export specifier, it is not actually considered in scope. + // Two things to note about this: + // 1. We have to check this without calling getSymbol. The problem with calling getSymbol + // on an export specifier is that it might find the export specifier itself, and try to + // resolve it as an alias. This will cause the checker to consider the export specifier + // a circular alias reference when it might not be. + // 2. We check === SymbolFlags.Alias in order to check that the symbol is *purely* + // an alias. If we used &, we'd be throwing out symbols that have non alias aspects, + // which is not the desired behavior. + moduleExport := moduleExports[name] + if moduleExport != nil && moduleExport.Flags == ast.SymbolFlagsAlias && (ast.GetDeclarationOfKind(moduleExport, ast.KindExportSpecifier) != nil || ast.GetDeclarationOfKind(moduleExport, ast.KindNamespaceExport) != nil) { + break + } + } + if name != ast.InternalSymbolNameDefault { + result = r.lookup(moduleExports, name, meaning&ast.SymbolFlagsModuleMember) + if result != nil { + break loop + } + } + case ast.KindEnumDeclaration: + result = r.lookup(r.getSymbolOfDeclaration(location).Exports, name, meaning&ast.SymbolFlagsEnumMember) + if result != nil { + if nameNotFoundMessage != nil && r.CompilerOptions.GetIsolatedModules() && location.Flags&ast.NodeFlagsAmbient == 0 && ast.GetSourceFileOfNode(location) != ast.GetSourceFileOfNode(result.ValueDeclaration) { + isolatedModulesLikeFlagName := core.IfElse(r.CompilerOptions.VerbatimModuleSyntax == core.TSTrue, "verbatimModuleSyntax", "isolatedModules") + r.error(originalLocation, diagnostics.Cannot_access_0_from_another_file_without_qualification_when_1_is_enabled_Use_2_instead, + name, isolatedModulesLikeFlagName, r.getSymbolOfDeclaration(location).Name+"."+name) + } + break loop + } + case ast.KindPropertyDeclaration: + if !ast.IsStatic(location) { + ctor := ast.FindConstructorDeclaration(location.Parent) + if ctor != nil && ctor.Locals() != nil { + if r.lookup(ctor.Locals(), name, meaning&ast.SymbolFlagsValue) != nil { + // Remember the property node, it will be used later to report appropriate error + propertyWithInvalidInitializer = location + } + } + } + case ast.KindClassDeclaration, ast.KindClassExpression, ast.KindInterfaceDeclaration: + result = r.lookup(r.getSymbolOfDeclaration(location).Members, name, meaning&ast.SymbolFlagsType) + if result != nil { + if !isTypeParameterSymbolDeclaredInContainer(result, location) { + // ignore type parameters not declared in this container + result = nil + break + } + if lastLocation != nil && ast.IsStatic(lastLocation) { + // TypeScript 1.0 spec (April 2014): 3.4.1 + // The scope of a type parameter extends over the entire declaration with which the type + // parameter list is associated, with the exception of static member declarations in classes. + if nameNotFoundMessage != nil { + r.error(originalLocation, diagnostics.Static_members_cannot_reference_class_type_parameters) + } + return nil + } + break loop + } + if ast.IsClassExpression(location) && meaning&ast.SymbolFlagsClass != 0 { + className := location.Name() + if className != nil && name == className.Text() { + result = location.Symbol() + break loop + } + } + case ast.KindExpressionWithTypeArguments: + if lastLocation == location.AsExpressionWithTypeArguments().Expression && ast.IsHeritageClause(location.Parent) && location.Parent.AsHeritageClause().Token == ast.KindExtendsKeyword { + container := location.Parent.Parent + if ast.IsClassLike(container) { + result = r.lookup(r.getSymbolOfDeclaration(container).Members, name, meaning&ast.SymbolFlagsType) + if result != nil { + if nameNotFoundMessage != nil { + r.error(originalLocation, diagnostics.Base_class_expressions_cannot_reference_class_type_parameters) + } + return nil + } + } + } + // It is not legal to reference a class's own type parameters from a computed property name that + // belongs to the class. For example: + // + // function foo() { return '' } + // class C { // <-- Class's own type parameter T + // [foo()]() { } // <-- Reference to T from class's own computed property + // } + case ast.KindComputedPropertyName: + grandparent = location.Parent.Parent + if ast.IsClassLike(grandparent) || ast.IsInterfaceDeclaration(grandparent) { + // A reference to this grandparent's type parameters would be an error + result = r.lookup(r.getSymbolOfDeclaration(grandparent).Members, name, meaning&ast.SymbolFlagsType) + if result != nil { + if nameNotFoundMessage != nil { + r.error(originalLocation, diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type) + } + return nil + } + } + case ast.KindArrowFunction: + // when targeting ES6 or higher there is no 'arguments' in an arrow function + // for lower compile targets the resolved symbol is used to emit an error + if r.CompilerOptions.GetEmitScriptTarget() >= core.ScriptTargetES2015 { + break + } + fallthrough + case ast.KindMethodDeclaration, ast.KindConstructor, ast.KindGetAccessor, ast.KindSetAccessor, ast.KindFunctionDeclaration: + if meaning&ast.SymbolFlagsVariable != 0 && name == "arguments" { + result = r.argumentsSymbol() + break loop + } + case ast.KindFunctionExpression: + if meaning&ast.SymbolFlagsVariable != 0 && name == "arguments" { + result = r.argumentsSymbol() + break loop + } + if meaning&ast.SymbolFlagsFunction != 0 { + functionName := location.AsFunctionExpression().Name() + if functionName != nil && name == functionName.AsIdentifier().Text { + result = location.AsFunctionExpression().Symbol + break loop + } + } + case ast.KindDecorator: + // Decorators are resolved at the class declaration. Resolving at the parameter + // or member would result in looking up locals in the method. + // + // function y() {} + // class C { + // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. + // } + // + if location.Parent != nil && location.Parent.Kind == ast.KindParameter { + location = location.Parent + } + // function y() {} + // class C { + // @y method(x, y) {} // <-- decorator y should be resolved at the class declaration, not the method. + // } + // + // class Decorators are resolved outside of the class to avoid referencing type parameters of that class. + // + // type T = number; + // declare function y(x: T): any; + // @param(1 as T) // <-- T should resolve to the type alias outside of class C + // class C {} + if location.Parent != nil && (ast.IsClassElement(location.Parent) || location.Parent.Kind == ast.KindClassDeclaration) { + location = location.Parent + } + case ast.KindParameter: + parameterDeclaration := location.AsParameterDeclaration() + if lastLocation != nil && (lastLocation == parameterDeclaration.Initializer || + lastLocation == parameterDeclaration.Name() && ast.IsBindingPattern(lastLocation)) { + if associatedDeclarationForContainingInitializerOrBindingName == nil { + associatedDeclarationForContainingInitializerOrBindingName = location + } + } + case ast.KindBindingElement: + bindingElement := location.AsBindingElement() + if lastLocation != nil && (lastLocation == bindingElement.Initializer || + lastLocation == bindingElement.Name() && ast.IsBindingPattern(lastLocation)) { + if ast.IsPartOfParameterDeclaration(location) && associatedDeclarationForContainingInitializerOrBindingName == nil { + associatedDeclarationForContainingInitializerOrBindingName = location + } + } + case ast.KindInferType: + if meaning&ast.SymbolFlagsTypeParameter != 0 { + parameterName := location.AsInferTypeNode().TypeParameter.AsTypeParameter().Name() + if parameterName != nil && name == parameterName.AsIdentifier().Text { + result = location.AsInferTypeNode().TypeParameter.AsTypeParameter().Symbol + break loop + } + } + case ast.KindExportSpecifier: + exportSpecifier := location.AsExportSpecifier() + if lastLocation != nil && lastLocation == exportSpecifier.PropertyName && location.Parent.Parent.AsExportDeclaration().ModuleSpecifier != nil { + location = location.Parent.Parent.Parent + } + } + if isSelfReferenceLocation(location, lastLocation) { + lastSelfReferenceLocation = location + } + lastLocation = location + location = location.Parent + } + // We just climbed up parents looking for the name, meaning that we started in a descendant node of `lastLocation`. + // If `result === lastSelfReferenceLocation.symbol`, that means that we are somewhere inside `lastSelfReferenceLocation` looking up a name, and resolving to `lastLocation` itself. + // That means that this is a self-reference of `lastLocation`, and shouldn't count this when considering whether `lastLocation` is used. + if isUse && result != nil && (lastSelfReferenceLocation == nil || result != lastSelfReferenceLocation.Symbol()) { + if r.SymbolReferenced != nil { + r.SymbolReferenced(result, meaning) + } + } + if result == nil { + if lastLocation != nil && + lastLocation.Kind == ast.KindSourceFile && + lastLocation.AsSourceFile().CommonJSModuleIndicator != nil && + name == "exports" && + meaning&lastLocation.Symbol().Flags != 0 { + return lastLocation.Symbol() + } + if lastLocation != nil && + r.GetModuleSymbol != nil && + lastLocation.Kind == ast.KindSourceFile && + lastLocation.AsSourceFile().CommonJSModuleIndicator != nil && + name == "module" && + originalLocation.Parent != nil && + ast.IsModuleExportsAccessExpression(originalLocation.Parent) && + meaning&lastLocation.Symbol().Flags != 0 { + return r.GetModuleSymbol(lastLocation) + } + if !excludeGlobals { + result = r.lookup(r.Globals, name, meaning|ast.SymbolFlagsGlobalLookup) + } + } + if result == nil { + if originalLocation != nil && ast.IsInJSFile(originalLocation) && originalLocation.Parent != nil { + if ast.IsRequireCall(originalLocation.Parent, false /*requireStringLiteralLikeArgument*/) { + return r.RequireSymbol + } + } + } + if nameNotFoundMessage != nil { + if propertyWithInvalidInitializer != nil && r.OnPropertyWithInvalidInitializer != nil && r.OnPropertyWithInvalidInitializer(originalLocation, name, propertyWithInvalidInitializer, result) { + return nil + } + if result == nil { + if r.OnFailedToResolveSymbol != nil { + r.OnFailedToResolveSymbol(originalLocation, name, meaning, nameNotFoundMessage) + } + } else { + if r.OnSuccessfullyResolvedSymbol != nil { + r.OnSuccessfullyResolvedSymbol(originalLocation, result, meaning, lastLocation, associatedDeclarationForContainingInitializerOrBindingName, withinDeferredContext) + } + } + } + return result +} + +func (r *NameResolver) useOuterVariableScopeInParameter(result *ast.Symbol, location *ast.Node, lastLocation *ast.Node) bool { + if ast.IsParameter(lastLocation) { + body := location.Body() + if body != nil && result.ValueDeclaration != nil && result.ValueDeclaration.Pos() >= body.Pos() && result.ValueDeclaration.End() <= body.End() { + // check for several cases where we introduce temporaries that require moving the name/initializer of the parameter to the body + // - static field in a class expression + // - optional chaining pre-es2020 + // - nullish coalesce pre-es2020 + // - spread assignment in binding pattern pre-es2017 + target := r.CompilerOptions.GetEmitScriptTarget() + if target >= core.ScriptTargetES2015 { + functionLocation := location + declarationRequiresScopeChange := core.TSUnknown + if r.GetRequiresScopeChangeCache != nil { + declarationRequiresScopeChange = r.GetRequiresScopeChangeCache(functionLocation) + } + if declarationRequiresScopeChange == core.TSUnknown { + declarationRequiresScopeChange = core.IfElse(core.Some(functionLocation.Parameters(), r.requiresScopeChange), core.TSTrue, core.TSFalse) + if r.SetRequiresScopeChangeCache != nil { + r.SetRequiresScopeChangeCache(functionLocation, declarationRequiresScopeChange) + } + } + return declarationRequiresScopeChange != core.TSTrue + } + } + } + return false +} + +func (r *NameResolver) requiresScopeChange(node *ast.Node) bool { + d := node.AsParameterDeclaration() + return r.requiresScopeChangeWorker(d.Name()) || d.Initializer != nil && r.requiresScopeChangeWorker(d.Initializer) +} + +func (r *NameResolver) requiresScopeChangeWorker(node *ast.Node) bool { + switch node.Kind { + case ast.KindArrowFunction, ast.KindFunctionExpression, ast.KindFunctionDeclaration, ast.KindConstructor: + return false + case ast.KindMethodDeclaration, ast.KindGetAccessor, ast.KindSetAccessor, ast.KindPropertyAssignment: + return r.requiresScopeChangeWorker(node.Name()) + case ast.KindPropertyDeclaration: + if ast.HasStaticModifier(node) { + return !r.CompilerOptions.GetEmitStandardClassFields() + } + return r.requiresScopeChangeWorker(node.AsPropertyDeclaration().Name()) + default: + if ast.IsNullishCoalesce(node) || ast.IsOptionalChain(node) { + return r.CompilerOptions.GetEmitScriptTarget() < core.ScriptTargetES2020 + } + if ast.IsBindingElement(node) && node.AsBindingElement().DotDotDotToken != nil && ast.IsObjectBindingPattern(node.Parent) { + return r.CompilerOptions.GetEmitScriptTarget() < core.ScriptTargetES2017 + } + if ast.IsTypeNode(node) { + return false + } + return node.ForEachChild(r.requiresScopeChangeWorker) + } +} + +func (r *NameResolver) error(location *ast.Node, message *diagnostics.Message, args ...any) { + if r.Error != nil { + r.Error(location, message, args...) + } + // Default implementation does not report errors +} + +func (r *NameResolver) getSymbolOfDeclaration(node *ast.Node) *ast.Symbol { + if r.GetSymbolOfDeclaration != nil { + return r.GetSymbolOfDeclaration(node) + } + + // Default implementation does not support merged symbols + return node.Symbol() +} + +func (r *NameResolver) lookup(symbols ast.SymbolTable, name string, meaning ast.SymbolFlags) *ast.Symbol { + if r.Lookup != nil { + return r.Lookup(symbols, name, meaning) + } + // Default implementation does not support following aliases or merged symbols + if meaning != 0 { + symbol := symbols[name] + if symbol != nil { + if symbol.Flags&meaning != 0 { + return symbol + } + } + } + return nil +} + +func (r *NameResolver) argumentsSymbol() *ast.Symbol { + if r.ArgumentsSymbol == nil { + // Default implementation synthesizes a transient symbol for `arguments` + r.ArgumentsSymbol = &ast.Symbol{Name: "arguments", Flags: ast.SymbolFlagsProperty | ast.SymbolFlagsTransient} + } + return r.ArgumentsSymbol +} + +func GetLocalSymbolForExportDefault(symbol *ast.Symbol) *ast.Symbol { + if !isExportDefaultSymbol(symbol) || len(symbol.Declarations) == 0 { + return nil + } + for _, decl := range symbol.Declarations { + localSymbol := decl.LocalSymbol() + if localSymbol != nil { + return localSymbol + } + } + return nil +} + +func isExportDefaultSymbol(symbol *ast.Symbol) bool { + return symbol != nil && len(symbol.Declarations) > 0 && ast.HasSyntacticModifier(symbol.Declarations[0], ast.ModifierFlagsDefault) +} + +func getIsDeferredContext(location *ast.Node, lastLocation *ast.Node) bool { + if location.Kind != ast.KindArrowFunction && location.Kind != ast.KindFunctionExpression { + // initializers in instance property declaration of class like entities are executed in constructor and thus deferred + // A name is evaluated within the enclosing scope - so it shouldn't count as deferred + return ast.IsTypeQueryNode(location) || + (ast.IsFunctionLikeDeclaration(location) || location.Kind == ast.KindPropertyDeclaration && !ast.IsStatic(location)) && + (lastLocation == nil || lastLocation != location.Name()) + } + if lastLocation != nil && lastLocation == location.Name() { + return false + } + // generator functions and async functions are not inlined in control flow when immediately invoked + if location.BodyData().AsteriskToken != nil || ast.HasSyntacticModifier(location, ast.ModifierFlagsAsync) { + return true + } + return ast.GetImmediatelyInvokedFunctionExpression(location) == nil +} + +func isTypeParameterSymbolDeclaredInContainer(symbol *ast.Symbol, container *ast.Node) bool { + for _, decl := range symbol.Declarations { + if decl.Kind == ast.KindTypeParameter { + parent := decl.Parent + if parent == container { + return true + } + } + } + return false +} + +func isSelfReferenceLocation(node *ast.Node, lastLocation *ast.Node) bool { + switch node.Kind { + case ast.KindParameter: + return lastLocation != nil && lastLocation == node.Name() + case ast.KindFunctionDeclaration, ast.KindClassDeclaration, ast.KindInterfaceDeclaration, ast.KindEnumDeclaration, + ast.KindTypeAliasDeclaration, ast.KindJSTypeAliasDeclaration, ast.KindModuleDeclaration: // For `namespace N { N; }` + return true + } + return false +} diff --git a/kitcom/internal/tsgo/binder/referenceresolver.go b/kitcom/internal/tsgo/binder/referenceresolver.go new file mode 100644 index 0000000..963276c --- /dev/null +++ b/kitcom/internal/tsgo/binder/referenceresolver.go @@ -0,0 +1,251 @@ +package binder + +import ( + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/ast" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/core" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/diagnostics" +) + +type ReferenceResolver interface { + GetReferencedExportContainer(node *ast.IdentifierNode, prefixLocals bool) *ast.Node + GetReferencedImportDeclaration(node *ast.IdentifierNode) *ast.Declaration + GetReferencedValueDeclaration(node *ast.IdentifierNode) *ast.Declaration + GetReferencedValueDeclarations(node *ast.IdentifierNode) []*ast.Declaration + GetElementAccessExpressionName(expression *ast.ElementAccessExpression) string +} + +type ReferenceResolverHooks struct { + ResolveName func(location *ast.Node, name string, meaning ast.SymbolFlags, nameNotFoundMessage *diagnostics.Message, isUse bool, excludeGlobals bool) *ast.Symbol + GetResolvedSymbol func(*ast.Node) *ast.Symbol + GetMergedSymbol func(*ast.Symbol) *ast.Symbol + GetParentOfSymbol func(*ast.Symbol) *ast.Symbol + GetSymbolOfDeclaration func(*ast.Declaration) *ast.Symbol + GetTypeOnlyAliasDeclaration func(symbol *ast.Symbol, include ast.SymbolFlags) *ast.Declaration + GetExportSymbolOfValueSymbolIfExported func(*ast.Symbol) *ast.Symbol + GetElementAccessExpressionName func(*ast.ElementAccessExpression) (string, bool) +} + +var _ ReferenceResolver = &referenceResolver{} + +type referenceResolver struct { + resolver *NameResolver + options *core.CompilerOptions + hooks ReferenceResolverHooks +} + +func NewReferenceResolver(options *core.CompilerOptions, hooks ReferenceResolverHooks) ReferenceResolver { + return &referenceResolver{ + options: options, + hooks: hooks, + } +} + +func (r *referenceResolver) getResolvedSymbol(node *ast.Node) *ast.Symbol { + if node != nil { + if r.hooks.GetResolvedSymbol != nil { + return r.hooks.GetResolvedSymbol(node) + } + } + return nil +} + +func (r *referenceResolver) getMergedSymbol(symbol *ast.Symbol) *ast.Symbol { + if symbol != nil { + if r.hooks.GetMergedSymbol != nil { + return r.hooks.GetMergedSymbol(symbol) + } + return symbol + } + return nil +} + +func (r *referenceResolver) getParentOfSymbol(symbol *ast.Symbol) *ast.Symbol { + if symbol != nil { + if r.hooks.GetParentOfSymbol != nil { + return r.hooks.GetParentOfSymbol(symbol) + } + return symbol.Parent + } + return nil +} + +func (r *referenceResolver) getSymbolOfDeclaration(declaration *ast.Declaration) *ast.Symbol { + if declaration != nil { + if r.hooks.GetSymbolOfDeclaration != nil { + return r.hooks.GetSymbolOfDeclaration(declaration) + } + return declaration.Symbol() + } + return nil +} + +func (r *referenceResolver) getReferencedValueSymbol(reference *ast.IdentifierNode, startInDeclarationContainer bool) *ast.Symbol { + resolvedSymbol := r.getResolvedSymbol(reference) + if resolvedSymbol != nil { + return resolvedSymbol + } + + location := reference + if startInDeclarationContainer && reference.Parent != nil && ast.IsDeclaration(reference.Parent) && reference.Parent.Name() == reference { + location = ast.GetDeclarationContainer(reference.Parent) + } + + if r.hooks.ResolveName != nil { + return r.hooks.ResolveName(location, reference.Text(), ast.SymbolFlagsExportValue|ast.SymbolFlagsValue|ast.SymbolFlagsAlias, nil /*nameNotFoundMessage*/, false /*isUse*/, false /*excludeGlobals*/) + } + + if r.resolver == nil { + r.resolver = &NameResolver{ + CompilerOptions: r.options, + } + } + + return r.resolver.Resolve(location, reference.Text(), ast.SymbolFlagsExportValue|ast.SymbolFlagsValue|ast.SymbolFlagsAlias, nil /*nameNotFoundMessage*/, false /*isUse*/, false /*excludeGlobals*/) +} + +func (r *referenceResolver) isTypeOnlyAliasDeclaration(symbol *ast.Symbol) bool { + if symbol != nil { + if r.hooks.GetTypeOnlyAliasDeclaration != nil { + return r.hooks.GetTypeOnlyAliasDeclaration(symbol, ast.SymbolFlagsValue) != nil + } + + node := r.getDeclarationOfAliasSymbol(symbol) + for node != nil { + switch node.Kind { + case ast.KindImportEqualsDeclaration, ast.KindExportDeclaration: + return node.IsTypeOnly() + case ast.KindImportClause, ast.KindImportSpecifier, ast.KindExportSpecifier: + if node.IsTypeOnly() { + return true + } + node = node.Parent + continue + case ast.KindNamedImports, ast.KindNamedExports: + node = node.Parent + continue + } + break + } + } + return false +} + +func (r *referenceResolver) getDeclarationOfAliasSymbol(symbol *ast.Symbol) *ast.Declaration { + return core.FindLast(symbol.Declarations, ast.IsAliasSymbolDeclaration) +} + +func (r *referenceResolver) getExportSymbolOfValueSymbolIfExported(symbol *ast.Symbol) *ast.Symbol { + if symbol != nil { + if r.hooks.GetExportSymbolOfValueSymbolIfExported != nil { + return r.hooks.GetExportSymbolOfValueSymbolIfExported(symbol) + } + if symbol.Flags&ast.SymbolFlagsExportValue != 0 && symbol.ExportSymbol != nil { + symbol = symbol.ExportSymbol + } + return r.getMergedSymbol(symbol) + } + return nil +} + +func (r *referenceResolver) GetReferencedExportContainer(node *ast.IdentifierNode, prefixLocals bool) *ast.Node /*SourceFile|ModuleDeclaration|EnumDeclaration*/ { + // When resolving the export for the name of a module or enum + // declaration, we need to start resolution at the declaration's container. + // Otherwise, we could incorrectly resolve the export as the + // declaration if it contains an exported member with the same name. + startInDeclarationContainer := node.Parent != nil && (node.Parent.Kind == ast.KindModuleDeclaration || node.Parent.Kind == ast.KindEnumDeclaration) && node == node.Parent.Name() + if symbol := r.getReferencedValueSymbol(node, startInDeclarationContainer); symbol != nil { + if symbol.Flags&ast.SymbolFlagsExportValue != 0 { + // If we reference an exported entity within the same module declaration, then whether + // we prefix depends on the kind of entity. SymbolFlags.ExportHasLocal encompasses all the + // kinds that we do NOT prefix. + exportSymbol := r.getMergedSymbol(symbol.ExportSymbol) + if !prefixLocals && exportSymbol.Flags&ast.SymbolFlagsExportHasLocal != 0 && exportSymbol.Flags&ast.SymbolFlagsVariable == 0 { + return nil + } + symbol = exportSymbol + } + parentSymbol := r.getParentOfSymbol(symbol) + if parentSymbol != nil { + if parentSymbol.Flags&ast.SymbolFlagsValueModule != 0 && parentSymbol.ValueDeclaration != nil && parentSymbol.ValueDeclaration.Kind == ast.KindSourceFile { + symbolFile := parentSymbol.ValueDeclaration.AsSourceFile() + referenceFile := ast.GetSourceFileOfNode(node) + // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return nil. + symbolIsUmdExport := symbolFile != referenceFile + if symbolIsUmdExport { + return nil + } + return symbolFile.AsNode() + } + isMatchingContainer := func(n *ast.Node) bool { + return (n.Kind == ast.KindModuleDeclaration || n.Kind == ast.KindEnumDeclaration) && r.getSymbolOfDeclaration(n) == parentSymbol + } + if container := ast.FindAncestor(symbol.ValueDeclaration, isMatchingContainer); container != nil { + return container + } + return ast.FindAncestor(node.Parent, isMatchingContainer) + } + } + + return nil +} + +func (r *referenceResolver) GetReferencedImportDeclaration(node *ast.IdentifierNode) *ast.Declaration { + if symbol := r.getReferencedValueSymbol(node, false /*startInDeclarationContainer*/); symbol != nil { + // We should only get the declaration of an alias if there isn't a local value + // declaration for the symbol + if ast.IsNonLocalAlias(symbol, ast.SymbolFlagsValue /*excludes*/) && !r.isTypeOnlyAliasDeclaration(symbol) { + return r.getDeclarationOfAliasSymbol(symbol) + } + } + + return nil +} + +func (r *referenceResolver) GetReferencedValueDeclaration(node *ast.IdentifierNode) *ast.Declaration { + if symbol := r.getReferencedValueSymbol(node, false /*startInDeclarationContainer*/); symbol != nil { + return r.getExportSymbolOfValueSymbolIfExported(symbol).ValueDeclaration + } + return nil +} + +func (r *referenceResolver) GetReferencedValueDeclarations(node *ast.IdentifierNode) []*ast.Declaration { + var declarations []*ast.Declaration + if symbol := r.getReferencedValueSymbol(node, false /*startInDeclarationContainer*/); symbol != nil { + symbol = r.getExportSymbolOfValueSymbolIfExported(symbol) + for _, declaration := range symbol.Declarations { + switch declaration.Kind { + case ast.KindVariableDeclaration, + ast.KindParameter, + ast.KindBindingElement, + ast.KindPropertyDeclaration, + ast.KindPropertyAssignment, + ast.KindShorthandPropertyAssignment, + ast.KindEnumMember, + ast.KindObjectLiteralExpression, + ast.KindFunctionDeclaration, + ast.KindFunctionExpression, + ast.KindArrowFunction, + ast.KindClassDeclaration, + ast.KindClassExpression, + ast.KindEnumDeclaration, + ast.KindMethodDeclaration, + ast.KindGetAccessor, + ast.KindSetAccessor, + ast.KindModuleDeclaration: + declarations = append(declarations, declaration) + } + } + } + return declarations +} + +func (r *referenceResolver) GetElementAccessExpressionName(expression *ast.ElementAccessExpression) string { + if expression != nil { + if r.hooks.GetElementAccessExpressionName != nil { + if name, ok := r.hooks.GetElementAccessExpressionName(expression); ok { + return name + } + } + } + return "" +} diff --git a/kitcom/internal/tsgo/bundled/bundled.go b/kitcom/internal/tsgo/bundled/bundled.go new file mode 100644 index 0000000..7e800c4 --- /dev/null +++ b/kitcom/internal/tsgo/bundled/bundled.go @@ -0,0 +1,53 @@ +// Package bundled provides access to files bundled with TypeScript. +package bundled + +import ( + "path/filepath" + "runtime" + "sync" + "testing" + + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/tspath" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/vfs" +) + +//go:generate go run generate.go + +// Define the below here to consolidate documentation. + +// Embedded is true if the bundled files are implemented through an embedded FS. +const Embedded = embedded + +// WrapFS returns an FS which redirects embedded paths to the embedded file system. +// If the embedded file system is not available, it returns the original FS. +func WrapFS(fs vfs.FS) vfs.FS { + return wrapFS(fs) +} + +// LibPath returns the path to the directory containing the bundled lib.d.ts files. +// If embedding is not enabled, this is a path on disk, and must be accessed through +// a real OS filesystem. +func LibPath() string { + return libPath() +} + +var bundledSourceDir = sync.OnceValue(func() string { + _, filename, _, ok := runtime.Caller(0) + if !ok { + panic("bundled: could not get current filename") + } + return filepath.Dir(filepath.FromSlash(filename)) +}) + +var testingLibPath = sync.OnceValue(func() string { + if !testing.Testing() { + panic("bundled: TestingLibPath should only be called during tests") + } + return tspath.NormalizeSlashes(filepath.Join(bundledSourceDir(), "libs")) +}) + +// TestingLibPath returns the path to the source bundled libs directory. +// It's only valid to use in tests where the source code is available. +func TestingLibPath() string { + return testingLibPath() +} diff --git a/kitcom/internal/tsgo/bundled/bundled_test.go b/kitcom/internal/tsgo/bundled/bundled_test.go new file mode 100644 index 0000000..77f8f8a --- /dev/null +++ b/kitcom/internal/tsgo/bundled/bundled_test.go @@ -0,0 +1,48 @@ +package bundled_test + +import ( + "os" + "path/filepath" + "testing" + + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/bundled" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/tspath" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/vfs" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/vfs/osvfs" + "gotest.tools/v3/assert" +) + +func TestTestingLibPath(t *testing.T) { + t.Parallel() + + p := bundled.TestingLibPath() + + _, err := os.Stat(p) + assert.NilError(t, err) + + libdts := filepath.Join(p, "lib.d.ts") + + _, err = os.Stat(libdts) + assert.NilError(t, err) +} + +func TestEmbeddedLibs(t *testing.T) { + t.Parallel() + + fs := bundled.WrapFS(osvfs.FS()) + + var files []string + + err := fs.WalkDir(bundled.LibPath(), func(path string, d vfs.DirEntry, err error) error { + if err != nil { + return err + } + if !d.IsDir() { + files = append(files, tspath.GetBaseFileName(path)) + } + return nil + }) + assert.NilError(t, err) + + assert.DeepEqual(t, files, bundled.LibNames) +} diff --git a/kitcom/internal/tsgo/bundled/embed.go b/kitcom/internal/tsgo/bundled/embed.go new file mode 100644 index 0000000..451004c --- /dev/null +++ b/kitcom/internal/tsgo/bundled/embed.go @@ -0,0 +1,212 @@ +//go:build !noembed + +package bundled + +import ( + "io/fs" + "strings" + "time" + + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/vfs" +) + +const embedded = true + +const scheme = "bundled:///" + +func splitPath(path string) (rest string, ok bool) { + return strings.CutPrefix(path, scheme) +} + +func libPath() string { + return scheme + "libs" +} + +// wrappedFS is implemented directly rather than going through [io/fs.FS]. +// Our vfs.FS works with file contents in terms of strings, and that's +// what go:embed does under the hood, but going through fs.FS will cause +// copying to []byte and back. + +type wrappedFS struct { + fs vfs.FS +} + +var _ vfs.FS = (*wrappedFS)(nil) + +func wrapFS(fs vfs.FS) vfs.FS { + return &wrappedFS{fs: fs} +} + +func (vfs *wrappedFS) UseCaseSensitiveFileNames() bool { + return vfs.fs.UseCaseSensitiveFileNames() +} + +func (vfs *wrappedFS) FileExists(path string) bool { + if rest, ok := splitPath(path); ok { + _, ok := embeddedContents[rest] + return ok + } + return vfs.fs.FileExists(path) +} + +func (vfs *wrappedFS) ReadFile(path string) (contents string, ok bool) { + if rest, ok := splitPath(path); ok { + contents, ok = embeddedContents[rest] + return contents, ok + } + return vfs.fs.ReadFile(path) +} + +func (vfs *wrappedFS) DirectoryExists(path string) bool { + if rest, ok := splitPath(path); ok { + return rest == "libs" + } + return vfs.fs.DirectoryExists(path) +} + +func (vfs *wrappedFS) GetAccessibleEntries(path string) (result vfs.Entries) { + if rest, ok := splitPath(path); ok { + if rest == "" { + result.Directories = []string{"libs"} + } else if rest == "libs" { + result.Files = LibNames + } + return result + } + return vfs.fs.GetAccessibleEntries(path) +} + +var rootEntries = []fs.DirEntry{ + fs.FileInfoToDirEntry(&fileInfo{name: "libs", mode: fs.ModeDir}), +} + +func (vfs *wrappedFS) Stat(path string) vfs.FileInfo { + if rest, ok := splitPath(path); ok { + if rest == "" || rest == "libs" { + return &fileInfo{name: rest, mode: fs.ModeDir} + } + if lib, ok := embeddedContents[rest]; ok { + libName, _ := strings.CutPrefix(rest, "libs/") + return &fileInfo{name: libName, size: int64(len(lib))} + } + return nil + } + return vfs.fs.Stat(path) +} + +func (vfs *wrappedFS) WalkDir(root string, walkFn vfs.WalkDirFunc) error { + if rest, ok := splitPath(root); ok { + if err := vfs.walkDir(rest, walkFn); err != nil { + if err == fs.SkipAll { //nolint:errorlint + return nil + } + return err + } + return nil + } + return vfs.fs.WalkDir(root, walkFn) +} + +func (vfs *wrappedFS) walkDir(rest string, walkFn vfs.WalkDirFunc) error { + var entries []fs.DirEntry + switch rest { + case "": + entries = rootEntries + case "libs": + entries = libsEntries + default: + return nil + } + + for _, entry := range entries { + name := rest + "/" + entry.Name() + + if err := walkFn(scheme+name, entry, nil); err != nil { + if err == fs.SkipAll { //nolint:errorlint + return fs.SkipAll + } + if err == fs.SkipDir { //nolint:errorlint + continue + } + return err + } + if entry.IsDir() { + if err := vfs.walkDir(name, walkFn); err != nil { + return err + } + } + } + + return nil +} + +func (vfs *wrappedFS) Realpath(path string) string { + if _, ok := splitPath(path); ok { + return path + } + return vfs.fs.Realpath(path) +} + +func (vfs *wrappedFS) WriteFile(path string, data string, writeByteOrderMark bool) error { + if _, ok := splitPath(path); ok { + panic("cannot write to embedded file system") + } + return vfs.fs.WriteFile(path, data, writeByteOrderMark) +} + +func (vfs *wrappedFS) Remove(path string) error { + if _, ok := splitPath(path); ok { + panic("cannot remove from embedded file system") + } + return vfs.fs.Remove(path) +} + +func (vfs *wrappedFS) Chtimes(path string, aTime time.Time, mTime time.Time) error { + if _, ok := splitPath(path); ok { + panic("cannot change times on embedded file system") + } + return vfs.fs.Chtimes(path, aTime, mTime) +} + +type fileInfo struct { + mode fs.FileMode + name string + size int64 +} + +var ( + _ fs.FileInfo = (*fileInfo)(nil) + _ fs.DirEntry = (*fileInfo)(nil) +) + +func (fi *fileInfo) IsDir() bool { + return fi.mode.IsDir() +} + +func (fi *fileInfo) ModTime() time.Time { + return time.Time{} +} + +func (fi *fileInfo) Mode() fs.FileMode { + return fi.mode +} + +func (fi *fileInfo) Name() string { + return fi.name +} + +func (fi *fileInfo) Size() int64 { + return fi.size +} + +func (fi *fileInfo) Sys() any { + return nil +} + +func (fi *fileInfo) Info() (fs.FileInfo, error) { + return fi, nil +} + +func (fi *fileInfo) Type() fs.FileMode { + return fi.mode.Type() +} diff --git a/kitcom/internal/tsgo/bundled/embed_generated.go b/kitcom/internal/tsgo/bundled/embed_generated.go new file mode 100644 index 0000000..0d0858b --- /dev/null +++ b/kitcom/internal/tsgo/bundled/embed_generated.go @@ -0,0 +1,420 @@ +//go:build !noembed + +// Code generated by generate.go; DO NOT EDIT. + +package bundled + +import ( + "io/fs" + + _ "embed" +) + +var ( + //go:embed libs/lib.d.ts + libs_lib_d_ts string + //go:embed libs/lib.decorators.d.ts + libs_lib_decorators_d_ts string + //go:embed libs/lib.decorators.legacy.d.ts + libs_lib_decorators_legacy_d_ts string + //go:embed libs/lib.dom.asynciterable.d.ts + libs_lib_dom_asynciterable_d_ts string + //go:embed libs/lib.dom.d.ts + libs_lib_dom_d_ts string + //go:embed libs/lib.dom.iterable.d.ts + libs_lib_dom_iterable_d_ts string + //go:embed libs/lib.es2015.collection.d.ts + libs_lib_es2015_collection_d_ts string + //go:embed libs/lib.es2015.core.d.ts + libs_lib_es2015_core_d_ts string + //go:embed libs/lib.es2015.d.ts + libs_lib_es2015_d_ts string + //go:embed libs/lib.es2015.generator.d.ts + libs_lib_es2015_generator_d_ts string + //go:embed libs/lib.es2015.iterable.d.ts + libs_lib_es2015_iterable_d_ts string + //go:embed libs/lib.es2015.promise.d.ts + libs_lib_es2015_promise_d_ts string + //go:embed libs/lib.es2015.proxy.d.ts + libs_lib_es2015_proxy_d_ts string + //go:embed libs/lib.es2015.reflect.d.ts + libs_lib_es2015_reflect_d_ts string + //go:embed libs/lib.es2015.symbol.d.ts + libs_lib_es2015_symbol_d_ts string + //go:embed libs/lib.es2015.symbol.wellknown.d.ts + libs_lib_es2015_symbol_wellknown_d_ts string + //go:embed libs/lib.es2016.array.include.d.ts + libs_lib_es2016_array_include_d_ts string + //go:embed libs/lib.es2016.d.ts + libs_lib_es2016_d_ts string + //go:embed libs/lib.es2016.full.d.ts + libs_lib_es2016_full_d_ts string + //go:embed libs/lib.es2016.intl.d.ts + libs_lib_es2016_intl_d_ts string + //go:embed libs/lib.es2017.arraybuffer.d.ts + libs_lib_es2017_arraybuffer_d_ts string + //go:embed libs/lib.es2017.d.ts + libs_lib_es2017_d_ts string + //go:embed libs/lib.es2017.date.d.ts + libs_lib_es2017_date_d_ts string + //go:embed libs/lib.es2017.full.d.ts + libs_lib_es2017_full_d_ts string + //go:embed libs/lib.es2017.intl.d.ts + libs_lib_es2017_intl_d_ts string + //go:embed libs/lib.es2017.object.d.ts + libs_lib_es2017_object_d_ts string + //go:embed libs/lib.es2017.sharedmemory.d.ts + libs_lib_es2017_sharedmemory_d_ts string + //go:embed libs/lib.es2017.string.d.ts + libs_lib_es2017_string_d_ts string + //go:embed libs/lib.es2017.typedarrays.d.ts + libs_lib_es2017_typedarrays_d_ts string + //go:embed libs/lib.es2018.asyncgenerator.d.ts + libs_lib_es2018_asyncgenerator_d_ts string + //go:embed libs/lib.es2018.asynciterable.d.ts + libs_lib_es2018_asynciterable_d_ts string + //go:embed libs/lib.es2018.d.ts + libs_lib_es2018_d_ts string + //go:embed libs/lib.es2018.full.d.ts + libs_lib_es2018_full_d_ts string + //go:embed libs/lib.es2018.intl.d.ts + libs_lib_es2018_intl_d_ts string + //go:embed libs/lib.es2018.promise.d.ts + libs_lib_es2018_promise_d_ts string + //go:embed libs/lib.es2018.regexp.d.ts + libs_lib_es2018_regexp_d_ts string + //go:embed libs/lib.es2019.array.d.ts + libs_lib_es2019_array_d_ts string + //go:embed libs/lib.es2019.d.ts + libs_lib_es2019_d_ts string + //go:embed libs/lib.es2019.full.d.ts + libs_lib_es2019_full_d_ts string + //go:embed libs/lib.es2019.intl.d.ts + libs_lib_es2019_intl_d_ts string + //go:embed libs/lib.es2019.object.d.ts + libs_lib_es2019_object_d_ts string + //go:embed libs/lib.es2019.string.d.ts + libs_lib_es2019_string_d_ts string + //go:embed libs/lib.es2019.symbol.d.ts + libs_lib_es2019_symbol_d_ts string + //go:embed libs/lib.es2020.bigint.d.ts + libs_lib_es2020_bigint_d_ts string + //go:embed libs/lib.es2020.d.ts + libs_lib_es2020_d_ts string + //go:embed libs/lib.es2020.date.d.ts + libs_lib_es2020_date_d_ts string + //go:embed libs/lib.es2020.full.d.ts + libs_lib_es2020_full_d_ts string + //go:embed libs/lib.es2020.intl.d.ts + libs_lib_es2020_intl_d_ts string + //go:embed libs/lib.es2020.number.d.ts + libs_lib_es2020_number_d_ts string + //go:embed libs/lib.es2020.promise.d.ts + libs_lib_es2020_promise_d_ts string + //go:embed libs/lib.es2020.sharedmemory.d.ts + libs_lib_es2020_sharedmemory_d_ts string + //go:embed libs/lib.es2020.string.d.ts + libs_lib_es2020_string_d_ts string + //go:embed libs/lib.es2020.symbol.wellknown.d.ts + libs_lib_es2020_symbol_wellknown_d_ts string + //go:embed libs/lib.es2021.d.ts + libs_lib_es2021_d_ts string + //go:embed libs/lib.es2021.full.d.ts + libs_lib_es2021_full_d_ts string + //go:embed libs/lib.es2021.intl.d.ts + libs_lib_es2021_intl_d_ts string + //go:embed libs/lib.es2021.promise.d.ts + libs_lib_es2021_promise_d_ts string + //go:embed libs/lib.es2021.string.d.ts + libs_lib_es2021_string_d_ts string + //go:embed libs/lib.es2021.weakref.d.ts + libs_lib_es2021_weakref_d_ts string + //go:embed libs/lib.es2022.array.d.ts + libs_lib_es2022_array_d_ts string + //go:embed libs/lib.es2022.d.ts + libs_lib_es2022_d_ts string + //go:embed libs/lib.es2022.error.d.ts + libs_lib_es2022_error_d_ts string + //go:embed libs/lib.es2022.full.d.ts + libs_lib_es2022_full_d_ts string + //go:embed libs/lib.es2022.intl.d.ts + libs_lib_es2022_intl_d_ts string + //go:embed libs/lib.es2022.object.d.ts + libs_lib_es2022_object_d_ts string + //go:embed libs/lib.es2022.regexp.d.ts + libs_lib_es2022_regexp_d_ts string + //go:embed libs/lib.es2022.string.d.ts + libs_lib_es2022_string_d_ts string + //go:embed libs/lib.es2023.array.d.ts + libs_lib_es2023_array_d_ts string + //go:embed libs/lib.es2023.collection.d.ts + libs_lib_es2023_collection_d_ts string + //go:embed libs/lib.es2023.d.ts + libs_lib_es2023_d_ts string + //go:embed libs/lib.es2023.full.d.ts + libs_lib_es2023_full_d_ts string + //go:embed libs/lib.es2023.intl.d.ts + libs_lib_es2023_intl_d_ts string + //go:embed libs/lib.es2024.arraybuffer.d.ts + libs_lib_es2024_arraybuffer_d_ts string + //go:embed libs/lib.es2024.collection.d.ts + libs_lib_es2024_collection_d_ts string + //go:embed libs/lib.es2024.d.ts + libs_lib_es2024_d_ts string + //go:embed libs/lib.es2024.full.d.ts + libs_lib_es2024_full_d_ts string + //go:embed libs/lib.es2024.object.d.ts + libs_lib_es2024_object_d_ts string + //go:embed libs/lib.es2024.promise.d.ts + libs_lib_es2024_promise_d_ts string + //go:embed libs/lib.es2024.regexp.d.ts + libs_lib_es2024_regexp_d_ts string + //go:embed libs/lib.es2024.sharedmemory.d.ts + libs_lib_es2024_sharedmemory_d_ts string + //go:embed libs/lib.es2024.string.d.ts + libs_lib_es2024_string_d_ts string + //go:embed libs/lib.es5.d.ts + libs_lib_es5_d_ts string + //go:embed libs/lib.es6.d.ts + libs_lib_es6_d_ts string + //go:embed libs/lib.esnext.array.d.ts + libs_lib_esnext_array_d_ts string + //go:embed libs/lib.esnext.collection.d.ts + libs_lib_esnext_collection_d_ts string + //go:embed libs/lib.esnext.d.ts + libs_lib_esnext_d_ts string + //go:embed libs/lib.esnext.decorators.d.ts + libs_lib_esnext_decorators_d_ts string + //go:embed libs/lib.esnext.disposable.d.ts + libs_lib_esnext_disposable_d_ts string + //go:embed libs/lib.esnext.error.d.ts + libs_lib_esnext_error_d_ts string + //go:embed libs/lib.esnext.float16.d.ts + libs_lib_esnext_float16_d_ts string + //go:embed libs/lib.esnext.full.d.ts + libs_lib_esnext_full_d_ts string + //go:embed libs/lib.esnext.intl.d.ts + libs_lib_esnext_intl_d_ts string + //go:embed libs/lib.esnext.iterator.d.ts + libs_lib_esnext_iterator_d_ts string + //go:embed libs/lib.esnext.promise.d.ts + libs_lib_esnext_promise_d_ts string + //go:embed libs/lib.esnext.sharedmemory.d.ts + libs_lib_esnext_sharedmemory_d_ts string + //go:embed libs/lib.scripthost.d.ts + libs_lib_scripthost_d_ts string + //go:embed libs/lib.webworker.asynciterable.d.ts + libs_lib_webworker_asynciterable_d_ts string + //go:embed libs/lib.webworker.d.ts + libs_lib_webworker_d_ts string + //go:embed libs/lib.webworker.importscripts.d.ts + libs_lib_webworker_importscripts_d_ts string + //go:embed libs/lib.webworker.iterable.d.ts + libs_lib_webworker_iterable_d_ts string +) + +var embeddedContents = map[string]string{ + "libs/lib.d.ts": libs_lib_d_ts, + "libs/lib.decorators.d.ts": libs_lib_decorators_d_ts, + "libs/lib.decorators.legacy.d.ts": libs_lib_decorators_legacy_d_ts, + "libs/lib.dom.asynciterable.d.ts": libs_lib_dom_asynciterable_d_ts, + "libs/lib.dom.d.ts": libs_lib_dom_d_ts, + "libs/lib.dom.iterable.d.ts": libs_lib_dom_iterable_d_ts, + "libs/lib.es2015.collection.d.ts": libs_lib_es2015_collection_d_ts, + "libs/lib.es2015.core.d.ts": libs_lib_es2015_core_d_ts, + "libs/lib.es2015.d.ts": libs_lib_es2015_d_ts, + "libs/lib.es2015.generator.d.ts": libs_lib_es2015_generator_d_ts, + "libs/lib.es2015.iterable.d.ts": libs_lib_es2015_iterable_d_ts, + "libs/lib.es2015.promise.d.ts": libs_lib_es2015_promise_d_ts, + "libs/lib.es2015.proxy.d.ts": libs_lib_es2015_proxy_d_ts, + "libs/lib.es2015.reflect.d.ts": libs_lib_es2015_reflect_d_ts, + "libs/lib.es2015.symbol.d.ts": libs_lib_es2015_symbol_d_ts, + "libs/lib.es2015.symbol.wellknown.d.ts": libs_lib_es2015_symbol_wellknown_d_ts, + "libs/lib.es2016.array.include.d.ts": libs_lib_es2016_array_include_d_ts, + "libs/lib.es2016.d.ts": libs_lib_es2016_d_ts, + "libs/lib.es2016.full.d.ts": libs_lib_es2016_full_d_ts, + "libs/lib.es2016.intl.d.ts": libs_lib_es2016_intl_d_ts, + "libs/lib.es2017.arraybuffer.d.ts": libs_lib_es2017_arraybuffer_d_ts, + "libs/lib.es2017.d.ts": libs_lib_es2017_d_ts, + "libs/lib.es2017.date.d.ts": libs_lib_es2017_date_d_ts, + "libs/lib.es2017.full.d.ts": libs_lib_es2017_full_d_ts, + "libs/lib.es2017.intl.d.ts": libs_lib_es2017_intl_d_ts, + "libs/lib.es2017.object.d.ts": libs_lib_es2017_object_d_ts, + "libs/lib.es2017.sharedmemory.d.ts": libs_lib_es2017_sharedmemory_d_ts, + "libs/lib.es2017.string.d.ts": libs_lib_es2017_string_d_ts, + "libs/lib.es2017.typedarrays.d.ts": libs_lib_es2017_typedarrays_d_ts, + "libs/lib.es2018.asyncgenerator.d.ts": libs_lib_es2018_asyncgenerator_d_ts, + "libs/lib.es2018.asynciterable.d.ts": libs_lib_es2018_asynciterable_d_ts, + "libs/lib.es2018.d.ts": libs_lib_es2018_d_ts, + "libs/lib.es2018.full.d.ts": libs_lib_es2018_full_d_ts, + "libs/lib.es2018.intl.d.ts": libs_lib_es2018_intl_d_ts, + "libs/lib.es2018.promise.d.ts": libs_lib_es2018_promise_d_ts, + "libs/lib.es2018.regexp.d.ts": libs_lib_es2018_regexp_d_ts, + "libs/lib.es2019.array.d.ts": libs_lib_es2019_array_d_ts, + "libs/lib.es2019.d.ts": libs_lib_es2019_d_ts, + "libs/lib.es2019.full.d.ts": libs_lib_es2019_full_d_ts, + "libs/lib.es2019.intl.d.ts": libs_lib_es2019_intl_d_ts, + "libs/lib.es2019.object.d.ts": libs_lib_es2019_object_d_ts, + "libs/lib.es2019.string.d.ts": libs_lib_es2019_string_d_ts, + "libs/lib.es2019.symbol.d.ts": libs_lib_es2019_symbol_d_ts, + "libs/lib.es2020.bigint.d.ts": libs_lib_es2020_bigint_d_ts, + "libs/lib.es2020.d.ts": libs_lib_es2020_d_ts, + "libs/lib.es2020.date.d.ts": libs_lib_es2020_date_d_ts, + "libs/lib.es2020.full.d.ts": libs_lib_es2020_full_d_ts, + "libs/lib.es2020.intl.d.ts": libs_lib_es2020_intl_d_ts, + "libs/lib.es2020.number.d.ts": libs_lib_es2020_number_d_ts, + "libs/lib.es2020.promise.d.ts": libs_lib_es2020_promise_d_ts, + "libs/lib.es2020.sharedmemory.d.ts": libs_lib_es2020_sharedmemory_d_ts, + "libs/lib.es2020.string.d.ts": libs_lib_es2020_string_d_ts, + "libs/lib.es2020.symbol.wellknown.d.ts": libs_lib_es2020_symbol_wellknown_d_ts, + "libs/lib.es2021.d.ts": libs_lib_es2021_d_ts, + "libs/lib.es2021.full.d.ts": libs_lib_es2021_full_d_ts, + "libs/lib.es2021.intl.d.ts": libs_lib_es2021_intl_d_ts, + "libs/lib.es2021.promise.d.ts": libs_lib_es2021_promise_d_ts, + "libs/lib.es2021.string.d.ts": libs_lib_es2021_string_d_ts, + "libs/lib.es2021.weakref.d.ts": libs_lib_es2021_weakref_d_ts, + "libs/lib.es2022.array.d.ts": libs_lib_es2022_array_d_ts, + "libs/lib.es2022.d.ts": libs_lib_es2022_d_ts, + "libs/lib.es2022.error.d.ts": libs_lib_es2022_error_d_ts, + "libs/lib.es2022.full.d.ts": libs_lib_es2022_full_d_ts, + "libs/lib.es2022.intl.d.ts": libs_lib_es2022_intl_d_ts, + "libs/lib.es2022.object.d.ts": libs_lib_es2022_object_d_ts, + "libs/lib.es2022.regexp.d.ts": libs_lib_es2022_regexp_d_ts, + "libs/lib.es2022.string.d.ts": libs_lib_es2022_string_d_ts, + "libs/lib.es2023.array.d.ts": libs_lib_es2023_array_d_ts, + "libs/lib.es2023.collection.d.ts": libs_lib_es2023_collection_d_ts, + "libs/lib.es2023.d.ts": libs_lib_es2023_d_ts, + "libs/lib.es2023.full.d.ts": libs_lib_es2023_full_d_ts, + "libs/lib.es2023.intl.d.ts": libs_lib_es2023_intl_d_ts, + "libs/lib.es2024.arraybuffer.d.ts": libs_lib_es2024_arraybuffer_d_ts, + "libs/lib.es2024.collection.d.ts": libs_lib_es2024_collection_d_ts, + "libs/lib.es2024.d.ts": libs_lib_es2024_d_ts, + "libs/lib.es2024.full.d.ts": libs_lib_es2024_full_d_ts, + "libs/lib.es2024.object.d.ts": libs_lib_es2024_object_d_ts, + "libs/lib.es2024.promise.d.ts": libs_lib_es2024_promise_d_ts, + "libs/lib.es2024.regexp.d.ts": libs_lib_es2024_regexp_d_ts, + "libs/lib.es2024.sharedmemory.d.ts": libs_lib_es2024_sharedmemory_d_ts, + "libs/lib.es2024.string.d.ts": libs_lib_es2024_string_d_ts, + "libs/lib.es5.d.ts": libs_lib_es5_d_ts, + "libs/lib.es6.d.ts": libs_lib_es6_d_ts, + "libs/lib.esnext.array.d.ts": libs_lib_esnext_array_d_ts, + "libs/lib.esnext.collection.d.ts": libs_lib_esnext_collection_d_ts, + "libs/lib.esnext.d.ts": libs_lib_esnext_d_ts, + "libs/lib.esnext.decorators.d.ts": libs_lib_esnext_decorators_d_ts, + "libs/lib.esnext.disposable.d.ts": libs_lib_esnext_disposable_d_ts, + "libs/lib.esnext.error.d.ts": libs_lib_esnext_error_d_ts, + "libs/lib.esnext.float16.d.ts": libs_lib_esnext_float16_d_ts, + "libs/lib.esnext.full.d.ts": libs_lib_esnext_full_d_ts, + "libs/lib.esnext.intl.d.ts": libs_lib_esnext_intl_d_ts, + "libs/lib.esnext.iterator.d.ts": libs_lib_esnext_iterator_d_ts, + "libs/lib.esnext.promise.d.ts": libs_lib_esnext_promise_d_ts, + "libs/lib.esnext.sharedmemory.d.ts": libs_lib_esnext_sharedmemory_d_ts, + "libs/lib.scripthost.d.ts": libs_lib_scripthost_d_ts, + "libs/lib.webworker.asynciterable.d.ts": libs_lib_webworker_asynciterable_d_ts, + "libs/lib.webworker.d.ts": libs_lib_webworker_d_ts, + "libs/lib.webworker.importscripts.d.ts": libs_lib_webworker_importscripts_d_ts, + "libs/lib.webworker.iterable.d.ts": libs_lib_webworker_iterable_d_ts, +} + +var libsEntries = []fs.DirEntry{ + &fileInfo{name: "lib.d.ts", size: int64(len(libs_lib_d_ts))}, + &fileInfo{name: "lib.decorators.d.ts", size: int64(len(libs_lib_decorators_d_ts))}, + &fileInfo{name: "lib.decorators.legacy.d.ts", size: int64(len(libs_lib_decorators_legacy_d_ts))}, + &fileInfo{name: "lib.dom.asynciterable.d.ts", size: int64(len(libs_lib_dom_asynciterable_d_ts))}, + &fileInfo{name: "lib.dom.d.ts", size: int64(len(libs_lib_dom_d_ts))}, + &fileInfo{name: "lib.dom.iterable.d.ts", size: int64(len(libs_lib_dom_iterable_d_ts))}, + &fileInfo{name: "lib.es2015.collection.d.ts", size: int64(len(libs_lib_es2015_collection_d_ts))}, + &fileInfo{name: "lib.es2015.core.d.ts", size: int64(len(libs_lib_es2015_core_d_ts))}, + &fileInfo{name: "lib.es2015.d.ts", size: int64(len(libs_lib_es2015_d_ts))}, + &fileInfo{name: "lib.es2015.generator.d.ts", size: int64(len(libs_lib_es2015_generator_d_ts))}, + &fileInfo{name: "lib.es2015.iterable.d.ts", size: int64(len(libs_lib_es2015_iterable_d_ts))}, + &fileInfo{name: "lib.es2015.promise.d.ts", size: int64(len(libs_lib_es2015_promise_d_ts))}, + &fileInfo{name: "lib.es2015.proxy.d.ts", size: int64(len(libs_lib_es2015_proxy_d_ts))}, + &fileInfo{name: "lib.es2015.reflect.d.ts", size: int64(len(libs_lib_es2015_reflect_d_ts))}, + &fileInfo{name: "lib.es2015.symbol.d.ts", size: int64(len(libs_lib_es2015_symbol_d_ts))}, + &fileInfo{name: "lib.es2015.symbol.wellknown.d.ts", size: int64(len(libs_lib_es2015_symbol_wellknown_d_ts))}, + &fileInfo{name: "lib.es2016.array.include.d.ts", size: int64(len(libs_lib_es2016_array_include_d_ts))}, + &fileInfo{name: "lib.es2016.d.ts", size: int64(len(libs_lib_es2016_d_ts))}, + &fileInfo{name: "lib.es2016.full.d.ts", size: int64(len(libs_lib_es2016_full_d_ts))}, + &fileInfo{name: "lib.es2016.intl.d.ts", size: int64(len(libs_lib_es2016_intl_d_ts))}, + &fileInfo{name: "lib.es2017.arraybuffer.d.ts", size: int64(len(libs_lib_es2017_arraybuffer_d_ts))}, + &fileInfo{name: "lib.es2017.d.ts", size: int64(len(libs_lib_es2017_d_ts))}, + &fileInfo{name: "lib.es2017.date.d.ts", size: int64(len(libs_lib_es2017_date_d_ts))}, + &fileInfo{name: "lib.es2017.full.d.ts", size: int64(len(libs_lib_es2017_full_d_ts))}, + &fileInfo{name: "lib.es2017.intl.d.ts", size: int64(len(libs_lib_es2017_intl_d_ts))}, + &fileInfo{name: "lib.es2017.object.d.ts", size: int64(len(libs_lib_es2017_object_d_ts))}, + &fileInfo{name: "lib.es2017.sharedmemory.d.ts", size: int64(len(libs_lib_es2017_sharedmemory_d_ts))}, + &fileInfo{name: "lib.es2017.string.d.ts", size: int64(len(libs_lib_es2017_string_d_ts))}, + &fileInfo{name: "lib.es2017.typedarrays.d.ts", size: int64(len(libs_lib_es2017_typedarrays_d_ts))}, + &fileInfo{name: "lib.es2018.asyncgenerator.d.ts", size: int64(len(libs_lib_es2018_asyncgenerator_d_ts))}, + &fileInfo{name: "lib.es2018.asynciterable.d.ts", size: int64(len(libs_lib_es2018_asynciterable_d_ts))}, + &fileInfo{name: "lib.es2018.d.ts", size: int64(len(libs_lib_es2018_d_ts))}, + &fileInfo{name: "lib.es2018.full.d.ts", size: int64(len(libs_lib_es2018_full_d_ts))}, + &fileInfo{name: "lib.es2018.intl.d.ts", size: int64(len(libs_lib_es2018_intl_d_ts))}, + &fileInfo{name: "lib.es2018.promise.d.ts", size: int64(len(libs_lib_es2018_promise_d_ts))}, + &fileInfo{name: "lib.es2018.regexp.d.ts", size: int64(len(libs_lib_es2018_regexp_d_ts))}, + &fileInfo{name: "lib.es2019.array.d.ts", size: int64(len(libs_lib_es2019_array_d_ts))}, + &fileInfo{name: "lib.es2019.d.ts", size: int64(len(libs_lib_es2019_d_ts))}, + &fileInfo{name: "lib.es2019.full.d.ts", size: int64(len(libs_lib_es2019_full_d_ts))}, + &fileInfo{name: "lib.es2019.intl.d.ts", size: int64(len(libs_lib_es2019_intl_d_ts))}, + &fileInfo{name: "lib.es2019.object.d.ts", size: int64(len(libs_lib_es2019_object_d_ts))}, + &fileInfo{name: "lib.es2019.string.d.ts", size: int64(len(libs_lib_es2019_string_d_ts))}, + &fileInfo{name: "lib.es2019.symbol.d.ts", size: int64(len(libs_lib_es2019_symbol_d_ts))}, + &fileInfo{name: "lib.es2020.bigint.d.ts", size: int64(len(libs_lib_es2020_bigint_d_ts))}, + &fileInfo{name: "lib.es2020.d.ts", size: int64(len(libs_lib_es2020_d_ts))}, + &fileInfo{name: "lib.es2020.date.d.ts", size: int64(len(libs_lib_es2020_date_d_ts))}, + &fileInfo{name: "lib.es2020.full.d.ts", size: int64(len(libs_lib_es2020_full_d_ts))}, + &fileInfo{name: "lib.es2020.intl.d.ts", size: int64(len(libs_lib_es2020_intl_d_ts))}, + &fileInfo{name: "lib.es2020.number.d.ts", size: int64(len(libs_lib_es2020_number_d_ts))}, + &fileInfo{name: "lib.es2020.promise.d.ts", size: int64(len(libs_lib_es2020_promise_d_ts))}, + &fileInfo{name: "lib.es2020.sharedmemory.d.ts", size: int64(len(libs_lib_es2020_sharedmemory_d_ts))}, + &fileInfo{name: "lib.es2020.string.d.ts", size: int64(len(libs_lib_es2020_string_d_ts))}, + &fileInfo{name: "lib.es2020.symbol.wellknown.d.ts", size: int64(len(libs_lib_es2020_symbol_wellknown_d_ts))}, + &fileInfo{name: "lib.es2021.d.ts", size: int64(len(libs_lib_es2021_d_ts))}, + &fileInfo{name: "lib.es2021.full.d.ts", size: int64(len(libs_lib_es2021_full_d_ts))}, + &fileInfo{name: "lib.es2021.intl.d.ts", size: int64(len(libs_lib_es2021_intl_d_ts))}, + &fileInfo{name: "lib.es2021.promise.d.ts", size: int64(len(libs_lib_es2021_promise_d_ts))}, + &fileInfo{name: "lib.es2021.string.d.ts", size: int64(len(libs_lib_es2021_string_d_ts))}, + &fileInfo{name: "lib.es2021.weakref.d.ts", size: int64(len(libs_lib_es2021_weakref_d_ts))}, + &fileInfo{name: "lib.es2022.array.d.ts", size: int64(len(libs_lib_es2022_array_d_ts))}, + &fileInfo{name: "lib.es2022.d.ts", size: int64(len(libs_lib_es2022_d_ts))}, + &fileInfo{name: "lib.es2022.error.d.ts", size: int64(len(libs_lib_es2022_error_d_ts))}, + &fileInfo{name: "lib.es2022.full.d.ts", size: int64(len(libs_lib_es2022_full_d_ts))}, + &fileInfo{name: "lib.es2022.intl.d.ts", size: int64(len(libs_lib_es2022_intl_d_ts))}, + &fileInfo{name: "lib.es2022.object.d.ts", size: int64(len(libs_lib_es2022_object_d_ts))}, + &fileInfo{name: "lib.es2022.regexp.d.ts", size: int64(len(libs_lib_es2022_regexp_d_ts))}, + &fileInfo{name: "lib.es2022.string.d.ts", size: int64(len(libs_lib_es2022_string_d_ts))}, + &fileInfo{name: "lib.es2023.array.d.ts", size: int64(len(libs_lib_es2023_array_d_ts))}, + &fileInfo{name: "lib.es2023.collection.d.ts", size: int64(len(libs_lib_es2023_collection_d_ts))}, + &fileInfo{name: "lib.es2023.d.ts", size: int64(len(libs_lib_es2023_d_ts))}, + &fileInfo{name: "lib.es2023.full.d.ts", size: int64(len(libs_lib_es2023_full_d_ts))}, + &fileInfo{name: "lib.es2023.intl.d.ts", size: int64(len(libs_lib_es2023_intl_d_ts))}, + &fileInfo{name: "lib.es2024.arraybuffer.d.ts", size: int64(len(libs_lib_es2024_arraybuffer_d_ts))}, + &fileInfo{name: "lib.es2024.collection.d.ts", size: int64(len(libs_lib_es2024_collection_d_ts))}, + &fileInfo{name: "lib.es2024.d.ts", size: int64(len(libs_lib_es2024_d_ts))}, + &fileInfo{name: "lib.es2024.full.d.ts", size: int64(len(libs_lib_es2024_full_d_ts))}, + &fileInfo{name: "lib.es2024.object.d.ts", size: int64(len(libs_lib_es2024_object_d_ts))}, + &fileInfo{name: "lib.es2024.promise.d.ts", size: int64(len(libs_lib_es2024_promise_d_ts))}, + &fileInfo{name: "lib.es2024.regexp.d.ts", size: int64(len(libs_lib_es2024_regexp_d_ts))}, + &fileInfo{name: "lib.es2024.sharedmemory.d.ts", size: int64(len(libs_lib_es2024_sharedmemory_d_ts))}, + &fileInfo{name: "lib.es2024.string.d.ts", size: int64(len(libs_lib_es2024_string_d_ts))}, + &fileInfo{name: "lib.es5.d.ts", size: int64(len(libs_lib_es5_d_ts))}, + &fileInfo{name: "lib.es6.d.ts", size: int64(len(libs_lib_es6_d_ts))}, + &fileInfo{name: "lib.esnext.array.d.ts", size: int64(len(libs_lib_esnext_array_d_ts))}, + &fileInfo{name: "lib.esnext.collection.d.ts", size: int64(len(libs_lib_esnext_collection_d_ts))}, + &fileInfo{name: "lib.esnext.d.ts", size: int64(len(libs_lib_esnext_d_ts))}, + &fileInfo{name: "lib.esnext.decorators.d.ts", size: int64(len(libs_lib_esnext_decorators_d_ts))}, + &fileInfo{name: "lib.esnext.disposable.d.ts", size: int64(len(libs_lib_esnext_disposable_d_ts))}, + &fileInfo{name: "lib.esnext.error.d.ts", size: int64(len(libs_lib_esnext_error_d_ts))}, + &fileInfo{name: "lib.esnext.float16.d.ts", size: int64(len(libs_lib_esnext_float16_d_ts))}, + &fileInfo{name: "lib.esnext.full.d.ts", size: int64(len(libs_lib_esnext_full_d_ts))}, + &fileInfo{name: "lib.esnext.intl.d.ts", size: int64(len(libs_lib_esnext_intl_d_ts))}, + &fileInfo{name: "lib.esnext.iterator.d.ts", size: int64(len(libs_lib_esnext_iterator_d_ts))}, + &fileInfo{name: "lib.esnext.promise.d.ts", size: int64(len(libs_lib_esnext_promise_d_ts))}, + &fileInfo{name: "lib.esnext.sharedmemory.d.ts", size: int64(len(libs_lib_esnext_sharedmemory_d_ts))}, + &fileInfo{name: "lib.scripthost.d.ts", size: int64(len(libs_lib_scripthost_d_ts))}, + &fileInfo{name: "lib.webworker.asynciterable.d.ts", size: int64(len(libs_lib_webworker_asynciterable_d_ts))}, + &fileInfo{name: "lib.webworker.d.ts", size: int64(len(libs_lib_webworker_d_ts))}, + &fileInfo{name: "lib.webworker.importscripts.d.ts", size: int64(len(libs_lib_webworker_importscripts_d_ts))}, + &fileInfo{name: "lib.webworker.iterable.d.ts", size: int64(len(libs_lib_webworker_iterable_d_ts))}, +} diff --git a/kitcom/internal/tsgo/bundled/generate.go b/kitcom/internal/tsgo/bundled/generate.go new file mode 100644 index 0000000..9d9ee5b --- /dev/null +++ b/kitcom/internal/tsgo/bundled/generate.go @@ -0,0 +1,228 @@ +//go:build ignore + +package main + +import ( + "bytes" + "fmt" + "go/format" + "log" + "os" + "path/filepath" + "slices" + "strings" + + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/ast" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/core" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/parser" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/repo" + "efprojects.com/kitten-ipc/kitcom/internal/tsgo/tspath" +) + +var ( + libInputDir = filepath.Join(repo.TypeScriptSubmodulePath, "src", "lib") + copyrightNotice = filepath.Join(repo.TypeScriptSubmodulePath, "scripts", "CopyrightNotice.txt") +) + +func main() { + log.SetFlags(log.LstdFlags | log.Lshortfile) + + libs := readLibs() + generateLibs(libs) + generateLibList(libs) + generateEmbedded(libs) +} + +type lib struct { + target string // target relative to libs dir + sources []string // sources relative to src/lib dir +} + +func generateLibs(libs []lib) { + const outputDir = "libs" + + copyright := readCopyright() + + if err := os.RemoveAll(outputDir); err != nil { + log.Fatalf("failed to remove libs directory: %v", err) + } + + if err := os.MkdirAll(outputDir, 0o755); err != nil { + log.Fatalf("failed to create libs directory: %v", err) + } + + for _, lib := range libs { + var output bytes.Buffer + output.Write(copyright) + + for _, source := range lib.sources { + sourcePath := filepath.Join(libInputDir, source) + b, err := os.ReadFile(sourcePath) + if err != nil { + log.Fatalf("failed to read %s: %v", sourcePath, err) + } + + output.WriteByte('\n') + output.Write(removeCRLF(b)) + } + + outputPath := filepath.Join(outputDir, lib.target) + if err := os.WriteFile(outputPath, output.Bytes(), 0o644); err != nil { + log.Fatalf("failed to write %s: %v", outputPath, err) + } + } +} + +func generateLibList(libs []lib) { + var code bytes.Buffer + code.WriteString("// Code generated by generate.go; DO NOT EDIT.\n\n") + code.WriteString("package bundled\n\n") + + code.WriteString("// LibNames is the list of all bundled lib files, sorted by name.\n") + code.WriteString("// For the list of libs sorted by load order, use [tsoptions.Libs].\n") + code.WriteString("var LibNames = []string{\n") + for _, lib := range libs { + code.WriteString("\t\"" + lib.target + "\",\n") + } + code.WriteString("}\n") + + writeCode("libs_generated.go", code.Bytes()) +} + +func generateEmbedded(libs []lib) { + libVarNames := make([]string, len(libs)) + for i, lib := range libs { + libVarNames[i] = "libs_" + strings.ReplaceAll(lib.target, ".", "_") + } + + var code bytes.Buffer + code.WriteString("//go:build !noembed\n\n") + code.WriteString("// Code generated by generate.go; DO NOT EDIT.\n\n") + code.WriteString("package bundled\n\n") + code.WriteString("import (\n") + code.WriteString("\"io/fs\"\n\n") + code.WriteString("_ \"embed\"\n") + code.WriteString(")\n\n") + + code.WriteString("var (\n") + for i, lib := range libs { + varName := libVarNames[i] + code.WriteString("//go:embed libs/" + lib.target + "\n") + code.WriteString("" + varName + " string\n") + } + code.WriteString(")\n\n") + + code.WriteString("var embeddedContents = map[string]string{\n") + for i, lib := range libs { + varName := libVarNames[i] + code.WriteString("\t\"libs/" + lib.target + "\": " + varName + ",\n") + } + code.WriteString("}\n\n") + + code.WriteString("var libsEntries = []fs.DirEntry{\n") + for i, lib := range libs { + varName := libVarNames[i] + fmt.Fprintf(&code, "\t&fileInfo{name: %q, size: int64(len(%s))},\n", lib.target, varName) + } + code.WriteString("}\n") + + writeCode("embed_generated.go", code.Bytes()) +} + +func readLibs() []lib { + type libsMeta struct { + libs []string + paths map[string]string + } + + libsFile := tspath.NormalizeSlashes(filepath.Join(libInputDir, "libs.json")) + + b, err := os.ReadFile(libsFile) + if err != nil { + log.Fatalf("failed to open libs.json: %v", err) + } + + sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{ + FileName: libsFile, + Path: tspath.Path(libsFile), + }, string(b), core.ScriptKindJSON) + diags := sourceFile.Diagnostics() + + if len(diags) > 0 { + for _, diag := range diags { + log.Printf("%s", diag.Message()) + } + log.Fatalf("failed to parse libs.json") + } + + paths := make(map[string]string) + var libNames []string + + props := sourceFile.Statements.Nodes[0]. + AsExpressionStatement(). + Expression. + AsObjectLiteralExpression(). + Properties. + Nodes + + for _, prop := range props { + assign := prop.AsPropertyAssignment() + name := assign.Name().Text() + switch name { + case "libs": + for _, lib := range assign.Initializer.AsArrayLiteralExpression().Elements.Nodes { + libNames = append(libNames, lib.AsStringLiteral().Text) + } + case "paths": + for _, path := range assign.Initializer.AsObjectLiteralExpression().Properties.Nodes { + prop := path.AsPropertyAssignment() + key := prop.Name().Text() + value := prop.Initializer.AsStringLiteral().Text + paths[key] = value + } + default: + log.Fatalf("unexpected property: %s", name) + } + } + + var libs []lib + for _, libName := range libNames { + sources := []string{"header.d.ts", libName + ".d.ts"} + var target string + if path, ok := paths[libName]; ok { + target = path + } else { + target = "lib." + libName + ".d.ts" + } + libs = append(libs, lib{target: target, sources: sources}) + } + + slices.SortFunc(libs, func(a lib, b lib) int { + return strings.Compare(a.target, b.target) + }) + + return libs +} + +func readCopyright() []byte { + b, err := os.ReadFile(copyrightNotice) + if err != nil { + log.Fatalf("failed to read copyright notice: %v", err) + } + return removeCRLF(b) +} + +func removeCRLF(b []byte) []byte { + return bytes.ReplaceAll(b, []byte("\r\n"), []byte("\n")) +} + +func writeCode(filename string, code []byte) { + formatted, err := format.Source(code) + if err != nil { + log.Fatalf("failed to format source: %v", err) + } + + if err := os.WriteFile(filename, formatted, 0o644); err != nil { + log.Fatalf("failed to write %s: %v", filename, err) + } +} diff --git a/kitcom/internal/tsgo/bundled/libs/lib.d.ts b/kitcom/internal/tsgo/bundled/libs/lib.d.ts new file mode 100644 index 0000000..b6bb44b --- /dev/null +++ b/kitcom/internal/tsgo/bundled/libs/lib.d.ts @@ -0,0 +1,22 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + + +/// + +/// +/// +/// +/// diff --git a/kitcom/internal/tsgo/bundled/libs/lib.decorators.d.ts b/kitcom/internal/tsgo/bundled/libs/lib.decorators.d.ts new file mode 100644 index 0000000..5ad7216 --- /dev/null +++ b/kitcom/internal/tsgo/bundled/libs/lib.decorators.d.ts @@ -0,0 +1,384 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + + +/// + +/** + * The decorator context types provided to class element decorators. + */ +type ClassMemberDecoratorContext = + | ClassMethodDecoratorContext + | ClassGetterDecoratorContext + | ClassSetterDecoratorContext + | ClassFieldDecoratorContext + | ClassAccessorDecoratorContext; + +/** + * The decorator context types provided to any decorator. + */ +type DecoratorContext = + | ClassDecoratorContext + | ClassMemberDecoratorContext; + +type DecoratorMetadataObject = Record & object; + +type DecoratorMetadata = typeof globalThis extends { Symbol: { readonly metadata: symbol; }; } ? DecoratorMetadataObject : DecoratorMetadataObject | undefined; + +/** + * Context provided to a class decorator. + * @template Class The type of the decorated class associated with this context. + */ +interface ClassDecoratorContext< + Class extends abstract new (...args: any) => any = abstract new (...args: any) => any, +> { + /** The kind of element that was decorated. */ + readonly kind: "class"; + + /** The name of the decorated class. */ + readonly name: string | undefined; + + /** + * Adds a callback to be invoked after the class definition has been finalized. + * + * @example + * ```ts + * function customElement(name: string): ClassDecoratorFunction { + * return (target, context) => { + * context.addInitializer(function () { + * customElements.define(name, this); + * }); + * } + * } + * + * @customElement("my-element") + * class MyElement {} + * ``` + */ + addInitializer(initializer: (this: Class) => void): void; + + readonly metadata: DecoratorMetadata; +} + +/** + * Context provided to a class method decorator. + * @template This The type on which the class element will be defined. For a static class element, this will be + * the type of the constructor. For a non-static class element, this will be the type of the instance. + * @template Value The type of the decorated class method. + */ +interface ClassMethodDecoratorContext< + This = unknown, + Value extends (this: This, ...args: any) => any = (this: This, ...args: any) => any, +> { + /** The kind of class element that was decorated. */ + readonly kind: "method"; + + /** The name of the decorated class element. */ + readonly name: string | symbol; + + /** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */ + readonly static: boolean; + + /** A value indicating whether the class element has a private name. */ + readonly private: boolean; + + /** An object that can be used to access the current value of the class element at runtime. */ + readonly access: { + /** + * Determines whether an object has a property with the same name as the decorated element. + */ + has(object: This): boolean; + /** + * Gets the current value of the method from the provided object. + * + * @example + * let fn = context.access.get(instance); + */ + get(object: This): Value; + }; + + /** + * Adds a callback to be invoked either after static methods are defined but before + * static initializers are run (when decorating a `static` element), or before instance + * initializers are run (when decorating a non-`static` element). + * + * @example + * ```ts + * const bound: ClassMethodDecoratorFunction = (value, context) { + * if (context.private) throw new TypeError("Not supported on private methods."); + * context.addInitializer(function () { + * this[context.name] = this[context.name].bind(this); + * }); + * } + * + * class C { + * message = "Hello"; + * + * @bound + * m() { + * console.log(this.message); + * } + * } + * ``` + */ + addInitializer(initializer: (this: This) => void): void; + + readonly metadata: DecoratorMetadata; +} + +/** + * Context provided to a class getter decorator. + * @template This The type on which the class element will be defined. For a static class element, this will be + * the type of the constructor. For a non-static class element, this will be the type of the instance. + * @template Value The property type of the decorated class getter. + */ +interface ClassGetterDecoratorContext< + This = unknown, + Value = unknown, +> { + /** The kind of class element that was decorated. */ + readonly kind: "getter"; + + /** The name of the decorated class element. */ + readonly name: string | symbol; + + /** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */ + readonly static: boolean; + + /** A value indicating whether the class element has a private name. */ + readonly private: boolean; + + /** An object that can be used to access the current value of the class element at runtime. */ + readonly access: { + /** + * Determines whether an object has a property with the same name as the decorated element. + */ + has(object: This): boolean; + /** + * Invokes the getter on the provided object. + * + * @example + * let value = context.access.get(instance); + */ + get(object: This): Value; + }; + + /** + * Adds a callback to be invoked either after static methods are defined but before + * static initializers are run (when decorating a `static` element), or before instance + * initializers are run (when decorating a non-`static` element). + */ + addInitializer(initializer: (this: This) => void): void; + + readonly metadata: DecoratorMetadata; +} + +/** + * Context provided to a class setter decorator. + * @template This The type on which the class element will be defined. For a static class element, this will be + * the type of the constructor. For a non-static class element, this will be the type of the instance. + * @template Value The type of the decorated class setter. + */ +interface ClassSetterDecoratorContext< + This = unknown, + Value = unknown, +> { + /** The kind of class element that was decorated. */ + readonly kind: "setter"; + + /** The name of the decorated class element. */ + readonly name: string | symbol; + + /** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */ + readonly static: boolean; + + /** A value indicating whether the class element has a private name. */ + readonly private: boolean; + + /** An object that can be used to access the current value of the class element at runtime. */ + readonly access: { + /** + * Determines whether an object has a property with the same name as the decorated element. + */ + has(object: This): boolean; + /** + * Invokes the setter on the provided object. + * + * @example + * context.access.set(instance, value); + */ + set(object: This, value: Value): void; + }; + + /** + * Adds a callback to be invoked either after static methods are defined but before + * static initializers are run (when decorating a `static` element), or before instance + * initializers are run (when decorating a non-`static` element). + */ + addInitializer(initializer: (this: This) => void): void; + + readonly metadata: DecoratorMetadata; +} + +/** + * Context provided to a class `accessor` field decorator. + * @template This The type on which the class element will be defined. For a static class element, this will be + * the type of the constructor. For a non-static class element, this will be the type of the instance. + * @template Value The type of decorated class field. + */ +interface ClassAccessorDecoratorContext< + This = unknown, + Value = unknown, +> { + /** The kind of class element that was decorated. */ + readonly kind: "accessor"; + + /** The name of the decorated class element. */ + readonly name: string | symbol; + + /** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */ + readonly static: boolean; + + /** A value indicating whether the class element has a private name. */ + readonly private: boolean; + + /** An object that can be used to access the current value of the class element at runtime. */ + readonly access: { + /** + * Determines whether an object has a property with the same name as the decorated element. + */ + has(object: This): boolean; + + /** + * Invokes the getter on the provided object. + * + * @example + * let value = context.access.get(instance); + */ + get(object: This): Value; + + /** + * Invokes the setter on the provided object. + * + * @example + * context.access.set(instance, value); + */ + set(object: This, value: Value): void; + }; + + /** + * Adds a callback to be invoked immediately after the auto `accessor` being + * decorated is initialized (regardless if the `accessor` is `static` or not). + */ + addInitializer(initializer: (this: This) => void): void; + + readonly metadata: DecoratorMetadata; +} + +/** + * Describes the target provided to class `accessor` field decorators. + * @template This The `this` type to which the target applies. + * @template Value The property type for the class `accessor` field. + */ +interface ClassAccessorDecoratorTarget { + /** + * Invokes the getter that was defined prior to decorator application. + * + * @example + * let value = target.get.call(instance); + */ + get(this: This): Value; + + /** + * Invokes the setter that was defined prior to decorator application. + * + * @example + * target.set.call(instance, value); + */ + set(this: This, value: Value): void; +} + +/** + * Describes the allowed return value from a class `accessor` field decorator. + * @template This The `this` type to which the target applies. + * @template Value The property type for the class `accessor` field. + */ +interface ClassAccessorDecoratorResult { + /** + * An optional replacement getter function. If not provided, the existing getter function is used instead. + */ + get?(this: This): Value; + + /** + * An optional replacement setter function. If not provided, the existing setter function is used instead. + */ + set?(this: This, value: Value): void; + + /** + * An optional initializer mutator that is invoked when the underlying field initializer is evaluated. + * @param value The incoming initializer value. + * @returns The replacement initializer value. + */ + init?(this: This, value: Value): Value; +} + +/** + * Context provided to a class field decorator. + * @template This The type on which the class element will be defined. For a static class element, this will be + * the type of the constructor. For a non-static class element, this will be the type of the instance. + * @template Value The type of the decorated class field. + */ +interface ClassFieldDecoratorContext< + This = unknown, + Value = unknown, +> { + /** The kind of class element that was decorated. */ + readonly kind: "field"; + + /** The name of the decorated class element. */ + readonly name: string | symbol; + + /** A value indicating whether the class element is a static (`true`) or instance (`false`) element. */ + readonly static: boolean; + + /** A value indicating whether the class element has a private name. */ + readonly private: boolean; + + /** An object that can be used to access the current value of the class element at runtime. */ + readonly access: { + /** + * Determines whether an object has a property with the same name as the decorated element. + */ + has(object: This): boolean; + + /** + * Gets the value of the field on the provided object. + */ + get(object: This): Value; + + /** + * Sets the value of the field on the provided object. + */ + set(object: This, value: Value): void; + }; + + /** + * Adds a callback to be invoked immediately after the field being decorated + * is initialized (regardless if the field is `static` or not). + */ + addInitializer(initializer: (this: This) => void): void; + + readonly metadata: DecoratorMetadata; +} diff --git a/kitcom/internal/tsgo/bundled/libs/lib.decorators.legacy.d.ts b/kitcom/internal/tsgo/bundled/libs/lib.decorators.legacy.d.ts new file mode 100644 index 0000000..26fbcb5 --- /dev/null +++ b/kitcom/internal/tsgo/bundled/libs/lib.decorators.legacy.d.ts @@ -0,0 +1,22 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + + +/// + +declare type ClassDecorator = (target: TFunction) => TFunction | void; +declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; +declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; +declare type ParameterDecorator = (target: Object, propertyKey: string | symbol | undefined, parameterIndex: number) => void; diff --git a/kitcom/internal/tsgo/bundled/libs/lib.dom.asynciterable.d.ts b/kitcom/internal/tsgo/bundled/libs/lib.dom.asynciterable.d.ts new file mode 100644 index 0000000..98b96b8 --- /dev/null +++ b/kitcom/internal/tsgo/bundled/libs/lib.dom.asynciterable.d.ts @@ -0,0 +1,41 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + + +/// + +///////////////////////////// +/// Window Async Iterable APIs +///////////////////////////// + +interface FileSystemDirectoryHandleAsyncIterator extends AsyncIteratorObject { + [Symbol.asyncIterator](): FileSystemDirectoryHandleAsyncIterator; +} + +interface FileSystemDirectoryHandle { + [Symbol.asyncIterator](): FileSystemDirectoryHandleAsyncIterator<[string, FileSystemHandle]>; + entries(): FileSystemDirectoryHandleAsyncIterator<[string, FileSystemHandle]>; + keys(): FileSystemDirectoryHandleAsyncIterator; + values(): FileSystemDirectoryHandleAsyncIterator; +} + +interface ReadableStreamAsyncIterator extends AsyncIteratorObject { + [Symbol.asyncIterator](): ReadableStreamAsyncIterator; +} + +interface ReadableStream { + [Symbol.asyncIterator](options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator; + values(options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator; +} diff --git a/kitcom/internal/tsgo/bundled/libs/lib.dom.d.ts b/kitcom/internal/tsgo/bundled/libs/lib.dom.d.ts new file mode 100644 index 0000000..14508e8 --- /dev/null +++ b/kitcom/internal/tsgo/bundled/libs/lib.dom.d.ts @@ -0,0 +1,39429 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + + +/// + +///////////////////////////// +/// Window APIs +///////////////////////////// + +interface AddEventListenerOptions extends EventListenerOptions { + once?: boolean; + passive?: boolean; + signal?: AbortSignal; +} + +interface AddressErrors { + addressLine?: string; + city?: string; + country?: string; + dependentLocality?: string; + organization?: string; + phone?: string; + postalCode?: string; + recipient?: string; + region?: string; + sortingCode?: string; +} + +interface AesCbcParams extends Algorithm { + iv: BufferSource; +} + +interface AesCtrParams extends Algorithm { + counter: BufferSource; + length: number; +} + +interface AesDerivedKeyParams extends Algorithm { + length: number; +} + +interface AesGcmParams extends Algorithm { + additionalData?: BufferSource; + iv: BufferSource; + tagLength?: number; +} + +interface AesKeyAlgorithm extends KeyAlgorithm { + length: number; +} + +interface AesKeyGenParams extends Algorithm { + length: number; +} + +interface Algorithm { + name: string; +} + +interface AnalyserOptions extends AudioNodeOptions { + fftSize?: number; + maxDecibels?: number; + minDecibels?: number; + smoothingTimeConstant?: number; +} + +interface AnimationEventInit extends EventInit { + animationName?: string; + elapsedTime?: number; + pseudoElement?: string; +} + +interface AnimationPlaybackEventInit extends EventInit { + currentTime?: CSSNumberish | null; + timelineTime?: CSSNumberish | null; +} + +interface AssignedNodesOptions { + flatten?: boolean; +} + +interface AudioBufferOptions { + length: number; + numberOfChannels?: number; + sampleRate: number; +} + +interface AudioBufferSourceOptions { + buffer?: AudioBuffer | null; + detune?: number; + loop?: boolean; + loopEnd?: number; + loopStart?: number; + playbackRate?: number; +} + +interface AudioConfiguration { + bitrate?: number; + channels?: string; + contentType: string; + samplerate?: number; + spatialRendering?: boolean; +} + +interface AudioContextOptions { + latencyHint?: AudioContextLatencyCategory | number; + sampleRate?: number; +} + +interface AudioDataCopyToOptions { + format?: AudioSampleFormat; + frameCount?: number; + frameOffset?: number; + planeIndex: number; +} + +interface AudioDataInit { + data: BufferSource; + format: AudioSampleFormat; + numberOfChannels: number; + numberOfFrames: number; + sampleRate: number; + timestamp: number; + transfer?: ArrayBuffer[]; +} + +interface AudioDecoderConfig { + codec: string; + description?: AllowSharedBufferSource; + numberOfChannels: number; + sampleRate: number; +} + +interface AudioDecoderInit { + error: WebCodecsErrorCallback; + output: AudioDataOutputCallback; +} + +interface AudioDecoderSupport { + config?: AudioDecoderConfig; + supported?: boolean; +} + +interface AudioEncoderConfig { + bitrate?: number; + bitrateMode?: BitrateMode; + codec: string; + numberOfChannels: number; + opus?: OpusEncoderConfig; + sampleRate: number; +} + +interface AudioEncoderInit { + error: WebCodecsErrorCallback; + output: EncodedAudioChunkOutputCallback; +} + +interface AudioEncoderSupport { + config?: AudioEncoderConfig; + supported?: boolean; +} + +interface AudioNodeOptions { + channelCount?: number; + channelCountMode?: ChannelCountMode; + channelInterpretation?: ChannelInterpretation; +} + +interface AudioProcessingEventInit extends EventInit { + inputBuffer: AudioBuffer; + outputBuffer: AudioBuffer; + playbackTime: number; +} + +interface AudioTimestamp { + contextTime?: number; + performanceTime?: DOMHighResTimeStamp; +} + +interface AudioWorkletNodeOptions extends AudioNodeOptions { + numberOfInputs?: number; + numberOfOutputs?: number; + outputChannelCount?: number[]; + parameterData?: Record; + processorOptions?: any; +} + +interface AuthenticationExtensionsClientInputs { + appid?: string; + credProps?: boolean; + credentialProtectionPolicy?: string; + enforceCredentialProtectionPolicy?: boolean; + hmacCreateSecret?: boolean; + largeBlob?: AuthenticationExtensionsLargeBlobInputs; + minPinLength?: boolean; + prf?: AuthenticationExtensionsPRFInputs; +} + +interface AuthenticationExtensionsClientInputsJSON { + appid?: string; + credProps?: boolean; + largeBlob?: AuthenticationExtensionsLargeBlobInputsJSON; + prf?: AuthenticationExtensionsPRFInputsJSON; +} + +interface AuthenticationExtensionsClientOutputs { + appid?: boolean; + credProps?: CredentialPropertiesOutput; + hmacCreateSecret?: boolean; + largeBlob?: AuthenticationExtensionsLargeBlobOutputs; + prf?: AuthenticationExtensionsPRFOutputs; +} + +interface AuthenticationExtensionsLargeBlobInputs { + read?: boolean; + support?: string; + write?: BufferSource; +} + +interface AuthenticationExtensionsLargeBlobInputsJSON { + read?: boolean; + support?: string; + write?: Base64URLString; +} + +interface AuthenticationExtensionsLargeBlobOutputs { + blob?: ArrayBuffer; + supported?: boolean; + written?: boolean; +} + +interface AuthenticationExtensionsPRFInputs { + eval?: AuthenticationExtensionsPRFValues; + evalByCredential?: Record; +} + +interface AuthenticationExtensionsPRFInputsJSON { + eval?: AuthenticationExtensionsPRFValuesJSON; + evalByCredential?: Record; +} + +interface AuthenticationExtensionsPRFOutputs { + enabled?: boolean; + results?: AuthenticationExtensionsPRFValues; +} + +interface AuthenticationExtensionsPRFValues { + first: BufferSource; + second?: BufferSource; +} + +interface AuthenticationExtensionsPRFValuesJSON { + first: Base64URLString; + second?: Base64URLString; +} + +interface AuthenticatorSelectionCriteria { + authenticatorAttachment?: AuthenticatorAttachment; + requireResidentKey?: boolean; + residentKey?: ResidentKeyRequirement; + userVerification?: UserVerificationRequirement; +} + +interface AvcEncoderConfig { + format?: AvcBitstreamFormat; +} + +interface BiquadFilterOptions extends AudioNodeOptions { + Q?: number; + detune?: number; + frequency?: number; + gain?: number; + type?: BiquadFilterType; +} + +interface BlobEventInit extends EventInit { + data: Blob; + timecode?: DOMHighResTimeStamp; +} + +interface BlobPropertyBag { + endings?: EndingType; + type?: string; +} + +interface CSSMatrixComponentOptions { + is2D?: boolean; +} + +interface CSSNumericType { + angle?: number; + flex?: number; + frequency?: number; + length?: number; + percent?: number; + percentHint?: CSSNumericBaseType; + resolution?: number; + time?: number; +} + +interface CSSStyleSheetInit { + baseURL?: string; + disabled?: boolean; + media?: MediaList | string; +} + +interface CacheQueryOptions { + ignoreMethod?: boolean; + ignoreSearch?: boolean; + ignoreVary?: boolean; +} + +interface CanvasRenderingContext2DSettings { + alpha?: boolean; + colorSpace?: PredefinedColorSpace; + desynchronized?: boolean; + willReadFrequently?: boolean; +} + +interface CaretPositionFromPointOptions { + shadowRoots?: ShadowRoot[]; +} + +interface ChannelMergerOptions extends AudioNodeOptions { + numberOfInputs?: number; +} + +interface ChannelSplitterOptions extends AudioNodeOptions { + numberOfOutputs?: number; +} + +interface CheckVisibilityOptions { + checkOpacity?: boolean; + checkVisibilityCSS?: boolean; + contentVisibilityAuto?: boolean; + opacityProperty?: boolean; + visibilityProperty?: boolean; +} + +interface ClientQueryOptions { + includeUncontrolled?: boolean; + type?: ClientTypes; +} + +interface ClipboardEventInit extends EventInit { + clipboardData?: DataTransfer | null; +} + +interface ClipboardItemOptions { + presentationStyle?: PresentationStyle; +} + +interface CloseEventInit extends EventInit { + code?: number; + reason?: string; + wasClean?: boolean; +} + +interface CompositionEventInit extends UIEventInit { + data?: string; +} + +interface ComputedEffectTiming extends EffectTiming { + activeDuration?: CSSNumberish; + currentIteration?: number | null; + endTime?: CSSNumberish; + localTime?: CSSNumberish | null; + progress?: number | null; + startTime?: CSSNumberish; +} + +interface ComputedKeyframe { + composite: CompositeOperationOrAuto; + computedOffset: number; + easing: string; + offset: number | null; + [property: string]: string | number | null | undefined; +} + +interface ConstantSourceOptions { + offset?: number; +} + +interface ConstrainBooleanParameters { + exact?: boolean; + ideal?: boolean; +} + +interface ConstrainDOMStringParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + +interface ConstrainDoubleRange extends DoubleRange { + exact?: number; + ideal?: number; +} + +interface ConstrainULongRange extends ULongRange { + exact?: number; + ideal?: number; +} + +interface ContentVisibilityAutoStateChangeEventInit extends EventInit { + skipped?: boolean; +} + +interface ConvolverOptions extends AudioNodeOptions { + buffer?: AudioBuffer | null; + disableNormalization?: boolean; +} + +interface CookieChangeEventInit extends EventInit { + changed?: CookieList; + deleted?: CookieList; +} + +interface CookieInit { + domain?: string | null; + expires?: DOMHighResTimeStamp | null; + name: string; + partitioned?: boolean; + path?: string; + sameSite?: CookieSameSite; + value: string; +} + +interface CookieListItem { + name?: string; + value?: string; +} + +interface CookieStoreDeleteOptions { + domain?: string | null; + name: string; + partitioned?: boolean; + path?: string; +} + +interface CookieStoreGetOptions { + name?: string; + url?: string; +} + +interface CredentialCreationOptions { + publicKey?: PublicKeyCredentialCreationOptions; + signal?: AbortSignal; +} + +interface CredentialPropertiesOutput { + rk?: boolean; +} + +interface CredentialRequestOptions { + mediation?: CredentialMediationRequirement; + publicKey?: PublicKeyCredentialRequestOptions; + signal?: AbortSignal; +} + +interface CryptoKeyPair { + privateKey: CryptoKey; + publicKey: CryptoKey; +} + +interface CustomEventInit extends EventInit { + detail?: T; +} + +interface DOMMatrix2DInit { + a?: number; + b?: number; + c?: number; + d?: number; + e?: number; + f?: number; + m11?: number; + m12?: number; + m21?: number; + m22?: number; + m41?: number; + m42?: number; +} + +interface DOMMatrixInit extends DOMMatrix2DInit { + is2D?: boolean; + m13?: number; + m14?: number; + m23?: number; + m24?: number; + m31?: number; + m32?: number; + m33?: number; + m34?: number; + m43?: number; + m44?: number; +} + +interface DOMPointInit { + w?: number; + x?: number; + y?: number; + z?: number; +} + +interface DOMQuadInit { + p1?: DOMPointInit; + p2?: DOMPointInit; + p3?: DOMPointInit; + p4?: DOMPointInit; +} + +interface DOMRectInit { + height?: number; + width?: number; + x?: number; + y?: number; +} + +interface DelayOptions extends AudioNodeOptions { + delayTime?: number; + maxDelayTime?: number; +} + +interface DeviceMotionEventAccelerationInit { + x?: number | null; + y?: number | null; + z?: number | null; +} + +interface DeviceMotionEventInit extends EventInit { + acceleration?: DeviceMotionEventAccelerationInit; + accelerationIncludingGravity?: DeviceMotionEventAccelerationInit; + interval?: number; + rotationRate?: DeviceMotionEventRotationRateInit; +} + +interface DeviceMotionEventRotationRateInit { + alpha?: number | null; + beta?: number | null; + gamma?: number | null; +} + +interface DeviceOrientationEventInit extends EventInit { + absolute?: boolean; + alpha?: number | null; + beta?: number | null; + gamma?: number | null; +} + +interface DisplayMediaStreamOptions { + audio?: boolean | MediaTrackConstraints; + video?: boolean | MediaTrackConstraints; +} + +interface DocumentTimelineOptions { + originTime?: DOMHighResTimeStamp; +} + +interface DoubleRange { + max?: number; + min?: number; +} + +interface DragEventInit extends MouseEventInit { + dataTransfer?: DataTransfer | null; +} + +interface DynamicsCompressorOptions extends AudioNodeOptions { + attack?: number; + knee?: number; + ratio?: number; + release?: number; + threshold?: number; +} + +interface EcKeyAlgorithm extends KeyAlgorithm { + namedCurve: NamedCurve; +} + +interface EcKeyGenParams extends Algorithm { + namedCurve: NamedCurve; +} + +interface EcKeyImportParams extends Algorithm { + namedCurve: NamedCurve; +} + +interface EcdhKeyDeriveParams extends Algorithm { + public: CryptoKey; +} + +interface EcdsaParams extends Algorithm { + hash: HashAlgorithmIdentifier; +} + +interface EffectTiming { + delay?: number; + direction?: PlaybackDirection; + duration?: number | CSSNumericValue | string; + easing?: string; + endDelay?: number; + fill?: FillMode; + iterationStart?: number; + iterations?: number; + playbackRate?: number; +} + +interface ElementCreationOptions { + customElementRegistry?: CustomElementRegistry; + is?: string; +} + +interface ElementDefinitionOptions { + extends?: string; +} + +interface EncodedAudioChunkInit { + data: AllowSharedBufferSource; + duration?: number; + timestamp: number; + transfer?: ArrayBuffer[]; + type: EncodedAudioChunkType; +} + +interface EncodedAudioChunkMetadata { + decoderConfig?: AudioDecoderConfig; +} + +interface EncodedVideoChunkInit { + data: AllowSharedBufferSource; + duration?: number; + timestamp: number; + type: EncodedVideoChunkType; +} + +interface EncodedVideoChunkMetadata { + decoderConfig?: VideoDecoderConfig; +} + +interface ErrorEventInit extends EventInit { + colno?: number; + error?: any; + filename?: string; + lineno?: number; + message?: string; +} + +interface EventInit { + bubbles?: boolean; + cancelable?: boolean; + composed?: boolean; +} + +interface EventListenerOptions { + capture?: boolean; +} + +interface EventModifierInit extends UIEventInit { + altKey?: boolean; + ctrlKey?: boolean; + metaKey?: boolean; + modifierAltGraph?: boolean; + modifierCapsLock?: boolean; + modifierFn?: boolean; + modifierFnLock?: boolean; + modifierHyper?: boolean; + modifierNumLock?: boolean; + modifierScrollLock?: boolean; + modifierSuper?: boolean; + modifierSymbol?: boolean; + modifierSymbolLock?: boolean; + shiftKey?: boolean; +} + +interface EventSourceInit { + withCredentials?: boolean; +} + +interface FilePropertyBag extends BlobPropertyBag { + lastModified?: number; +} + +interface FileSystemCreateWritableOptions { + keepExistingData?: boolean; +} + +interface FileSystemFlags { + create?: boolean; + exclusive?: boolean; +} + +interface FileSystemGetDirectoryOptions { + create?: boolean; +} + +interface FileSystemGetFileOptions { + create?: boolean; +} + +interface FileSystemRemoveOptions { + recursive?: boolean; +} + +interface FocusEventInit extends UIEventInit { + relatedTarget?: EventTarget | null; +} + +interface FocusOptions { + preventScroll?: boolean; +} + +interface FontFaceDescriptors { + ascentOverride?: string; + descentOverride?: string; + display?: FontDisplay; + featureSettings?: string; + lineGapOverride?: string; + stretch?: string; + style?: string; + unicodeRange?: string; + weight?: string; +} + +interface FontFaceSetLoadEventInit extends EventInit { + fontfaces?: FontFace[]; +} + +interface FormDataEventInit extends EventInit { + formData: FormData; +} + +interface FullscreenOptions { + navigationUI?: FullscreenNavigationUI; +} + +interface GainOptions extends AudioNodeOptions { + gain?: number; +} + +interface GamepadEffectParameters { + duration?: number; + leftTrigger?: number; + rightTrigger?: number; + startDelay?: number; + strongMagnitude?: number; + weakMagnitude?: number; +} + +interface GamepadEventInit extends EventInit { + gamepad: Gamepad; +} + +interface GetAnimationsOptions { + subtree?: boolean; +} + +interface GetComposedRangesOptions { + shadowRoots?: ShadowRoot[]; +} + +interface GetHTMLOptions { + serializableShadowRoots?: boolean; + shadowRoots?: ShadowRoot[]; +} + +interface GetNotificationOptions { + tag?: string; +} + +interface GetRootNodeOptions { + composed?: boolean; +} + +interface HashChangeEventInit extends EventInit { + newURL?: string; + oldURL?: string; +} + +interface HkdfParams extends Algorithm { + hash: HashAlgorithmIdentifier; + info: BufferSource; + salt: BufferSource; +} + +interface HmacImportParams extends Algorithm { + hash: HashAlgorithmIdentifier; + length?: number; +} + +interface HmacKeyAlgorithm extends KeyAlgorithm { + hash: KeyAlgorithm; + length: number; +} + +interface HmacKeyGenParams extends Algorithm { + hash: HashAlgorithmIdentifier; + length?: number; +} + +interface IDBDatabaseInfo { + name?: string; + version?: number; +} + +interface IDBIndexParameters { + multiEntry?: boolean; + unique?: boolean; +} + +interface IDBObjectStoreParameters { + autoIncrement?: boolean; + keyPath?: string | string[] | null; +} + +interface IDBTransactionOptions { + durability?: IDBTransactionDurability; +} + +interface IDBVersionChangeEventInit extends EventInit { + newVersion?: number | null; + oldVersion?: number; +} + +interface IIRFilterOptions extends AudioNodeOptions { + feedback: number[]; + feedforward: number[]; +} + +interface IdleRequestOptions { + timeout?: number; +} + +interface ImageBitmapOptions { + colorSpaceConversion?: ColorSpaceConversion; + imageOrientation?: ImageOrientation; + premultiplyAlpha?: PremultiplyAlpha; + resizeHeight?: number; + resizeQuality?: ResizeQuality; + resizeWidth?: number; +} + +interface ImageBitmapRenderingContextSettings { + alpha?: boolean; +} + +interface ImageDataSettings { + colorSpace?: PredefinedColorSpace; +} + +interface ImageDecodeOptions { + completeFramesOnly?: boolean; + frameIndex?: number; +} + +interface ImageDecodeResult { + complete: boolean; + image: VideoFrame; +} + +interface ImageDecoderInit { + colorSpaceConversion?: ColorSpaceConversion; + data: ImageBufferSource; + desiredHeight?: number; + desiredWidth?: number; + preferAnimation?: boolean; + transfer?: ArrayBuffer[]; + type: string; +} + +interface ImageEncodeOptions { + quality?: number; + type?: string; +} + +interface ImportNodeOptions { + customElementRegistry?: CustomElementRegistry; + selfOnly?: boolean; +} + +interface InputEventInit extends UIEventInit { + data?: string | null; + dataTransfer?: DataTransfer | null; + inputType?: string; + isComposing?: boolean; + targetRanges?: StaticRange[]; +} + +interface IntersectionObserverInit { + root?: Element | Document | null; + rootMargin?: string; + threshold?: number | number[]; +} + +interface JsonWebKey { + alg?: string; + crv?: string; + d?: string; + dp?: string; + dq?: string; + e?: string; + ext?: boolean; + k?: string; + key_ops?: string[]; + kty?: string; + n?: string; + oth?: RsaOtherPrimesInfo[]; + p?: string; + q?: string; + qi?: string; + use?: string; + x?: string; + y?: string; +} + +interface KeyAlgorithm { + name: string; +} + +interface KeySystemTrackConfiguration { + robustness?: string; +} + +interface KeyboardEventInit extends EventModifierInit { + /** @deprecated */ + charCode?: number; + code?: string; + isComposing?: boolean; + key?: string; + /** @deprecated */ + keyCode?: number; + location?: number; + repeat?: boolean; +} + +interface Keyframe { + composite?: CompositeOperationOrAuto; + easing?: string; + offset?: number | null; + [property: string]: string | number | null | undefined; +} + +interface KeyframeAnimationOptions extends KeyframeEffectOptions { + id?: string; + timeline?: AnimationTimeline | null; +} + +interface KeyframeEffectOptions extends EffectTiming { + composite?: CompositeOperation; + iterationComposite?: IterationCompositeOperation; + pseudoElement?: string | null; +} + +interface LockInfo { + clientId?: string; + mode?: LockMode; + name?: string; +} + +interface LockManagerSnapshot { + held?: LockInfo[]; + pending?: LockInfo[]; +} + +interface LockOptions { + ifAvailable?: boolean; + mode?: LockMode; + signal?: AbortSignal; + steal?: boolean; +} + +interface MIDIConnectionEventInit extends EventInit { + port?: MIDIPort; +} + +interface MIDIMessageEventInit extends EventInit { + data?: Uint8Array; +} + +interface MIDIOptions { + software?: boolean; + sysex?: boolean; +} + +interface MediaCapabilitiesDecodingInfo extends MediaCapabilitiesInfo { + keySystemAccess: MediaKeySystemAccess | null; +} + +interface MediaCapabilitiesEncodingInfo extends MediaCapabilitiesInfo { +} + +interface MediaCapabilitiesInfo { + powerEfficient: boolean; + smooth: boolean; + supported: boolean; +} + +interface MediaCapabilitiesKeySystemConfiguration { + audio?: KeySystemTrackConfiguration; + distinctiveIdentifier?: MediaKeysRequirement; + initDataType?: string; + keySystem: string; + persistentState?: MediaKeysRequirement; + sessionTypes?: string[]; + video?: KeySystemTrackConfiguration; +} + +interface MediaConfiguration { + audio?: AudioConfiguration; + video?: VideoConfiguration; +} + +interface MediaDecodingConfiguration extends MediaConfiguration { + keySystemConfiguration?: MediaCapabilitiesKeySystemConfiguration; + type: MediaDecodingType; +} + +interface MediaElementAudioSourceOptions { + mediaElement: HTMLMediaElement; +} + +interface MediaEncodingConfiguration extends MediaConfiguration { + type: MediaEncodingType; +} + +interface MediaEncryptedEventInit extends EventInit { + initData?: ArrayBuffer | null; + initDataType?: string; +} + +interface MediaImage { + sizes?: string; + src: string; + type?: string; +} + +interface MediaKeyMessageEventInit extends EventInit { + message: ArrayBuffer; + messageType: MediaKeyMessageType; +} + +interface MediaKeySystemConfiguration { + audioCapabilities?: MediaKeySystemMediaCapability[]; + distinctiveIdentifier?: MediaKeysRequirement; + initDataTypes?: string[]; + label?: string; + persistentState?: MediaKeysRequirement; + sessionTypes?: string[]; + videoCapabilities?: MediaKeySystemMediaCapability[]; +} + +interface MediaKeySystemMediaCapability { + contentType?: string; + encryptionScheme?: string | null; + robustness?: string; +} + +interface MediaKeysPolicy { + minHdcpVersion?: string; +} + +interface MediaMetadataInit { + album?: string; + artist?: string; + artwork?: MediaImage[]; + title?: string; +} + +interface MediaPositionState { + duration?: number; + playbackRate?: number; + position?: number; +} + +interface MediaQueryListEventInit extends EventInit { + matches?: boolean; + media?: string; +} + +interface MediaRecorderOptions { + audioBitsPerSecond?: number; + bitsPerSecond?: number; + mimeType?: string; + videoBitsPerSecond?: number; +} + +interface MediaSessionActionDetails { + action: MediaSessionAction; + fastSeek?: boolean; + seekOffset?: number; + seekTime?: number; +} + +interface MediaSettingsRange { + max?: number; + min?: number; + step?: number; +} + +interface MediaStreamAudioSourceOptions { + mediaStream: MediaStream; +} + +interface MediaStreamConstraints { + audio?: boolean | MediaTrackConstraints; + peerIdentity?: string; + preferCurrentTab?: boolean; + video?: boolean | MediaTrackConstraints; +} + +interface MediaStreamTrackEventInit extends EventInit { + track: MediaStreamTrack; +} + +interface MediaTrackCapabilities { + aspectRatio?: DoubleRange; + autoGainControl?: boolean[]; + backgroundBlur?: boolean[]; + channelCount?: ULongRange; + deviceId?: string; + displaySurface?: string; + echoCancellation?: boolean[]; + facingMode?: string[]; + frameRate?: DoubleRange; + groupId?: string; + height?: ULongRange; + noiseSuppression?: boolean[]; + sampleRate?: ULongRange; + sampleSize?: ULongRange; + width?: ULongRange; +} + +interface MediaTrackConstraintSet { + aspectRatio?: ConstrainDouble; + autoGainControl?: ConstrainBoolean; + backgroundBlur?: ConstrainBoolean; + channelCount?: ConstrainULong; + deviceId?: ConstrainDOMString; + displaySurface?: ConstrainDOMString; + echoCancellation?: ConstrainBoolean; + facingMode?: ConstrainDOMString; + frameRate?: ConstrainDouble; + groupId?: ConstrainDOMString; + height?: ConstrainULong; + noiseSuppression?: ConstrainBoolean; + sampleRate?: ConstrainULong; + sampleSize?: ConstrainULong; + width?: ConstrainULong; +} + +interface MediaTrackConstraints extends MediaTrackConstraintSet { + advanced?: MediaTrackConstraintSet[]; +} + +interface MediaTrackSettings { + aspectRatio?: number; + autoGainControl?: boolean; + backgroundBlur?: boolean; + channelCount?: number; + deviceId?: string; + displaySurface?: string; + echoCancellation?: boolean; + facingMode?: string; + frameRate?: number; + groupId?: string; + height?: number; + noiseSuppression?: boolean; + sampleRate?: number; + sampleSize?: number; + torch?: boolean; + whiteBalanceMode?: string; + width?: number; + zoom?: number; +} + +interface MediaTrackSupportedConstraints { + aspectRatio?: boolean; + autoGainControl?: boolean; + backgroundBlur?: boolean; + channelCount?: boolean; + deviceId?: boolean; + displaySurface?: boolean; + echoCancellation?: boolean; + facingMode?: boolean; + frameRate?: boolean; + groupId?: boolean; + height?: boolean; + noiseSuppression?: boolean; + sampleRate?: boolean; + sampleSize?: boolean; + width?: boolean; +} + +interface MessageEventInit extends EventInit { + data?: T; + lastEventId?: string; + origin?: string; + ports?: MessagePort[]; + source?: MessageEventSource | null; +} + +interface MouseEventInit extends EventModifierInit { + button?: number; + buttons?: number; + clientX?: number; + clientY?: number; + movementX?: number; + movementY?: number; + relatedTarget?: EventTarget | null; + screenX?: number; + screenY?: number; +} + +interface MultiCacheQueryOptions extends CacheQueryOptions { + cacheName?: string; +} + +interface MutationObserverInit { + /** Set to a list of attribute local names (without namespace) if not all attribute mutations need to be observed and attributes is true or omitted. */ + attributeFilter?: string[]; + /** Set to true if attributes is true or omitted and target's attribute value before the mutation needs to be recorded. */ + attributeOldValue?: boolean; + /** Set to true if mutations to target's attributes are to be observed. Can be omitted if attributeOldValue or attributeFilter is specified. */ + attributes?: boolean; + /** Set to true if mutations to target's data are to be observed. Can be omitted if characterDataOldValue is specified. */ + characterData?: boolean; + /** Set to true if characterData is set to true or omitted and target's data before the mutation needs to be recorded. */ + characterDataOldValue?: boolean; + /** Set to true if mutations to target's children are to be observed. */ + childList?: boolean; + /** Set to true if mutations to not just target, but also target's descendants are to be observed. */ + subtree?: boolean; +} + +interface NavigationPreloadState { + enabled?: boolean; + headerValue?: string; +} + +interface NotificationOptions { + badge?: string; + body?: string; + data?: any; + dir?: NotificationDirection; + icon?: string; + lang?: string; + requireInteraction?: boolean; + silent?: boolean | null; + tag?: string; +} + +interface OfflineAudioCompletionEventInit extends EventInit { + renderedBuffer: AudioBuffer; +} + +interface OfflineAudioContextOptions { + length: number; + numberOfChannels?: number; + sampleRate: number; +} + +interface OptionalEffectTiming { + delay?: number; + direction?: PlaybackDirection; + duration?: number | string; + easing?: string; + endDelay?: number; + fill?: FillMode; + iterationStart?: number; + iterations?: number; + playbackRate?: number; +} + +interface OpusEncoderConfig { + complexity?: number; + format?: OpusBitstreamFormat; + frameDuration?: number; + packetlossperc?: number; + usedtx?: boolean; + useinbandfec?: boolean; +} + +interface OscillatorOptions extends AudioNodeOptions { + detune?: number; + frequency?: number; + periodicWave?: PeriodicWave; + type?: OscillatorType; +} + +interface PageRevealEventInit extends EventInit { + viewTransition?: ViewTransition | null; +} + +interface PageSwapEventInit extends EventInit { + activation?: NavigationActivation | null; + viewTransition?: ViewTransition | null; +} + +interface PageTransitionEventInit extends EventInit { + persisted?: boolean; +} + +interface PannerOptions extends AudioNodeOptions { + coneInnerAngle?: number; + coneOuterAngle?: number; + coneOuterGain?: number; + distanceModel?: DistanceModelType; + maxDistance?: number; + orientationX?: number; + orientationY?: number; + orientationZ?: number; + panningModel?: PanningModelType; + positionX?: number; + positionY?: number; + positionZ?: number; + refDistance?: number; + rolloffFactor?: number; +} + +interface PayerErrors { + email?: string; + name?: string; + phone?: string; +} + +interface PaymentCurrencyAmount { + currency: string; + value: string; +} + +interface PaymentDetailsBase { + displayItems?: PaymentItem[]; + modifiers?: PaymentDetailsModifier[]; + shippingOptions?: PaymentShippingOption[]; +} + +interface PaymentDetailsInit extends PaymentDetailsBase { + id?: string; + total: PaymentItem; +} + +interface PaymentDetailsModifier { + additionalDisplayItems?: PaymentItem[]; + data?: any; + supportedMethods: string; + total?: PaymentItem; +} + +interface PaymentDetailsUpdate extends PaymentDetailsBase { + error?: string; + paymentMethodErrors?: any; + shippingAddressErrors?: AddressErrors; + total?: PaymentItem; +} + +interface PaymentItem { + amount: PaymentCurrencyAmount; + label: string; + pending?: boolean; +} + +interface PaymentMethodChangeEventInit extends PaymentRequestUpdateEventInit { + methodDetails?: any; + methodName?: string; +} + +interface PaymentMethodData { + data?: any; + supportedMethods: string; +} + +interface PaymentOptions { + requestPayerEmail?: boolean; + requestPayerName?: boolean; + requestPayerPhone?: boolean; + requestShipping?: boolean; + shippingType?: PaymentShippingType; +} + +interface PaymentRequestUpdateEventInit extends EventInit { +} + +interface PaymentShippingOption { + amount: PaymentCurrencyAmount; + id: string; + label: string; + selected?: boolean; +} + +interface PaymentValidationErrors { + error?: string; + payer?: PayerErrors; + shippingAddress?: AddressErrors; +} + +interface Pbkdf2Params extends Algorithm { + hash: HashAlgorithmIdentifier; + iterations: number; + salt: BufferSource; +} + +interface PerformanceMarkOptions { + detail?: any; + startTime?: DOMHighResTimeStamp; +} + +interface PerformanceMeasureOptions { + detail?: any; + duration?: DOMHighResTimeStamp; + end?: string | DOMHighResTimeStamp; + start?: string | DOMHighResTimeStamp; +} + +interface PerformanceObserverInit { + buffered?: boolean; + entryTypes?: string[]; + type?: string; +} + +interface PeriodicWaveConstraints { + disableNormalization?: boolean; +} + +interface PeriodicWaveOptions extends PeriodicWaveConstraints { + imag?: number[] | Float32Array; + real?: number[] | Float32Array; +} + +interface PermissionDescriptor { + name: PermissionName; +} + +interface PhotoCapabilities { + fillLightMode?: FillLightMode[]; + imageHeight?: MediaSettingsRange; + imageWidth?: MediaSettingsRange; + redEyeReduction?: RedEyeReduction; +} + +interface PhotoSettings { + fillLightMode?: FillLightMode; + imageHeight?: number; + imageWidth?: number; + redEyeReduction?: boolean; +} + +interface PictureInPictureEventInit extends EventInit { + pictureInPictureWindow: PictureInPictureWindow; +} + +interface PlaneLayout { + offset: number; + stride: number; +} + +interface PointerEventInit extends MouseEventInit { + altitudeAngle?: number; + azimuthAngle?: number; + coalescedEvents?: PointerEvent[]; + height?: number; + isPrimary?: boolean; + pointerId?: number; + pointerType?: string; + predictedEvents?: PointerEvent[]; + pressure?: number; + tangentialPressure?: number; + tiltX?: number; + tiltY?: number; + twist?: number; + width?: number; +} + +interface PointerLockOptions { + unadjustedMovement?: boolean; +} + +interface PopStateEventInit extends EventInit { + state?: any; +} + +interface PositionOptions { + enableHighAccuracy?: boolean; + maximumAge?: number; + timeout?: number; +} + +interface ProgressEventInit extends EventInit { + lengthComputable?: boolean; + loaded?: number; + total?: number; +} + +interface PromiseRejectionEventInit extends EventInit { + promise: Promise; + reason?: any; +} + +interface PropertyDefinition { + inherits: boolean; + initialValue?: string; + name: string; + syntax?: string; +} + +interface PropertyIndexedKeyframes { + composite?: CompositeOperationOrAuto | CompositeOperationOrAuto[]; + easing?: string | string[]; + offset?: number | (number | null)[]; + [property: string]: string | string[] | number | null | (number | null)[] | undefined; +} + +interface PublicKeyCredentialCreationOptions { + attestation?: AttestationConveyancePreference; + authenticatorSelection?: AuthenticatorSelectionCriteria; + challenge: BufferSource; + excludeCredentials?: PublicKeyCredentialDescriptor[]; + extensions?: AuthenticationExtensionsClientInputs; + pubKeyCredParams: PublicKeyCredentialParameters[]; + rp: PublicKeyCredentialRpEntity; + timeout?: number; + user: PublicKeyCredentialUserEntity; +} + +interface PublicKeyCredentialCreationOptionsJSON { + attestation?: string; + authenticatorSelection?: AuthenticatorSelectionCriteria; + challenge: Base64URLString; + excludeCredentials?: PublicKeyCredentialDescriptorJSON[]; + extensions?: AuthenticationExtensionsClientInputsJSON; + hints?: string[]; + pubKeyCredParams: PublicKeyCredentialParameters[]; + rp: PublicKeyCredentialRpEntity; + timeout?: number; + user: PublicKeyCredentialUserEntityJSON; +} + +interface PublicKeyCredentialDescriptor { + id: BufferSource; + transports?: AuthenticatorTransport[]; + type: PublicKeyCredentialType; +} + +interface PublicKeyCredentialDescriptorJSON { + id: Base64URLString; + transports?: string[]; + type: string; +} + +interface PublicKeyCredentialEntity { + name: string; +} + +interface PublicKeyCredentialParameters { + alg: COSEAlgorithmIdentifier; + type: PublicKeyCredentialType; +} + +interface PublicKeyCredentialRequestOptions { + allowCredentials?: PublicKeyCredentialDescriptor[]; + challenge: BufferSource; + extensions?: AuthenticationExtensionsClientInputs; + rpId?: string; + timeout?: number; + userVerification?: UserVerificationRequirement; +} + +interface PublicKeyCredentialRequestOptionsJSON { + allowCredentials?: PublicKeyCredentialDescriptorJSON[]; + challenge: Base64URLString; + extensions?: AuthenticationExtensionsClientInputsJSON; + hints?: string[]; + rpId?: string; + timeout?: number; + userVerification?: string; +} + +interface PublicKeyCredentialRpEntity extends PublicKeyCredentialEntity { + id?: string; +} + +interface PublicKeyCredentialUserEntity extends PublicKeyCredentialEntity { + displayName: string; + id: BufferSource; +} + +interface PublicKeyCredentialUserEntityJSON { + displayName: string; + id: Base64URLString; + name: string; +} + +interface PushSubscriptionJSON { + endpoint?: string; + expirationTime?: EpochTimeStamp | null; + keys?: Record; +} + +interface PushSubscriptionOptionsInit { + applicationServerKey?: BufferSource | string | null; + userVisibleOnly?: boolean; +} + +interface QueuingStrategy { + highWaterMark?: number; + size?: QueuingStrategySize; +} + +interface QueuingStrategyInit { + /** + * Creates a new ByteLengthQueuingStrategy with the provided high water mark. + * + * Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw. + */ + highWaterMark: number; +} + +interface RTCAnswerOptions extends RTCOfferAnswerOptions { +} + +interface RTCCertificateExpiration { + expires?: number; +} + +interface RTCConfiguration { + bundlePolicy?: RTCBundlePolicy; + certificates?: RTCCertificate[]; + iceCandidatePoolSize?: number; + iceServers?: RTCIceServer[]; + iceTransportPolicy?: RTCIceTransportPolicy; + rtcpMuxPolicy?: RTCRtcpMuxPolicy; +} + +interface RTCDTMFToneChangeEventInit extends EventInit { + tone?: string; +} + +interface RTCDataChannelEventInit extends EventInit { + channel: RTCDataChannel; +} + +interface RTCDataChannelInit { + id?: number; + maxPacketLifeTime?: number; + maxRetransmits?: number; + negotiated?: boolean; + ordered?: boolean; + protocol?: string; +} + +interface RTCDtlsFingerprint { + algorithm?: string; + value?: string; +} + +interface RTCEncodedAudioFrameMetadata extends RTCEncodedFrameMetadata { + sequenceNumber?: number; +} + +interface RTCEncodedFrameMetadata { + contributingSources?: number[]; + mimeType?: string; + payloadType?: number; + rtpTimestamp?: number; + synchronizationSource?: number; +} + +interface RTCEncodedVideoFrameMetadata extends RTCEncodedFrameMetadata { + dependencies?: number[]; + frameId?: number; + height?: number; + spatialIndex?: number; + temporalIndex?: number; + timestamp?: number; + width?: number; +} + +interface RTCErrorEventInit extends EventInit { + error: RTCError; +} + +interface RTCErrorInit { + errorDetail: RTCErrorDetailType; + httpRequestStatusCode?: number; + receivedAlert?: number; + sctpCauseCode?: number; + sdpLineNumber?: number; + sentAlert?: number; +} + +interface RTCIceCandidateInit { + candidate?: string; + sdpMLineIndex?: number | null; + sdpMid?: string | null; + usernameFragment?: string | null; +} + +interface RTCIceCandidatePairStats extends RTCStats { + availableIncomingBitrate?: number; + availableOutgoingBitrate?: number; + bytesDiscardedOnSend?: number; + bytesReceived?: number; + bytesSent?: number; + consentRequestsSent?: number; + currentRoundTripTime?: number; + lastPacketReceivedTimestamp?: DOMHighResTimeStamp; + lastPacketSentTimestamp?: DOMHighResTimeStamp; + localCandidateId: string; + nominated?: boolean; + packetsDiscardedOnSend?: number; + packetsReceived?: number; + packetsSent?: number; + remoteCandidateId: string; + requestsReceived?: number; + requestsSent?: number; + responsesReceived?: number; + responsesSent?: number; + state: RTCStatsIceCandidatePairState; + totalRoundTripTime?: number; + transportId: string; +} + +interface RTCIceServer { + credential?: string; + urls: string | string[]; + username?: string; +} + +interface RTCInboundRtpStreamStats extends RTCReceivedRtpStreamStats { + audioLevel?: number; + bytesReceived?: number; + concealedSamples?: number; + concealmentEvents?: number; + decoderImplementation?: string; + estimatedPlayoutTimestamp?: DOMHighResTimeStamp; + fecBytesReceived?: number; + fecPacketsDiscarded?: number; + fecPacketsReceived?: number; + fecSsrc?: number; + firCount?: number; + frameHeight?: number; + frameWidth?: number; + framesAssembledFromMultiplePackets?: number; + framesDecoded?: number; + framesDropped?: number; + framesPerSecond?: number; + framesReceived?: number; + framesRendered?: number; + freezeCount?: number; + headerBytesReceived?: number; + insertedSamplesForDeceleration?: number; + jitterBufferDelay?: number; + jitterBufferEmittedCount?: number; + jitterBufferMinimumDelay?: number; + jitterBufferTargetDelay?: number; + keyFramesDecoded?: number; + lastPacketReceivedTimestamp?: DOMHighResTimeStamp; + mid?: string; + nackCount?: number; + packetsDiscarded?: number; + pauseCount?: number; + playoutId?: string; + pliCount?: number; + qpSum?: number; + remoteId?: string; + removedSamplesForAcceleration?: number; + retransmittedBytesReceived?: number; + retransmittedPacketsReceived?: number; + rtxSsrc?: number; + silentConcealedSamples?: number; + totalAssemblyTime?: number; + totalAudioEnergy?: number; + totalDecodeTime?: number; + totalFreezesDuration?: number; + totalInterFrameDelay?: number; + totalPausesDuration?: number; + totalProcessingDelay?: number; + totalSamplesDuration?: number; + totalSamplesReceived?: number; + totalSquaredInterFrameDelay?: number; + trackIdentifier: string; +} + +interface RTCLocalIceCandidateInit extends RTCIceCandidateInit { +} + +interface RTCLocalSessionDescriptionInit { + sdp?: string; + type?: RTCSdpType; +} + +interface RTCOfferAnswerOptions { +} + +interface RTCOfferOptions extends RTCOfferAnswerOptions { + iceRestart?: boolean; + offerToReceiveAudio?: boolean; + offerToReceiveVideo?: boolean; +} + +interface RTCOutboundRtpStreamStats extends RTCSentRtpStreamStats { + active?: boolean; + firCount?: number; + frameHeight?: number; + frameWidth?: number; + framesEncoded?: number; + framesPerSecond?: number; + framesSent?: number; + headerBytesSent?: number; + hugeFramesSent?: number; + keyFramesEncoded?: number; + mediaSourceId?: string; + mid?: string; + nackCount?: number; + pliCount?: number; + qpSum?: number; + qualityLimitationDurations?: Record; + qualityLimitationReason?: RTCQualityLimitationReason; + qualityLimitationResolutionChanges?: number; + remoteId?: string; + retransmittedBytesSent?: number; + retransmittedPacketsSent?: number; + rid?: string; + rtxSsrc?: number; + scalabilityMode?: string; + targetBitrate?: number; + totalEncodeTime?: number; + totalEncodedBytesTarget?: number; + totalPacketSendDelay?: number; +} + +interface RTCPeerConnectionIceErrorEventInit extends EventInit { + address?: string | null; + errorCode: number; + errorText?: string; + port?: number | null; + url?: string; +} + +interface RTCPeerConnectionIceEventInit extends EventInit { + candidate?: RTCIceCandidate | null; +} + +interface RTCReceivedRtpStreamStats extends RTCRtpStreamStats { + jitter?: number; + packetsLost?: number; + packetsReceived?: number; +} + +interface RTCRtcpParameters { + cname?: string; + reducedSize?: boolean; +} + +interface RTCRtpCapabilities { + codecs: RTCRtpCodec[]; + headerExtensions: RTCRtpHeaderExtensionCapability[]; +} + +interface RTCRtpCodec { + channels?: number; + clockRate: number; + mimeType: string; + sdpFmtpLine?: string; +} + +interface RTCRtpCodecParameters extends RTCRtpCodec { + payloadType: number; +} + +interface RTCRtpCodingParameters { + rid?: string; +} + +interface RTCRtpContributingSource { + audioLevel?: number; + rtpTimestamp: number; + source: number; + timestamp: DOMHighResTimeStamp; +} + +interface RTCRtpEncodingParameters extends RTCRtpCodingParameters { + active?: boolean; + maxBitrate?: number; + maxFramerate?: number; + networkPriority?: RTCPriorityType; + priority?: RTCPriorityType; + scaleResolutionDownBy?: number; +} + +interface RTCRtpHeaderExtensionCapability { + uri: string; +} + +interface RTCRtpHeaderExtensionParameters { + encrypted?: boolean; + id: number; + uri: string; +} + +interface RTCRtpParameters { + codecs: RTCRtpCodecParameters[]; + headerExtensions: RTCRtpHeaderExtensionParameters[]; + rtcp: RTCRtcpParameters; +} + +interface RTCRtpReceiveParameters extends RTCRtpParameters { +} + +interface RTCRtpSendParameters extends RTCRtpParameters { + degradationPreference?: RTCDegradationPreference; + encodings: RTCRtpEncodingParameters[]; + transactionId: string; +} + +interface RTCRtpStreamStats extends RTCStats { + codecId?: string; + kind: string; + ssrc: number; + transportId?: string; +} + +interface RTCRtpSynchronizationSource extends RTCRtpContributingSource { +} + +interface RTCRtpTransceiverInit { + direction?: RTCRtpTransceiverDirection; + sendEncodings?: RTCRtpEncodingParameters[]; + streams?: MediaStream[]; +} + +interface RTCSentRtpStreamStats extends RTCRtpStreamStats { + bytesSent?: number; + packetsSent?: number; +} + +interface RTCSessionDescriptionInit { + sdp?: string; + type: RTCSdpType; +} + +interface RTCSetParameterOptions { +} + +interface RTCStats { + id: string; + timestamp: DOMHighResTimeStamp; + type: RTCStatsType; +} + +interface RTCTrackEventInit extends EventInit { + receiver: RTCRtpReceiver; + streams?: MediaStream[]; + track: MediaStreamTrack; + transceiver: RTCRtpTransceiver; +} + +interface RTCTransportStats extends RTCStats { + bytesReceived?: number; + bytesSent?: number; + dtlsCipher?: string; + dtlsRole?: RTCDtlsRole; + dtlsState: RTCDtlsTransportState; + iceLocalUsernameFragment?: string; + iceRole?: RTCIceRole; + iceState?: RTCIceTransportState; + localCertificateId?: string; + packetsReceived?: number; + packetsSent?: number; + remoteCertificateId?: string; + selectedCandidatePairChanges?: number; + selectedCandidatePairId?: string; + srtpCipher?: string; + tlsVersion?: string; +} + +interface ReadableStreamGetReaderOptions { + /** + * Creates a ReadableStreamBYOBReader and locks the stream to the new reader. + * + * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation. + */ + mode?: ReadableStreamReaderMode; +} + +interface ReadableStreamIteratorOptions { + /** + * Asynchronously iterates over the chunks in the stream's internal queue. + * + * Asynchronously iterating over the stream will lock it, preventing any other consumer from acquiring a reader. The lock will be released if the async iterator's return() method is called, e.g. by breaking out of the loop. + * + * By default, calling the async iterator's return() method will also cancel the stream. To prevent this, use the stream's values() method, passing true for the preventCancel option. + */ + preventCancel?: boolean; +} + +interface ReadableStreamReadDoneResult { + done: true; + value: T | undefined; +} + +interface ReadableStreamReadValueResult { + done: false; + value: T; +} + +interface ReadableWritablePair { + readable: ReadableStream; + /** + * Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use. + * + * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. + */ + writable: WritableStream; +} + +interface RegistrationOptions { + scope?: string; + type?: WorkerType; + updateViaCache?: ServiceWorkerUpdateViaCache; +} + +interface ReportingObserverOptions { + buffered?: boolean; + types?: string[]; +} + +interface RequestInit { + /** A BodyInit object or null to set request's body. */ + body?: BodyInit | null; + /** A string indicating how the request will interact with the browser's cache to set request's cache. */ + cache?: RequestCache; + /** A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials. */ + credentials?: RequestCredentials; + /** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */ + headers?: HeadersInit; + /** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */ + integrity?: string; + /** A boolean to set request's keepalive. */ + keepalive?: boolean; + /** A string to set request's method. */ + method?: string; + /** A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode. */ + mode?: RequestMode; + priority?: RequestPriority; + /** A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */ + redirect?: RequestRedirect; + /** A string whose value is a same-origin URL, "about:client", or the empty string, to set request's referrer. */ + referrer?: string; + /** A referrer policy to set request's referrerPolicy. */ + referrerPolicy?: ReferrerPolicy; + /** An AbortSignal to set request's signal. */ + signal?: AbortSignal | null; + /** Can only be null. Used to disassociate request from any Window. */ + window?: null; +} + +interface ResizeObserverOptions { + box?: ResizeObserverBoxOptions; +} + +interface ResponseInit { + headers?: HeadersInit; + status?: number; + statusText?: string; +} + +interface RsaHashedImportParams extends Algorithm { + hash: HashAlgorithmIdentifier; +} + +interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { + hash: KeyAlgorithm; +} + +interface RsaHashedKeyGenParams extends RsaKeyGenParams { + hash: HashAlgorithmIdentifier; +} + +interface RsaKeyAlgorithm extends KeyAlgorithm { + modulusLength: number; + publicExponent: BigInteger; +} + +interface RsaKeyGenParams extends Algorithm { + modulusLength: number; + publicExponent: BigInteger; +} + +interface RsaOaepParams extends Algorithm { + label?: BufferSource; +} + +interface RsaOtherPrimesInfo { + d?: string; + r?: string; + t?: string; +} + +interface RsaPssParams extends Algorithm { + saltLength: number; +} + +interface SVGBoundingBoxOptions { + clipped?: boolean; + fill?: boolean; + markers?: boolean; + stroke?: boolean; +} + +interface ScrollIntoViewOptions extends ScrollOptions { + block?: ScrollLogicalPosition; + inline?: ScrollLogicalPosition; +} + +interface ScrollOptions { + behavior?: ScrollBehavior; +} + +interface ScrollToOptions extends ScrollOptions { + left?: number; + top?: number; +} + +interface SecurityPolicyViolationEventInit extends EventInit { + blockedURI?: string; + columnNumber?: number; + disposition?: SecurityPolicyViolationEventDisposition; + documentURI?: string; + effectiveDirective?: string; + lineNumber?: number; + originalPolicy?: string; + referrer?: string; + sample?: string; + sourceFile?: string; + statusCode?: number; + violatedDirective?: string; +} + +interface ShadowRootInit { + clonable?: boolean; + customElementRegistry?: CustomElementRegistry; + delegatesFocus?: boolean; + mode: ShadowRootMode; + serializable?: boolean; + slotAssignment?: SlotAssignmentMode; +} + +interface ShareData { + files?: File[]; + text?: string; + title?: string; + url?: string; +} + +interface SpeechSynthesisErrorEventInit extends SpeechSynthesisEventInit { + error: SpeechSynthesisErrorCode; +} + +interface SpeechSynthesisEventInit extends EventInit { + charIndex?: number; + charLength?: number; + elapsedTime?: number; + name?: string; + utterance: SpeechSynthesisUtterance; +} + +interface StartViewTransitionOptions { + types?: string[] | null; + update?: ViewTransitionUpdateCallback | null; +} + +interface StaticRangeInit { + endContainer: Node; + endOffset: number; + startContainer: Node; + startOffset: number; +} + +interface StereoPannerOptions extends AudioNodeOptions { + pan?: number; +} + +interface StorageEstimate { + quota?: number; + usage?: number; +} + +interface StorageEventInit extends EventInit { + key?: string | null; + newValue?: string | null; + oldValue?: string | null; + storageArea?: Storage | null; + url?: string; +} + +interface StreamPipeOptions { + preventAbort?: boolean; + preventCancel?: boolean; + /** + * Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered. + * + * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. + * + * Errors and closures of the source and destination streams propagate as follows: + * + * An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination. + * + * An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source. + * + * When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error. + * + * If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source. + * + * The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set. + */ + preventClose?: boolean; + signal?: AbortSignal; +} + +interface StructuredSerializeOptions { + transfer?: Transferable[]; +} + +interface SubmitEventInit extends EventInit { + submitter?: HTMLElement | null; +} + +interface TextDecodeOptions { + stream?: boolean; +} + +interface TextDecoderOptions { + fatal?: boolean; + ignoreBOM?: boolean; +} + +interface TextEncoderEncodeIntoResult { + read: number; + written: number; +} + +interface ToggleEventInit extends EventInit { + newState?: string; + oldState?: string; +} + +interface TouchEventInit extends EventModifierInit { + changedTouches?: Touch[]; + targetTouches?: Touch[]; + touches?: Touch[]; +} + +interface TouchInit { + altitudeAngle?: number; + azimuthAngle?: number; + clientX?: number; + clientY?: number; + force?: number; + identifier: number; + pageX?: number; + pageY?: number; + radiusX?: number; + radiusY?: number; + rotationAngle?: number; + screenX?: number; + screenY?: number; + target: EventTarget; + touchType?: TouchType; +} + +interface TrackEventInit extends EventInit { + track?: TextTrack | null; +} + +interface Transformer { + flush?: TransformerFlushCallback; + readableType?: undefined; + start?: TransformerStartCallback; + transform?: TransformerTransformCallback; + writableType?: undefined; +} + +interface TransitionEventInit extends EventInit { + elapsedTime?: number; + propertyName?: string; + pseudoElement?: string; +} + +interface UIEventInit extends EventInit { + detail?: number; + view?: Window | null; + /** @deprecated */ + which?: number; +} + +interface ULongRange { + max?: number; + min?: number; +} + +interface UnderlyingByteSource { + autoAllocateChunkSize?: number; + cancel?: UnderlyingSourceCancelCallback; + pull?: (controller: ReadableByteStreamController) => void | PromiseLike; + start?: (controller: ReadableByteStreamController) => any; + type: "bytes"; +} + +interface UnderlyingDefaultSource { + cancel?: UnderlyingSourceCancelCallback; + pull?: (controller: ReadableStreamDefaultController) => void | PromiseLike; + start?: (controller: ReadableStreamDefaultController) => any; + type?: undefined; +} + +interface UnderlyingSink { + abort?: UnderlyingSinkAbortCallback; + close?: UnderlyingSinkCloseCallback; + start?: UnderlyingSinkStartCallback; + type?: undefined; + write?: UnderlyingSinkWriteCallback; +} + +interface UnderlyingSource { + autoAllocateChunkSize?: number; + cancel?: UnderlyingSourceCancelCallback; + pull?: UnderlyingSourcePullCallback; + start?: UnderlyingSourceStartCallback; + type?: ReadableStreamType; +} + +interface ValidityStateFlags { + badInput?: boolean; + customError?: boolean; + patternMismatch?: boolean; + rangeOverflow?: boolean; + rangeUnderflow?: boolean; + stepMismatch?: boolean; + tooLong?: boolean; + tooShort?: boolean; + typeMismatch?: boolean; + valueMissing?: boolean; +} + +interface VideoColorSpaceInit { + fullRange?: boolean | null; + matrix?: VideoMatrixCoefficients | null; + primaries?: VideoColorPrimaries | null; + transfer?: VideoTransferCharacteristics | null; +} + +interface VideoConfiguration { + bitrate: number; + colorGamut?: ColorGamut; + contentType: string; + framerate: number; + hasAlphaChannel?: boolean; + hdrMetadataType?: HdrMetadataType; + height: number; + scalabilityMode?: string; + transferFunction?: TransferFunction; + width: number; +} + +interface VideoDecoderConfig { + codec: string; + codedHeight?: number; + codedWidth?: number; + colorSpace?: VideoColorSpaceInit; + description?: AllowSharedBufferSource; + displayAspectHeight?: number; + displayAspectWidth?: number; + hardwareAcceleration?: HardwareAcceleration; + optimizeForLatency?: boolean; +} + +interface VideoDecoderInit { + error: WebCodecsErrorCallback; + output: VideoFrameOutputCallback; +} + +interface VideoDecoderSupport { + config?: VideoDecoderConfig; + supported?: boolean; +} + +interface VideoEncoderConfig { + alpha?: AlphaOption; + avc?: AvcEncoderConfig; + bitrate?: number; + bitrateMode?: VideoEncoderBitrateMode; + codec: string; + contentHint?: string; + displayHeight?: number; + displayWidth?: number; + framerate?: number; + hardwareAcceleration?: HardwareAcceleration; + height: number; + latencyMode?: LatencyMode; + scalabilityMode?: string; + width: number; +} + +interface VideoEncoderEncodeOptions { + avc?: VideoEncoderEncodeOptionsForAvc; + keyFrame?: boolean; +} + +interface VideoEncoderEncodeOptionsForAvc { + quantizer?: number | null; +} + +interface VideoEncoderInit { + error: WebCodecsErrorCallback; + output: EncodedVideoChunkOutputCallback; +} + +interface VideoEncoderSupport { + config?: VideoEncoderConfig; + supported?: boolean; +} + +interface VideoFrameBufferInit { + codedHeight: number; + codedWidth: number; + colorSpace?: VideoColorSpaceInit; + displayHeight?: number; + displayWidth?: number; + duration?: number; + format: VideoPixelFormat; + layout?: PlaneLayout[]; + timestamp: number; + visibleRect?: DOMRectInit; +} + +interface VideoFrameCallbackMetadata { + captureTime?: DOMHighResTimeStamp; + expectedDisplayTime: DOMHighResTimeStamp; + height: number; + mediaTime: number; + presentationTime: DOMHighResTimeStamp; + presentedFrames: number; + processingDuration?: number; + receiveTime?: DOMHighResTimeStamp; + rtpTimestamp?: number; + width: number; +} + +interface VideoFrameCopyToOptions { + colorSpace?: PredefinedColorSpace; + format?: VideoPixelFormat; + layout?: PlaneLayout[]; + rect?: DOMRectInit; +} + +interface VideoFrameInit { + alpha?: AlphaOption; + displayHeight?: number; + displayWidth?: number; + duration?: number; + timestamp?: number; + visibleRect?: DOMRectInit; +} + +interface WaveShaperOptions extends AudioNodeOptions { + curve?: number[] | Float32Array; + oversample?: OverSampleType; +} + +interface WebGLContextAttributes { + alpha?: boolean; + antialias?: boolean; + depth?: boolean; + desynchronized?: boolean; + failIfMajorPerformanceCaveat?: boolean; + powerPreference?: WebGLPowerPreference; + premultipliedAlpha?: boolean; + preserveDrawingBuffer?: boolean; + stencil?: boolean; +} + +interface WebGLContextEventInit extends EventInit { + statusMessage?: string; +} + +interface WebTransportCloseInfo { + closeCode?: number; + reason?: string; +} + +interface WebTransportErrorOptions { + source?: WebTransportErrorSource; + streamErrorCode?: number | null; +} + +interface WebTransportHash { + algorithm?: string; + value?: BufferSource; +} + +interface WebTransportOptions { + allowPooling?: boolean; + congestionControl?: WebTransportCongestionControl; + requireUnreliable?: boolean; + serverCertificateHashes?: WebTransportHash[]; +} + +interface WebTransportSendOptions { + sendOrder?: number; +} + +interface WebTransportSendStreamOptions extends WebTransportSendOptions { +} + +interface WheelEventInit extends MouseEventInit { + deltaMode?: number; + deltaX?: number; + deltaY?: number; + deltaZ?: number; +} + +interface WindowPostMessageOptions extends StructuredSerializeOptions { + targetOrigin?: string; +} + +interface WorkerOptions { + credentials?: RequestCredentials; + name?: string; + type?: WorkerType; +} + +interface WorkletOptions { + credentials?: RequestCredentials; +} + +interface WriteParams { + data?: BufferSource | Blob | string | null; + position?: number | null; + size?: number | null; + type: WriteCommandType; +} + +type NodeFilter = ((node: Node) => number) | { acceptNode(node: Node): number; }; + +declare var NodeFilter: { + readonly FILTER_ACCEPT: 1; + readonly FILTER_REJECT: 2; + readonly FILTER_SKIP: 3; + readonly SHOW_ALL: 0xFFFFFFFF; + readonly SHOW_ELEMENT: 0x1; + readonly SHOW_ATTRIBUTE: 0x2; + readonly SHOW_TEXT: 0x4; + readonly SHOW_CDATA_SECTION: 0x8; + readonly SHOW_ENTITY_REFERENCE: 0x10; + readonly SHOW_ENTITY: 0x20; + readonly SHOW_PROCESSING_INSTRUCTION: 0x40; + readonly SHOW_COMMENT: 0x80; + readonly SHOW_DOCUMENT: 0x100; + readonly SHOW_DOCUMENT_TYPE: 0x200; + readonly SHOW_DOCUMENT_FRAGMENT: 0x400; + readonly SHOW_NOTATION: 0x800; +}; + +type XPathNSResolver = ((prefix: string | null) => string | null) | { lookupNamespaceURI(prefix: string | null): string | null; }; + +/** + * The **`ANGLE_instanced_arrays`** extension is part of the WebGL API and allows to draw the same object, or groups of similar objects multiple times, if they share the same vertex data, primitive count and type. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays) + */ +interface ANGLE_instanced_arrays { + /** + * The **`ANGLE_instanced_arrays.drawArraysInstancedANGLE()`** method of the WebGL API renders primitives from array data like the WebGLRenderingContext.drawArrays() method. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays/drawArraysInstancedANGLE) + */ + drawArraysInstancedANGLE(mode: GLenum, first: GLint, count: GLsizei, primcount: GLsizei): void; + /** + * The **`ANGLE_instanced_arrays.drawElementsInstancedANGLE()`** method of the WebGL API renders primitives from array data like the WebGLRenderingContext.drawElements() method. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays/drawElementsInstancedANGLE) + */ + drawElementsInstancedANGLE(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr, primcount: GLsizei): void; + /** + * The **ANGLE_instanced_arrays.vertexAttribDivisorANGLE()** method of the WebGL API modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives with ANGLE_instanced_arrays.drawArraysInstancedANGLE() and ANGLE_instanced_arrays.drawElementsInstancedANGLE(). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays/vertexAttribDivisorANGLE) + */ + vertexAttribDivisorANGLE(index: GLuint, divisor: GLuint): void; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: 0x88FE; +} + +interface ARIAMixin { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaActiveDescendantElement) */ + ariaActiveDescendantElement: Element | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaAtomic) */ + ariaAtomic: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaAutoComplete) */ + ariaAutoComplete: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBrailleLabel) */ + ariaBrailleLabel: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBrailleRoleDescription) */ + ariaBrailleRoleDescription: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBusy) */ + ariaBusy: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaChecked) */ + ariaChecked: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColCount) */ + ariaColCount: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColIndex) */ + ariaColIndex: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColIndexText) */ + ariaColIndexText: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColSpan) */ + ariaColSpan: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaControlsElements) */ + ariaControlsElements: ReadonlyArray | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaCurrent) */ + ariaCurrent: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaDescribedByElements) */ + ariaDescribedByElements: ReadonlyArray | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaDescription) */ + ariaDescription: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaDetailsElements) */ + ariaDetailsElements: ReadonlyArray | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaDisabled) */ + ariaDisabled: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaErrorMessageElements) */ + ariaErrorMessageElements: ReadonlyArray | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaExpanded) */ + ariaExpanded: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaFlowToElements) */ + ariaFlowToElements: ReadonlyArray | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaHasPopup) */ + ariaHasPopup: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaHidden) */ + ariaHidden: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaInvalid) */ + ariaInvalid: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaKeyShortcuts) */ + ariaKeyShortcuts: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLabel) */ + ariaLabel: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLabelledByElements) */ + ariaLabelledByElements: ReadonlyArray | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLevel) */ + ariaLevel: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLive) */ + ariaLive: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaModal) */ + ariaModal: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaMultiLine) */ + ariaMultiLine: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaMultiSelectable) */ + ariaMultiSelectable: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaOrientation) */ + ariaOrientation: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaOwnsElements) */ + ariaOwnsElements: ReadonlyArray | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPlaceholder) */ + ariaPlaceholder: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPosInSet) */ + ariaPosInSet: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPressed) */ + ariaPressed: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaReadOnly) */ + ariaReadOnly: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRelevant) */ + ariaRelevant: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRequired) */ + ariaRequired: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRoleDescription) */ + ariaRoleDescription: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowCount) */ + ariaRowCount: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowIndex) */ + ariaRowIndex: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowIndexText) */ + ariaRowIndexText: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowSpan) */ + ariaRowSpan: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaSelected) */ + ariaSelected: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaSetSize) */ + ariaSetSize: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaSort) */ + ariaSort: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueMax) */ + ariaValueMax: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueMin) */ + ariaValueMin: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueNow) */ + ariaValueNow: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueText) */ + ariaValueText: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/role) */ + role: string | null; +} + +/** + * The **`AbortController`** interface represents a controller object that allows you to abort one or more Web requests as and when desired. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController) + */ +interface AbortController { + /** + * The **`signal`** read-only property of the AbortController interface returns an AbortSignal object instance, which can be used to communicate with/abort an asynchronous operation as desired. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal) + */ + readonly signal: AbortSignal; + /** + * The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort) + */ + abort(reason?: any): void; +} + +declare var AbortController: { + prototype: AbortController; + new(): AbortController; +}; + +interface AbortSignalEventMap { + "abort": Event; +} + +/** + * The **`AbortSignal`** interface represents a signal object that allows you to communicate with an asynchronous operation (such as a fetch request) and abort it if required via an AbortController object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal) + */ +interface AbortSignal extends EventTarget { + /** + * The **`aborted`** read-only property returns a value that indicates whether the asynchronous operations the signal is communicating with are aborted (`true`) or not (`false`). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted) + */ + readonly aborted: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */ + onabort: ((this: AbortSignal, ev: Event) => any) | null; + /** + * The **`reason`** read-only property returns a JavaScript value that indicates the abort reason. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) + */ + readonly reason: any; + /** + * The **`throwIfAborted()`** method throws the signal's abort AbortSignal.reason if the signal has been aborted; otherwise it does nothing. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) + */ + throwIfAborted(): void; + addEventListener(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var AbortSignal: { + prototype: AbortSignal; + new(): AbortSignal; + /** + * The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an AbortSignal/abort_event event). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) + */ + abort(reason?: any): AbortSignal; + /** + * The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static) + */ + any(signals: AbortSignal[]): AbortSignal; + /** + * The **`AbortSignal.timeout()`** static method returns an AbortSignal that will automatically abort after a specified time. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) + */ + timeout(milliseconds: number): AbortSignal; +}; + +/** + * The **`AbstractRange`** abstract interface is the base class upon which all DOM range types are defined. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbstractRange) + */ +interface AbstractRange { + /** + * The read-only **`collapsed`** property of the AbstractRange interface returns `true` if the range's start position and end position are the same. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbstractRange/collapsed) + */ + readonly collapsed: boolean; + /** + * The read-only **`endContainer`** property of the AbstractRange interface returns the Node in which the end of the range is located. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbstractRange/endContainer) + */ + readonly endContainer: Node; + /** + * The **`endOffset`** property of the AbstractRange interface returns the offset into the end node of the range's end position. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbstractRange/endOffset) + */ + readonly endOffset: number; + /** + * The read-only **`startContainer`** property of the AbstractRange interface returns the start Node for the range. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbstractRange/startContainer) + */ + readonly startContainer: Node; + /** + * The read-only **`startOffset`** property of the AbstractRange interface returns the offset into the start node of the range's start position. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbstractRange/startOffset) + */ + readonly startOffset: number; +} + +declare var AbstractRange: { + prototype: AbstractRange; + new(): AbstractRange; +}; + +interface AbstractWorkerEventMap { + "error": ErrorEvent; +} + +interface AbstractWorker { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorker/error_event) */ + onerror: ((this: AbstractWorker, ev: ErrorEvent) => any) | null; + addEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +/** + * The **`AnalyserNode`** interface represents a node able to provide real-time frequency and time-domain analysis information. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnalyserNode) + */ +interface AnalyserNode extends AudioNode { + /** + * The **`fftSize`** property of the AnalyserNode interface is an unsigned long value and represents the window size in samples that is used when performing a Fast Fourier Transform (FFT) to get frequency domain data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnalyserNode/fftSize) + */ + fftSize: number; + /** + * The **`frequencyBinCount`** read-only property of the AnalyserNode interface contains the total number of data points available to AudioContext BaseAudioContext.sampleRate. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnalyserNode/frequencyBinCount) + */ + readonly frequencyBinCount: number; + /** + * The **`maxDecibels`** property of the AnalyserNode interface is a double value representing the maximum power value in the scaling range for the FFT analysis data, for conversion to unsigned byte values — basically, this specifies the maximum value for the range of results when using `getByteFrequencyData()`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnalyserNode/maxDecibels) + */ + maxDecibels: number; + /** + * The **`minDecibels`** property of the AnalyserNode interface is a double value representing the minimum power value in the scaling range for the FFT analysis data, for conversion to unsigned byte values — basically, this specifies the minimum value for the range of results when using `getByteFrequencyData()`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnalyserNode/minDecibels) + */ + minDecibels: number; + /** + * The **`smoothingTimeConstant`** property of the AnalyserNode interface is a double value representing the averaging constant with the last analysis frame. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnalyserNode/smoothingTimeConstant) + */ + smoothingTimeConstant: number; + /** + * The **`getByteFrequencyData()`** method of the AnalyserNode interface copies the current frequency data into a Uint8Array (unsigned byte array) passed into it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnalyserNode/getByteFrequencyData) + */ + getByteFrequencyData(array: Uint8Array): void; + /** + * The **`getByteTimeDomainData()`** method of the AnalyserNode Interface copies the current waveform, or time-domain, data into a Uint8Array (unsigned byte array) passed into it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnalyserNode/getByteTimeDomainData) + */ + getByteTimeDomainData(array: Uint8Array): void; + /** + * The **`getFloatFrequencyData()`** method of the AnalyserNode Interface copies the current frequency data into a Float32Array array passed into it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnalyserNode/getFloatFrequencyData) + */ + getFloatFrequencyData(array: Float32Array): void; + /** + * The **`getFloatTimeDomainData()`** method of the AnalyserNode Interface copies the current waveform, or time-domain, data into a Float32Array array passed into it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnalyserNode/getFloatTimeDomainData) + */ + getFloatTimeDomainData(array: Float32Array): void; +} + +declare var AnalyserNode: { + prototype: AnalyserNode; + new(context: BaseAudioContext, options?: AnalyserOptions): AnalyserNode; +}; + +interface Animatable { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/animate) */ + animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions): Animation; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAnimations) */ + getAnimations(options?: GetAnimationsOptions): Animation[]; +} + +interface AnimationEventMap { + "cancel": AnimationPlaybackEvent; + "finish": AnimationPlaybackEvent; + "remove": AnimationPlaybackEvent; +} + +/** + * The **`Animation`** interface of the Web Animations API represents a single animation player and provides playback controls and a timeline for an animation node or source. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation) + */ +interface Animation extends EventTarget { + /** + * The **`Animation.currentTime`** property of the Web Animations API returns and sets the current time value of the animation in milliseconds, whether running or paused. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/currentTime) + */ + currentTime: CSSNumberish | null; + /** + * The **`Animation.effect`** property of the Web Animations API gets and sets the target effect of an animation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/effect) + */ + effect: AnimationEffect | null; + /** + * The **`Animation.finished`** read-only property of the Web Animations API returns a Promise which resolves once the animation has finished playing. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/finished) + */ + readonly finished: Promise; + /** + * The **`Animation.id`** property of the Web Animations API returns or sets a string used to identify the animation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/id) + */ + id: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/cancel_event) */ + oncancel: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/finish_event) */ + onfinish: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/remove_event) */ + onremove: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null; + /** + * The read-only **`Animation.pending`** property of the Web Animations API indicates whether the animation is currently waiting for an asynchronous operation such as initiating playback or pausing a running animation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/pending) + */ + readonly pending: boolean; + /** + * The read-only **`Animation.playState`** property of the Web Animations API returns an enumerated value describing the playback state of an animation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/playState) + */ + readonly playState: AnimationPlayState; + /** + * The **`Animation.playbackRate`** property of the Web Animations API returns or sets the playback rate of the animation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/playbackRate) + */ + playbackRate: number; + /** + * The read-only **`Animation.ready`** property of the Web Animations API returns a Promise which resolves when the animation is ready to play. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/ready) + */ + readonly ready: Promise; + /** + * The read-only **`Animation.replaceState`** property of the Web Animations API indicates whether the animation has been removed by the browser automatically after being replaced by another animation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/replaceState) + */ + readonly replaceState: AnimationReplaceState; + /** + * The **`Animation.startTime`** property of the Animation interface is a double-precision floating-point value which indicates the scheduled time when an animation's playback should begin. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/startTime) + */ + startTime: CSSNumberish | null; + /** + * The **`Animation.timeline`** property of the Animation interface returns or sets the AnimationTimeline associated with this animation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/timeline) + */ + timeline: AnimationTimeline | null; + /** + * The Web Animations API's **`cancel()`** method of the Animation interface clears all KeyframeEffects caused by this animation and aborts its playback. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/cancel) + */ + cancel(): void; + /** + * The `commitStyles()` method of the Web Animations API's Animation interface writes the computed values of the animation's current styles into its target element's `style` attribute. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/commitStyles) + */ + commitStyles(): void; + /** + * The **`finish()`** method of the Web Animations API's Animation Interface sets the current playback time to the end of the animation corresponding to the current playback direction. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/finish) + */ + finish(): void; + /** + * The **`pause()`** method of the Web Animations API's Animation interface suspends playback of the animation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/pause) + */ + pause(): void; + /** + * The `persist()` method of the Web Animations API's Animation interface explicitly persists an animation, preventing it from being automatically removed when it is replaced by another animation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/persist) + */ + persist(): void; + /** + * The **`play()`** method of the Web Animations API's Animation Interface starts or resumes playing of an animation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/play) + */ + play(): void; + /** + * The **`Animation.reverse()`** method of the Animation Interface reverses the playback direction, meaning the animation ends at its beginning. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/reverse) + */ + reverse(): void; + /** + * The **`updatePlaybackRate()`** method of the Web Animations API's synchronizing its playback position. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/updatePlaybackRate) + */ + updatePlaybackRate(playbackRate: number): void; + addEventListener(type: K, listener: (this: Animation, ev: AnimationEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: Animation, ev: AnimationEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var Animation: { + prototype: Animation; + new(effect?: AnimationEffect | null, timeline?: AnimationTimeline | null): Animation; +}; + +/** + * The `AnimationEffect` interface of the Web Animations API is an interface representing animation effects. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationEffect) + */ +interface AnimationEffect { + /** + * The `getComputedTiming()` method of the AnimationEffect interface returns the calculated timing properties for this animation effect. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationEffect/getComputedTiming) + */ + getComputedTiming(): ComputedEffectTiming; + /** + * The `AnimationEffect.getTiming()` method of the AnimationEffect interface returns an object containing the timing properties for the Animation Effect. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationEffect/getTiming) + */ + getTiming(): EffectTiming; + /** + * The `updateTiming()` method of the AnimationEffect interface updates the specified timing properties for an animation effect. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationEffect/updateTiming) + */ + updateTiming(timing?: OptionalEffectTiming): void; +} + +declare var AnimationEffect: { + prototype: AnimationEffect; + new(): AnimationEffect; +}; + +/** + * The **`AnimationEvent`** interface represents events providing information related to animations. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationEvent) + */ +interface AnimationEvent extends Event { + /** + * The **`AnimationEvent.animationName`** read-only property is a string containing the value of the animation-name CSS property associated with the transition. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationEvent/animationName) + */ + readonly animationName: string; + /** + * The **`AnimationEvent.elapsedTime`** read-only property is a `float` giving the amount of time the animation has been running, in seconds, when this event fired, excluding any time the animation was paused. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationEvent/elapsedTime) + */ + readonly elapsedTime: number; + /** + * The **`AnimationEvent.pseudoElement`** read-only property is a string, starting with `'::'`, containing the name of the pseudo-element the animation runs on. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationEvent/pseudoElement) + */ + readonly pseudoElement: string; +} + +declare var AnimationEvent: { + prototype: AnimationEvent; + new(type: string, animationEventInitDict?: AnimationEventInit): AnimationEvent; +}; + +interface AnimationFrameProvider { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DedicatedWorkerGlobalScope/cancelAnimationFrame) */ + cancelAnimationFrame(handle: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DedicatedWorkerGlobalScope/requestAnimationFrame) */ + requestAnimationFrame(callback: FrameRequestCallback): number; +} + +/** + * The AnimationPlaybackEvent interface of the Web Animations API represents animation events. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationPlaybackEvent) + */ +interface AnimationPlaybackEvent extends Event { + /** + * The **`currentTime`** read-only property of the AnimationPlaybackEvent interface represents the current time of the animation that generated the event at the moment the event is queued. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationPlaybackEvent/currentTime) + */ + readonly currentTime: CSSNumberish | null; + /** + * The **`timelineTime`** read-only property of the AnimationPlaybackEvent interface represents the time value of the animation's AnimationTimeline at the moment the event is queued. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationPlaybackEvent/timelineTime) + */ + readonly timelineTime: CSSNumberish | null; +} + +declare var AnimationPlaybackEvent: { + prototype: AnimationPlaybackEvent; + new(type: string, eventInitDict?: AnimationPlaybackEventInit): AnimationPlaybackEvent; +}; + +/** + * The `AnimationTimeline` interface of the Web Animations API represents the timeline of an animation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationTimeline) + */ +interface AnimationTimeline { + /** + * The **`currentTime`** read-only property of the Web Animations API's AnimationTimeline interface returns the timeline's current time in milliseconds, or `null` if the timeline is inactive. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationTimeline/currentTime) + */ + readonly currentTime: CSSNumberish | null; +} + +declare var AnimationTimeline: { + prototype: AnimationTimeline; + new(): AnimationTimeline; +}; + +/** + * The **`Attr`** interface represents one of an element's attributes as an object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Attr) + */ +interface Attr extends Node { + /** + * The read-only **`localName`** property of the Attr interface returns the _local part_ of the _qualified name_ of an attribute, that is the name of the attribute, stripped from any namespace in front of it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Attr/localName) + */ + readonly localName: string; + /** + * The read-only **`name`** property of the Attr interface returns the _qualified name_ of an attribute, that is the name of the attribute, with the namespace prefix, if any, in front of it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Attr/name) + */ + readonly name: string; + /** + * The read-only **`namespaceURI`** property of the Attr interface returns the namespace URI of the attribute, or `null` if the element is not in a namespace. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Attr/namespaceURI) + */ + readonly namespaceURI: string | null; + readonly ownerDocument: Document; + /** + * The read-only **`ownerElement`** property of the Attr interface returns the Element the attribute belongs to. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Attr/ownerElement) + */ + readonly ownerElement: Element | null; + /** + * The read-only **`prefix`** property of the Attr returns the namespace prefix of the attribute, or `null` if no prefix is specified. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Attr/prefix) + */ + readonly prefix: string | null; + /** + * The read-only **`specified`** property of the Attr interface always returns `true`. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Attr/specified) + */ + readonly specified: boolean; + /** + * The **`value`** property of the Attr interface contains the value of the attribute. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Attr/value) + */ + value: string; + /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent) */ + get textContent(): string; + set textContent(value: string | null); +} + +declare var Attr: { + prototype: Attr; + new(): Attr; +}; + +/** + * The **`AudioBuffer`** interface represents a short audio asset residing in memory, created from an audio file using the BaseAudioContext/decodeAudioData method, or from raw data using BaseAudioContext/createBuffer. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBuffer) + */ +interface AudioBuffer { + /** + * The **`duration`** property of the AudioBuffer interface returns a double representing the duration, in seconds, of the PCM data stored in the buffer. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBuffer/duration) + */ + readonly duration: number; + /** + * The **`length`** property of the AudioBuffer interface returns an integer representing the length, in sample-frames, of the PCM data stored in the buffer. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBuffer/length) + */ + readonly length: number; + /** + * The `numberOfChannels` property of the AudioBuffer interface returns an integer representing the number of discrete audio channels described by the PCM data stored in the buffer. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBuffer/numberOfChannels) + */ + readonly numberOfChannels: number; + /** + * The **`sampleRate`** property of the AudioBuffer interface returns a float representing the sample rate, in samples per second, of the PCM data stored in the buffer. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBuffer/sampleRate) + */ + readonly sampleRate: number; + /** + * The **`copyFromChannel()`** method of the channel of the `AudioBuffer` to a specified ```js-nolint copyFromChannel(destination, channelNumber, startInChannel) ``` - `destination` - : A Float32Array to copy the channel's samples to. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBuffer/copyFromChannel) + */ + copyFromChannel(destination: Float32Array, channelNumber: number, bufferOffset?: number): void; + /** + * The `copyToChannel()` method of the AudioBuffer interface copies the samples to the specified channel of the `AudioBuffer`, from the source array. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBuffer/copyToChannel) + */ + copyToChannel(source: Float32Array, channelNumber: number, bufferOffset?: number): void; + /** + * The **`getChannelData()`** method of the AudioBuffer Interface returns a Float32Array containing the PCM data associated with the channel, defined by the channel parameter (with 0 representing the first channel). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBuffer/getChannelData) + */ + getChannelData(channel: number): Float32Array; +} + +declare var AudioBuffer: { + prototype: AudioBuffer; + new(options: AudioBufferOptions): AudioBuffer; +}; + +/** + * The **`AudioBufferSourceNode`** interface is an AudioScheduledSourceNode which represents an audio source consisting of in-memory audio data, stored in an AudioBuffer. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBufferSourceNode) + */ +interface AudioBufferSourceNode extends AudioScheduledSourceNode { + /** + * The **`buffer`** property of the AudioBufferSourceNode interface provides the ability to play back audio using an AudioBuffer as the source of the sound data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBufferSourceNode/buffer) + */ + buffer: AudioBuffer | null; + /** + * The **`detune`** property of the representing detuning of oscillation in cents. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBufferSourceNode/detune) + */ + readonly detune: AudioParam; + /** + * The `loop` property of the AudioBufferSourceNode interface is a Boolean indicating if the audio asset must be replayed when the end of the AudioBuffer is reached. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBufferSourceNode/loop) + */ + loop: boolean; + /** + * The `loopEnd` property of the AudioBufferSourceNode interface specifies is a floating point number specifying, in seconds, at what offset into playing the AudioBuffer playback should loop back to the time indicated by the AudioBufferSourceNode.loopStart property. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBufferSourceNode/loopEnd) + */ + loopEnd: number; + /** + * The **`loopStart`** property of the AudioBufferSourceNode interface is a floating-point value indicating, in seconds, where in the AudioBuffer the restart of the play must happen. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBufferSourceNode/loopStart) + */ + loopStart: number; + /** + * The **`playbackRate`** property of the AudioBufferSourceNode interface Is a k-rate AudioParam that defines the speed at which the audio asset will be played. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBufferSourceNode/playbackRate) + */ + readonly playbackRate: AudioParam; + /** + * The `start()` method of the AudioBufferSourceNode Interface is used to schedule playback of the audio data contained in the buffer, or to begin playback immediately. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBufferSourceNode/start) + */ + start(when?: number, offset?: number, duration?: number): void; + addEventListener(type: K, listener: (this: AudioBufferSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: AudioBufferSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var AudioBufferSourceNode: { + prototype: AudioBufferSourceNode; + new(context: BaseAudioContext, options?: AudioBufferSourceOptions): AudioBufferSourceNode; +}; + +/** + * The `AudioContext` interface represents an audio-processing graph built from audio modules linked together, each represented by an AudioNode. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioContext) + */ +interface AudioContext extends BaseAudioContext { + /** + * The **`baseLatency`** read-only property of the seconds of processing latency incurred by the `AudioContext` passing an audio buffer from the AudioDestinationNode — i.e., the end of the audio graph — into the host system's audio subsystem ready for playing. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioContext/baseLatency) + */ + readonly baseLatency: number; + /** + * The **`outputLatency`** read-only property of the AudioContext Interface provides an estimation of the output latency of the current audio context. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioContext/outputLatency) + */ + readonly outputLatency: number; + /** + * The `close()` method of the AudioContext Interface closes the audio context, releasing any system audio resources that it uses. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioContext/close) + */ + close(): Promise; + /** + * The `createMediaElementSource()` method of the AudioContext Interface is used to create a new MediaElementAudioSourceNode object, given an existing HTML audio or video element, the audio from which can then be played and manipulated. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioContext/createMediaElementSource) + */ + createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; + /** + * The `createMediaStreamDestination()` method of the AudioContext Interface is used to create a new MediaStreamAudioDestinationNode object associated with a WebRTC MediaStream representing an audio stream, which may be stored in a local file or sent to another computer. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioContext/createMediaStreamDestination) + */ + createMediaStreamDestination(): MediaStreamAudioDestinationNode; + /** + * The `createMediaStreamSource()` method of the AudioContext Interface is used to create a new MediaStreamAudioSourceNode object, given a media stream (say, from a MediaDevices.getUserMedia instance), the audio from which can then be played and manipulated. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioContext/createMediaStreamSource) + */ + createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; + /** + * The **`getOutputTimestamp()`** method of the containing two audio timestamp values relating to the current audio context. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioContext/getOutputTimestamp) + */ + getOutputTimestamp(): AudioTimestamp; + /** + * The **`resume()`** method of the AudioContext interface resumes the progression of time in an audio context that has previously been suspended. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioContext/resume) + */ + resume(): Promise; + /** + * The `suspend()` method of the AudioContext Interface suspends the progression of time in the audio context, temporarily halting audio hardware access and reducing CPU/battery usage in the process — this is useful if you want an application to power down the audio hardware when it will not be using an audio context for a while. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioContext/suspend) + */ + suspend(): Promise; + addEventListener(type: K, listener: (this: AudioContext, ev: BaseAudioContextEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: AudioContext, ev: BaseAudioContextEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var AudioContext: { + prototype: AudioContext; + new(contextOptions?: AudioContextOptions): AudioContext; +}; + +/** + * The **`AudioData`** interface of the WebCodecs API represents an audio sample. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioData) + */ +interface AudioData { + /** + * The **`duration`** read-only property of the AudioData interface returns the duration in microseconds of this `AudioData` object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioData/duration) + */ + readonly duration: number; + /** + * The **`format`** read-only property of the AudioData interface returns the sample format of the `AudioData` object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioData/format) + */ + readonly format: AudioSampleFormat | null; + /** + * The **`numberOfChannels`** read-only property of the AudioData interface returns the number of channels in the `AudioData` object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioData/numberOfChannels) + */ + readonly numberOfChannels: number; + /** + * The **`numberOfFrames`** read-only property of the AudioData interface returns the number of frames in the `AudioData` object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioData/numberOfFrames) + */ + readonly numberOfFrames: number; + /** + * The **`sampleRate`** read-only property of the AudioData interface returns the sample rate in Hz. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioData/sampleRate) + */ + readonly sampleRate: number; + /** + * The **`timestamp`** read-only property of the AudioData interface returns the timestamp of this `AudioData` object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioData/timestamp) + */ + readonly timestamp: number; + /** + * The **`allocationSize()`** method of the AudioData interface returns the size in bytes required to hold the current sample as filtered by options passed into the method. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioData/allocationSize) + */ + allocationSize(options: AudioDataCopyToOptions): number; + /** + * The **`clone()`** method of the AudioData interface creates a new `AudioData` object with reference to the same media resource as the original. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioData/clone) + */ + clone(): AudioData; + /** + * The **`close()`** method of the AudioData interface clears all states and releases the reference to the media resource. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioData/close) + */ + close(): void; + /** + * The **`copyTo()`** method of the AudioData interface copies a plane of an `AudioData` object to a destination buffer. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioData/copyTo) + */ + copyTo(destination: AllowSharedBufferSource, options: AudioDataCopyToOptions): void; +} + +declare var AudioData: { + prototype: AudioData; + new(init: AudioDataInit): AudioData; +}; + +interface AudioDecoderEventMap { + "dequeue": Event; +} + +/** + * The **`AudioDecoder`** interface of the WebCodecs API decodes chunks of audio. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioDecoder) + */ +interface AudioDecoder extends EventTarget { + /** + * The **`decodeQueueSize`** read-only property of the AudioDecoder interface returns the number of pending decode requests in the queue. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioDecoder/decodeQueueSize) + */ + readonly decodeQueueSize: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioDecoder/dequeue_event) */ + ondequeue: ((this: AudioDecoder, ev: Event) => any) | null; + /** + * The **`state`** read-only property of the AudioDecoder interface returns the current state of the underlying codec. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioDecoder/state) + */ + readonly state: CodecState; + /** + * The **`close()`** method of the AudioDecoder interface ends all pending work and releases system resources. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioDecoder/close) + */ + close(): void; + /** + * The **`configure()`** method of the AudioDecoder interface enqueues a control message to configure the audio decoder for decoding chunks. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioDecoder/configure) + */ + configure(config: AudioDecoderConfig): void; + /** + * The **`decode()`** method of the AudioDecoder interface enqueues a control message to decode a given chunk of audio. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioDecoder/decode) + */ + decode(chunk: EncodedAudioChunk): void; + /** + * The **`flush()`** method of the AudioDecoder interface returns a Promise that resolves once all pending messages in the queue have been completed. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioDecoder/flush) + */ + flush(): Promise; + /** + * The **`reset()`** method of the AudioDecoder interface resets all states including configuration, control messages in the control message queue, and all pending callbacks. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioDecoder/reset) + */ + reset(): void; + addEventListener(type: K, listener: (this: AudioDecoder, ev: AudioDecoderEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: AudioDecoder, ev: AudioDecoderEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var AudioDecoder: { + prototype: AudioDecoder; + new(init: AudioDecoderInit): AudioDecoder; + /** + * The **`isConfigSupported()`** static method of the AudioDecoder interface checks if the given config is supported (that is, if AudioDecoder objects can be successfully configured with the given config). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioDecoder/isConfigSupported_static) + */ + isConfigSupported(config: AudioDecoderConfig): Promise; +}; + +/** + * The `AudioDestinationNode` interface represents the end destination of an audio graph in a given context — usually the speakers of your device. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioDestinationNode) + */ +interface AudioDestinationNode extends AudioNode { + /** + * The `maxChannelCount` property of the AudioDestinationNode interface is an `unsigned long` defining the maximum amount of channels that the physical device can handle. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioDestinationNode/maxChannelCount) + */ + readonly maxChannelCount: number; +} + +declare var AudioDestinationNode: { + prototype: AudioDestinationNode; + new(): AudioDestinationNode; +}; + +interface AudioEncoderEventMap { + "dequeue": Event; +} + +/** + * The **`AudioEncoder`** interface of the WebCodecs API encodes AudioData objects. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioEncoder) + */ +interface AudioEncoder extends EventTarget { + /** + * The **`encodeQueueSize`** read-only property of the AudioEncoder interface returns the number of pending encode requests in the queue. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioEncoder/encodeQueueSize) + */ + readonly encodeQueueSize: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioEncoder/dequeue_event) */ + ondequeue: ((this: AudioEncoder, ev: Event) => any) | null; + /** + * The **`state`** read-only property of the AudioEncoder interface returns the current state of the underlying codec. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioEncoder/state) + */ + readonly state: CodecState; + /** + * The **`close()`** method of the AudioEncoder interface ends all pending work and releases system resources. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioEncoder/close) + */ + close(): void; + /** + * The **`configure()`** method of the AudioEncoder interface enqueues a control message to configure the audio encoder for encoding chunks. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioEncoder/configure) + */ + configure(config: AudioEncoderConfig): void; + /** + * The **`encode()`** method of the AudioEncoder interface enqueues a control message to encode a given AudioData object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioEncoder/encode) + */ + encode(data: AudioData): void; + /** + * The **`flush()`** method of the AudioEncoder interface returns a Promise that resolves once all pending messages in the queue have been completed. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioEncoder/flush) + */ + flush(): Promise; + /** + * The **`reset()`** method of the AudioEncoder interface resets all states including configuration, control messages in the control message queue, and all pending callbacks. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioEncoder/reset) + */ + reset(): void; + addEventListener(type: K, listener: (this: AudioEncoder, ev: AudioEncoderEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: AudioEncoder, ev: AudioEncoderEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var AudioEncoder: { + prototype: AudioEncoder; + new(init: AudioEncoderInit): AudioEncoder; + /** + * The **`isConfigSupported()`** static method of the AudioEncoder interface checks if the given config is supported (that is, if AudioEncoder objects can be successfully configured with the given config). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioEncoder/isConfigSupported_static) + */ + isConfigSupported(config: AudioEncoderConfig): Promise; +}; + +/** + * The `AudioListener` interface represents the position and orientation of the unique person listening to the audio scene, and is used in audio spatialization. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener) + */ +interface AudioListener { + /** + * The `forwardX` read-only property of the AudioListener interface is an AudioParam representing the x value of the direction vector defining the forward direction the listener is pointing in. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/forwardX) + */ + readonly forwardX: AudioParam; + /** + * The `forwardY` read-only property of the AudioListener interface is an AudioParam representing the y value of the direction vector defining the forward direction the listener is pointing in. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/forwardY) + */ + readonly forwardY: AudioParam; + /** + * The `forwardZ` read-only property of the AudioListener interface is an AudioParam representing the z value of the direction vector defining the forward direction the listener is pointing in. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/forwardZ) + */ + readonly forwardZ: AudioParam; + /** + * The `positionX` read-only property of the AudioListener interface is an AudioParam representing the x position of the listener in 3D cartesian space. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/positionX) + */ + readonly positionX: AudioParam; + /** + * The `positionY` read-only property of the AudioListener interface is an AudioParam representing the y position of the listener in 3D cartesian space. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/positionY) + */ + readonly positionY: AudioParam; + /** + * The `positionZ` read-only property of the AudioListener interface is an AudioParam representing the z position of the listener in 3D cartesian space. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/positionZ) + */ + readonly positionZ: AudioParam; + /** + * The `upX` read-only property of the AudioListener interface is an AudioParam representing the x value of the direction vector defining the up direction the listener is pointing in. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/upX) + */ + readonly upX: AudioParam; + /** + * The `upY` read-only property of the AudioListener interface is an AudioParam representing the y value of the direction vector defining the up direction the listener is pointing in. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/upY) + */ + readonly upY: AudioParam; + /** + * The `upZ` read-only property of the AudioListener interface is an AudioParam representing the z value of the direction vector defining the up direction the listener is pointing in. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/upZ) + */ + readonly upZ: AudioParam; + /** + * The `setOrientation()` method of the AudioListener interface defines the orientation of the listener. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/setOrientation) + */ + setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void; + /** + * The `setPosition()` method of the AudioListener Interface defines the position of the listener. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/setPosition) + */ + setPosition(x: number, y: number, z: number): void; +} + +declare var AudioListener: { + prototype: AudioListener; + new(): AudioListener; +}; + +/** + * The **`AudioNode`** interface is a generic interface for representing an audio processing module. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode) + */ +interface AudioNode extends EventTarget { + /** + * The **`channelCount`** property of the AudioNode interface represents an integer used to determine how many channels are used when up-mixing and down-mixing connections to any inputs to the node. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode/channelCount) + */ + channelCount: number; + /** + * The `channelCountMode` property of the AudioNode interface represents an enumerated value describing the way channels must be matched between the node's inputs and outputs. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode/channelCountMode) + */ + channelCountMode: ChannelCountMode; + /** + * The **`channelInterpretation`** property of the AudioNode interface represents an enumerated value describing how input channels are mapped to output channels when the number of inputs/outputs is different. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode/channelInterpretation) + */ + channelInterpretation: ChannelInterpretation; + /** + * The read-only `context` property of the the node is participating in. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode/context) + */ + readonly context: BaseAudioContext; + /** + * The `numberOfInputs` property of the AudioNode interface returns the number of inputs feeding the node. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode/numberOfInputs) + */ + readonly numberOfInputs: number; + /** + * The `numberOfOutputs` property of the AudioNode interface returns the number of outputs coming out of the node. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode/numberOfOutputs) + */ + readonly numberOfOutputs: number; + /** + * The `connect()` method of the AudioNode interface lets you connect one of the node's outputs to a target, which may be either another `AudioNode` (thereby directing the sound data to the specified node) or an change the value of that parameter over time. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode/connect) + */ + connect(destinationNode: AudioNode, output?: number, input?: number): AudioNode; + connect(destinationParam: AudioParam, output?: number): void; + /** + * The **`disconnect()`** method of the AudioNode interface lets you disconnect one or more nodes from the node on which the method is called. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode/disconnect) + */ + disconnect(): void; + disconnect(output: number): void; + disconnect(destinationNode: AudioNode): void; + disconnect(destinationNode: AudioNode, output: number): void; + disconnect(destinationNode: AudioNode, output: number, input: number): void; + disconnect(destinationParam: AudioParam): void; + disconnect(destinationParam: AudioParam, output: number): void; +} + +declare var AudioNode: { + prototype: AudioNode; + new(): AudioNode; +}; + +/** + * The Web Audio API's `AudioParam` interface represents an audio-related parameter, usually a parameter of an AudioNode (such as GainNode.gain). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam) + */ +interface AudioParam { + automationRate: AutomationRate; + /** + * The **`defaultValue`** read-only property of the AudioParam interface represents the initial value of the attributes as defined by the specific AudioNode creating the `AudioParam`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/defaultValue) + */ + readonly defaultValue: number; + /** + * The **`maxValue`** read-only property of the AudioParam interface represents the maximum possible value for the parameter's nominal (effective) range. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/maxValue) + */ + readonly maxValue: number; + /** + * The **`minValue`** read-only property of the AudioParam interface represents the minimum possible value for the parameter's nominal (effective) range. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/minValue) + */ + readonly minValue: number; + /** + * The **`value`** property of the AudioParam interface gets or sets the value of this `AudioParam` at the current time. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/value) + */ + value: number; + /** + * The **`cancelAndHoldAtTime()`** method of the `AudioParam` but holds its value at a given time until further changes are made using other methods. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/cancelAndHoldAtTime) + */ + cancelAndHoldAtTime(cancelTime: number): AudioParam; + /** + * The `cancelScheduledValues()` method of the AudioParam Interface cancels all scheduled future changes to the `AudioParam`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/cancelScheduledValues) + */ + cancelScheduledValues(cancelTime: number): AudioParam; + /** + * The **`exponentialRampToValueAtTime()`** method of the AudioParam Interface schedules a gradual exponential change in the value of the AudioParam. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/exponentialRampToValueAtTime) + */ + exponentialRampToValueAtTime(value: number, endTime: number): AudioParam; + /** + * The `linearRampToValueAtTime()` method of the AudioParam Interface schedules a gradual linear change in the value of the `AudioParam`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/linearRampToValueAtTime) + */ + linearRampToValueAtTime(value: number, endTime: number): AudioParam; + /** + * The `setTargetAtTime()` method of the `AudioParam` value. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/setTargetAtTime) + */ + setTargetAtTime(target: number, startTime: number, timeConstant: number): AudioParam; + /** + * The `setValueAtTime()` method of the `AudioParam` value at a precise time, as measured against ```js-nolint setValueAtTime(value, startTime) ``` - `value` - : A floating point number representing the value the AudioParam will change to at the given time. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/setValueAtTime) + */ + setValueAtTime(value: number, startTime: number): AudioParam; + /** + * The **`setValueCurveAtTime()`** method of the following a curve defined by a list of values. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/setValueCurveAtTime) + */ + setValueCurveAtTime(values: number[] | Float32Array, startTime: number, duration: number): AudioParam; +} + +declare var AudioParam: { + prototype: AudioParam; + new(): AudioParam; +}; + +/** + * The **`AudioParamMap`** interface of the Web Audio API represents an iterable and read-only set of multiple audio parameters. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParamMap) + */ +interface AudioParamMap { + forEach(callbackfn: (value: AudioParam, key: string, parent: AudioParamMap) => void, thisArg?: any): void; +} + +declare var AudioParamMap: { + prototype: AudioParamMap; + new(): AudioParamMap; +}; + +/** + * The `AudioProcessingEvent` interface of the Web Audio API represents events that occur when a ScriptProcessorNode input buffer is ready to be processed. + * @deprecated As of the August 29 2014 Web Audio API spec publication, this feature has been marked as deprecated, and is soon to be replaced by AudioWorklet. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioProcessingEvent) + */ +interface AudioProcessingEvent extends Event { + /** + * The **`inputBuffer`** read-only property of the AudioProcessingEvent interface represents the input buffer of an audio processing event. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioProcessingEvent/inputBuffer) + */ + readonly inputBuffer: AudioBuffer; + /** + * The **`outputBuffer`** read-only property of the AudioProcessingEvent interface represents the output buffer of an audio processing event. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioProcessingEvent/outputBuffer) + */ + readonly outputBuffer: AudioBuffer; + /** + * The **`playbackTime`** read-only property of the AudioProcessingEvent interface represents the time when the audio will be played. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioProcessingEvent/playbackTime) + */ + readonly playbackTime: number; +} + +/** @deprecated */ +declare var AudioProcessingEvent: { + prototype: AudioProcessingEvent; + new(type: string, eventInitDict: AudioProcessingEventInit): AudioProcessingEvent; +}; + +interface AudioScheduledSourceNodeEventMap { + "ended": Event; +} + +/** + * The `AudioScheduledSourceNode` interface—part of the Web Audio API—is a parent interface for several types of audio source node interfaces which share the ability to be started and stopped, optionally at specified times. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioScheduledSourceNode) + */ +interface AudioScheduledSourceNode extends AudioNode { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioScheduledSourceNode/ended_event) */ + onended: ((this: AudioScheduledSourceNode, ev: Event) => any) | null; + /** + * The `start()` method on AudioScheduledSourceNode schedules a sound to begin playback at the specified time. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioScheduledSourceNode/start) + */ + start(when?: number): void; + /** + * The `stop()` method on AudioScheduledSourceNode schedules a sound to cease playback at the specified time. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioScheduledSourceNode/stop) + */ + stop(when?: number): void; + addEventListener(type: K, listener: (this: AudioScheduledSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: AudioScheduledSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var AudioScheduledSourceNode: { + prototype: AudioScheduledSourceNode; + new(): AudioScheduledSourceNode; +}; + +/** + * The **`AudioWorklet`** interface of the Web Audio API is used to supply custom audio processing scripts that execute in a separate thread to provide very low latency audio processing. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorklet) + */ +interface AudioWorklet extends Worklet { +} + +declare var AudioWorklet: { + prototype: AudioWorklet; + new(): AudioWorklet; +}; + +interface AudioWorkletNodeEventMap { + "processorerror": ErrorEvent; +} + +/** + * The **`AudioWorkletNode`** interface of the Web Audio API represents a base class for a user-defined AudioNode, which can be connected to an audio routing graph along with other nodes. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletNode) + */ +interface AudioWorkletNode extends AudioNode { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletNode/processorerror_event) */ + onprocessorerror: ((this: AudioWorkletNode, ev: ErrorEvent) => any) | null; + /** + * The read-only **`parameters`** property of the underlying AudioWorkletProcessor according to its getter. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletNode/parameters) + */ + readonly parameters: AudioParamMap; + /** + * The read-only **`port`** property of the associated AudioWorkletProcessor. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletNode/port) + */ + readonly port: MessagePort; + addEventListener(type: K, listener: (this: AudioWorkletNode, ev: AudioWorkletNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: AudioWorkletNode, ev: AudioWorkletNodeEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var AudioWorkletNode: { + prototype: AudioWorkletNode; + new(context: BaseAudioContext, name: string, options?: AudioWorkletNodeOptions): AudioWorkletNode; +}; + +/** + * The **`AuthenticatorAssertionResponse`** interface of the Web Authentication API contains a digital signature from the private key of a particular WebAuthn credential. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAssertionResponse) + */ +interface AuthenticatorAssertionResponse extends AuthenticatorResponse { + /** + * The **`authenticatorData`** property of the AuthenticatorAssertionResponse interface returns an ArrayBuffer containing information from the authenticator such as the Relying Party ID Hash (rpIdHash), a signature counter, test of user presence, user verification flags, and any extensions processed by the authenticator. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAssertionResponse/authenticatorData) + */ + readonly authenticatorData: ArrayBuffer; + /** + * The **`signature`** read-only property of the object which is the signature of the authenticator for both the client data (AuthenticatorResponse.clientDataJSON). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAssertionResponse/signature) + */ + readonly signature: ArrayBuffer; + /** + * The **`userHandle`** read-only property of the AuthenticatorAssertionResponse interface is an ArrayBuffer object providing an opaque identifier for the given user. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAssertionResponse/userHandle) + */ + readonly userHandle: ArrayBuffer | null; +} + +declare var AuthenticatorAssertionResponse: { + prototype: AuthenticatorAssertionResponse; + new(): AuthenticatorAssertionResponse; +}; + +/** + * The **`AuthenticatorAttestationResponse`** interface of the Web Authentication API is the result of a WebAuthn credential registration. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAttestationResponse) + */ +interface AuthenticatorAttestationResponse extends AuthenticatorResponse { + /** + * The **`attestationObject`** property of the entire `attestationObject` with a private key that is stored in the authenticator when it is manufactured. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAttestationResponse/attestationObject) + */ + readonly attestationObject: ArrayBuffer; + /** + * The **`getAuthenticatorData()`** method of the AuthenticatorAttestationResponse interface returns an ArrayBuffer containing the authenticator data contained within the AuthenticatorAttestationResponse.attestationObject property. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAttestationResponse/getAuthenticatorData) + */ + getAuthenticatorData(): ArrayBuffer; + /** + * The **`getPublicKey()`** method of the AuthenticatorAttestationResponse interface returns an ArrayBuffer containing the DER `SubjectPublicKeyInfo` of the new credential (see Subject Public Key Info), or `null` if this is not available. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAttestationResponse/getPublicKey) + */ + getPublicKey(): ArrayBuffer | null; + /** + * The **`getPublicKeyAlgorithm()`** method of the AuthenticatorAttestationResponse interface returns a number that is equal to a COSE Algorithm Identifier, representing the cryptographic algorithm used for the new credential. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAttestationResponse/getPublicKeyAlgorithm) + */ + getPublicKeyAlgorithm(): COSEAlgorithmIdentifier; + /** + * The **`getTransports()`** method of the AuthenticatorAttestationResponse interface returns an array of strings describing the different transports which may be used by the authenticator. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAttestationResponse/getTransports) + */ + getTransports(): string[]; +} + +declare var AuthenticatorAttestationResponse: { + prototype: AuthenticatorAttestationResponse; + new(): AuthenticatorAttestationResponse; +}; + +/** + * The **`AuthenticatorResponse`** interface of the Web Authentication API is the base interface for interfaces that provide a cryptographic root of trust for a key pair. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorResponse) + */ +interface AuthenticatorResponse { + /** + * The **`clientDataJSON`** property of the AuthenticatorResponse interface stores a JSON string in an An ArrayBuffer. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorResponse/clientDataJSON) + */ + readonly clientDataJSON: ArrayBuffer; +} + +declare var AuthenticatorResponse: { + prototype: AuthenticatorResponse; + new(): AuthenticatorResponse; +}; + +/** + * The **`BarProp`** interface of the Document Object Model represents the web browser user interface elements that are exposed to scripts in web pages. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BarProp) + */ +interface BarProp { + /** + * The **`visible`** read-only property of the BarProp interface returns `true` if the user interface element it represents is visible. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BarProp/visible) + */ + readonly visible: boolean; +} + +declare var BarProp: { + prototype: BarProp; + new(): BarProp; +}; + +interface BaseAudioContextEventMap { + "statechange": Event; +} + +/** + * The `BaseAudioContext` interface of the Web Audio API acts as a base definition for online and offline audio-processing graphs, as represented by AudioContext and OfflineAudioContext respectively. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext) + */ +interface BaseAudioContext extends EventTarget { + /** + * The `audioWorklet` read-only property of the processing. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/audioWorklet) + */ + readonly audioWorklet: AudioWorklet; + /** + * The `currentTime` read-only property of the BaseAudioContext interface returns a double representing an ever-increasing hardware timestamp in seconds that can be used for scheduling audio playback, visualizing timelines, etc. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/currentTime) + */ + readonly currentTime: number; + /** + * The `destination` property of the BaseAudioContext interface returns an AudioDestinationNode representing the final destination of all audio in the context. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/destination) + */ + readonly destination: AudioDestinationNode; + /** + * The `listener` property of the BaseAudioContext interface returns an AudioListener object that can then be used for implementing 3D audio spatialization. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/listener) + */ + readonly listener: AudioListener; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/statechange_event) */ + onstatechange: ((this: BaseAudioContext, ev: Event) => any) | null; + /** + * The `sampleRate` property of the BaseAudioContext interface returns a floating point number representing the sample rate, in samples per second, used by all nodes in this audio context. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/sampleRate) + */ + readonly sampleRate: number; + /** + * The `state` read-only property of the BaseAudioContext interface returns the current state of the `AudioContext`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/state) + */ + readonly state: AudioContextState; + /** + * The `createAnalyser()` method of the can be used to expose audio time and frequency data and create data visualizations. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createAnalyser) + */ + createAnalyser(): AnalyserNode; + /** + * The `createBiquadFilter()` method of the BaseAudioContext interface creates a BiquadFilterNode, which represents a second order filter configurable as several different common filter types. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createBiquadFilter) + */ + createBiquadFilter(): BiquadFilterNode; + /** + * The `createBuffer()` method of the BaseAudioContext Interface is used to create a new, empty AudioBuffer object, which can then be populated by data, and played via an AudioBufferSourceNode. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createBuffer) + */ + createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; + /** + * The `createBufferSource()` method of the BaseAudioContext Interface is used to create a new AudioBufferSourceNode, which can be used to play audio data contained within an AudioBuffer object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createBufferSource) + */ + createBufferSource(): AudioBufferSourceNode; + /** + * The `createChannelMerger()` method of the BaseAudioContext interface creates a ChannelMergerNode, which combines channels from multiple audio streams into a single audio stream. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createChannelMerger) + */ + createChannelMerger(numberOfInputs?: number): ChannelMergerNode; + /** + * The `createChannelSplitter()` method of the BaseAudioContext Interface is used to create a ChannelSplitterNode, which is used to access the individual channels of an audio stream and process them separately. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createChannelSplitter) + */ + createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode; + /** + * The **`createConstantSource()`** property of the BaseAudioContext interface creates a outputs a monaural (one-channel) sound signal whose samples all have the same value. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createConstantSource) + */ + createConstantSource(): ConstantSourceNode; + /** + * The `createConvolver()` method of the BaseAudioContext interface creates a ConvolverNode, which is commonly used to apply reverb effects to your audio. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createConvolver) + */ + createConvolver(): ConvolverNode; + /** + * The `createDelay()` method of the which is used to delay the incoming audio signal by a certain amount of time. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createDelay) + */ + createDelay(maxDelayTime?: number): DelayNode; + /** + * The `createDynamicsCompressor()` method of the BaseAudioContext Interface is used to create a DynamicsCompressorNode, which can be used to apply compression to an audio signal. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createDynamicsCompressor) + */ + createDynamicsCompressor(): DynamicsCompressorNode; + /** + * The `createGain()` method of the BaseAudioContext interface creates a GainNode, which can be used to control the overall gain (or volume) of the audio graph. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createGain) + */ + createGain(): GainNode; + /** + * The **`createIIRFilter()`** method of the BaseAudioContext interface creates an IIRFilterNode, which represents a general **infinite impulse response** (IIR) filter which can be configured to serve as various types of filter. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createIIRFilter) + */ + createIIRFilter(feedforward: number[], feedback: number[]): IIRFilterNode; + /** + * The `createOscillator()` method of the BaseAudioContext interface creates an OscillatorNode, a source representing a periodic waveform. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createOscillator) + */ + createOscillator(): OscillatorNode; + /** + * The `createPanner()` method of the BaseAudioContext Interface is used to create a new PannerNode, which is used to spatialize an incoming audio stream in 3D space. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createPanner) + */ + createPanner(): PannerNode; + /** + * The `createPeriodicWave()` method of the BaseAudioContext interface is used to create a PeriodicWave. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createPeriodicWave) + */ + createPeriodicWave(real: number[] | Float32Array, imag: number[] | Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; + /** + * The `createScriptProcessor()` method of the BaseAudioContext interface creates a ScriptProcessorNode used for direct audio processing. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createScriptProcessor) + */ + createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; + /** + * The `createStereoPanner()` method of the BaseAudioContext interface creates a StereoPannerNode, which can be used to apply stereo panning to an audio source. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createStereoPanner) + */ + createStereoPanner(): StereoPannerNode; + /** + * The `createWaveShaper()` method of the BaseAudioContext interface creates a WaveShaperNode, which represents a non-linear distortion. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createWaveShaper) + */ + createWaveShaper(): WaveShaperNode; + /** + * The `decodeAudioData()` method of the BaseAudioContext Interface is used to asynchronously decode audio file data contained in an rate, then passed to a callback or promise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/decodeAudioData) + */ + decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback | null, errorCallback?: DecodeErrorCallback | null): Promise; + addEventListener(type: K, listener: (this: BaseAudioContext, ev: BaseAudioContextEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: BaseAudioContext, ev: BaseAudioContextEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var BaseAudioContext: { + prototype: BaseAudioContext; + new(): BaseAudioContext; +}; + +/** + * The **`BeforeUnloadEvent`** interface represents the event object for the Window/beforeunload_event event, which is fired when the current window, contained document, and associated resources are about to be unloaded. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BeforeUnloadEvent) + */ +interface BeforeUnloadEvent extends Event { + /** + * The **`returnValue`** property of the `returnValue` is initialized to an empty string (`''`) value. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BeforeUnloadEvent/returnValue) + */ + returnValue: any; +} + +declare var BeforeUnloadEvent: { + prototype: BeforeUnloadEvent; + new(): BeforeUnloadEvent; +}; + +/** + * The `BiquadFilterNode` interface represents a simple low-order filter, and is created using the BaseAudioContext/createBiquadFilter method. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BiquadFilterNode) + */ +interface BiquadFilterNode extends AudioNode { + /** + * The `Q` property of the BiquadFilterNode interface is an a-rate AudioParam, a double representing a Q factor, or _quality factor_. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BiquadFilterNode/Q) + */ + readonly Q: AudioParam; + /** + * The `detune` property of the BiquadFilterNode interface is an a-rate AudioParam representing detuning of the frequency in cents. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BiquadFilterNode/detune) + */ + readonly detune: AudioParam; + /** + * The `frequency` property of the BiquadFilterNode interface is an a-rate AudioParam — a double representing a frequency in the current filtering algorithm measured in hertz (Hz). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BiquadFilterNode/frequency) + */ + readonly frequency: AudioParam; + /** + * The `gain` property of the BiquadFilterNode interface is an a-rate AudioParam — a double representing the gain used in the current filtering algorithm. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BiquadFilterNode/gain) + */ + readonly gain: AudioParam; + /** + * The `type` property of the BiquadFilterNode interface is a string (enum) value defining the kind of filtering algorithm the node is implementing. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BiquadFilterNode/type) + */ + type: BiquadFilterType; + /** + * The `getFrequencyResponse()` method of the BiquadFilterNode interface takes the current filtering algorithm's settings and calculates the frequency response for frequencies specified in a specified array of frequencies. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BiquadFilterNode/getFrequencyResponse) + */ + getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; +} + +declare var BiquadFilterNode: { + prototype: BiquadFilterNode; + new(context: BaseAudioContext, options?: BiquadFilterOptions): BiquadFilterNode; +}; + +/** + * The **`Blob`** interface represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob) + */ +interface Blob { + /** + * The **`size`** read-only property of the Blob interface returns the size of the Blob or File in bytes. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) + */ + readonly size: number; + /** + * The **`type`** read-only property of the Blob interface returns the MIME type of the file. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) + */ + readonly type: string; + /** + * The **`arrayBuffer()`** method of the Blob interface returns a Promise that resolves with the contents of the blob as binary data contained in an ArrayBuffer. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) + */ + arrayBuffer(): Promise; + /** + * The **`bytes()`** method of the Blob interface returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/bytes) + */ + bytes(): Promise>; + /** + * The **`slice()`** method of the Blob interface creates and returns a new `Blob` object which contains data from a subset of the blob on which it's called. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) + */ + slice(start?: number, end?: number, contentType?: string): Blob; + /** + * The **`stream()`** method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the `Blob`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) + */ + stream(): ReadableStream>; + /** + * The **`text()`** method of the string containing the contents of the blob, interpreted as UTF-8. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) + */ + text(): Promise; +} + +declare var Blob: { + prototype: Blob; + new(blobParts?: BlobPart[], options?: BlobPropertyBag): Blob; +}; + +/** + * The **`BlobEvent`** interface of the MediaStream Recording API represents events associated with a Blob. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BlobEvent) + */ +interface BlobEvent extends Event { + /** + * The **`data`** read-only property of the BlobEvent interface represents a Blob associated with the event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BlobEvent/data) + */ + readonly data: Blob; + /** + * The **`timecode`** read-only property of the BlobEvent interface indicates the difference between the timestamp of the first chunk of data, and the timestamp of the first chunk in the first `BlobEvent` produced by this recorder. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BlobEvent/timecode) + */ + readonly timecode: DOMHighResTimeStamp; +} + +declare var BlobEvent: { + prototype: BlobEvent; + new(type: string, eventInitDict: BlobEventInit): BlobEvent; +}; + +interface Body { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */ + readonly body: ReadableStream> | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */ + readonly bodyUsed: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */ + arrayBuffer(): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */ + blob(): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */ + bytes(): Promise>; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */ + formData(): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) */ + json(): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */ + text(): Promise; +} + +interface BroadcastChannelEventMap { + "message": MessageEvent; + "messageerror": MessageEvent; +} + +/** + * The **`BroadcastChannel`** interface represents a named channel that any browsing context of a given origin can subscribe to. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BroadcastChannel) + */ +interface BroadcastChannel extends EventTarget { + /** + * The **`name`** read-only property of the BroadcastChannel interface returns a string, which uniquely identifies the given channel with its name. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BroadcastChannel/name) + */ + readonly name: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BroadcastChannel/message_event) */ + onmessage: ((this: BroadcastChannel, ev: MessageEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BroadcastChannel/messageerror_event) */ + onmessageerror: ((this: BroadcastChannel, ev: MessageEvent) => any) | null; + /** + * The **`close()`** method of the BroadcastChannel interface terminates the connection to the underlying channel, allowing the object to be garbage collected. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BroadcastChannel/close) + */ + close(): void; + /** + * The **`postMessage()`** method of the BroadcastChannel interface sends a message, which can be of any kind of Object, to each listener in any browsing context with the same origin. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BroadcastChannel/postMessage) + */ + postMessage(message: any): void; + addEventListener(type: K, listener: (this: BroadcastChannel, ev: BroadcastChannelEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: BroadcastChannel, ev: BroadcastChannelEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var BroadcastChannel: { + prototype: BroadcastChannel; + new(name: string): BroadcastChannel; +}; + +/** + * The **`ByteLengthQueuingStrategy`** interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy) + */ +interface ByteLengthQueuingStrategy extends QueuingStrategy { + /** + * The read-only **`ByteLengthQueuingStrategy.highWaterMark`** property returns the total number of bytes that can be contained in the internal queue before backpressure is applied. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark) + */ + readonly highWaterMark: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */ + readonly size: QueuingStrategySize; +} + +declare var ByteLengthQueuingStrategy: { + prototype: ByteLengthQueuingStrategy; + new(init: QueuingStrategyInit): ByteLengthQueuingStrategy; +}; + +/** + * The **`CDATASection`** interface represents a CDATA section that can be used within XML to include extended portions of unescaped text. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CDATASection) + */ +interface CDATASection extends Text { +} + +declare var CDATASection: { + prototype: CDATASection; + new(): CDATASection; +}; + +/** + * The `CSPViolationReportBody` interface is an extension of the Reporting API that represents the body of a Content Security Policy (CSP) violation report. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSPViolationReportBody) + */ +interface CSPViolationReportBody extends ReportBody { + /** + * The **`blockedURL`** read-only property of the CSPViolationReportBody interface is a string value that represents the resource that was blocked because it violates a Content Security Policy (CSP). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSPViolationReportBody/blockedURL) + */ + readonly blockedURL: string | null; + /** + * The **`columnNumber`** read-only property of the CSPViolationReportBody interface indicates the column number in the source file that triggered the Content Security Policy (CSP) violation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSPViolationReportBody/columnNumber) + */ + readonly columnNumber: number | null; + /** + * The **`disposition`** read-only property of the CSPViolationReportBody interface indicates whether the user agent is configured to enforce Content Security Policy (CSP) violations or only report them. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSPViolationReportBody/disposition) + */ + readonly disposition: SecurityPolicyViolationEventDisposition; + /** + * The **`documentURL`** read-only property of the CSPViolationReportBody interface is a string that represents the URL of the document or worker that violated the Content Security Policy (CSP). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSPViolationReportBody/documentURL) + */ + readonly documentURL: string; + /** + * The **`effectiveDirective`** read-only property of the CSPViolationReportBody interface is a string that represents the effective Content Security Policy (CSP) directive that was violated. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSPViolationReportBody/effectiveDirective) + */ + readonly effectiveDirective: string; + /** + * The **`lineNumber`** read-only property of the CSPViolationReportBody interface indicates the line number in the source file that triggered the Content Security Policy (CSP) violation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSPViolationReportBody/lineNumber) + */ + readonly lineNumber: number | null; + /** + * The **`originalPolicy`** read-only property of the CSPViolationReportBody interface is a string that represents the Content Security Policy (CSP) whose enforcement uncovered the violation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSPViolationReportBody/originalPolicy) + */ + readonly originalPolicy: string; + /** + * The **`referrer`** read-only property of the CSPViolationReportBody interface is a string that represents the URL of the referring page of the resource who's Content Security Policy (CSP) was violated. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSPViolationReportBody/referrer) + */ + readonly referrer: string | null; + /** + * The **`sample`** read-only property of the CSPViolationReportBody interface is a string that contains a part of the resource that violated the Content Security Policy (CSP). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSPViolationReportBody/sample) + */ + readonly sample: string | null; + /** + * The **`sourceFile`** read-only property of the CSPViolationReportBody interface indicates the URL of the source file that violated the Content Security Policy (CSP). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSPViolationReportBody/sourceFile) + */ + readonly sourceFile: string | null; + /** + * The **`statusCode`** read-only property of the CSPViolationReportBody interface is a number representing the HTTP status code of the response to the request that triggered a Content Security Policy (CSP) violation (when loading a window or worker). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSPViolationReportBody/statusCode) + */ + readonly statusCode: number; + /** + * The **`toJSON()`** method of the CSPViolationReportBody interface is a _serializer_, which returns a JSON representation of the `CSPViolationReportBody` object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSPViolationReportBody/toJSON) + */ + toJSON(): any; +} + +declare var CSPViolationReportBody: { + prototype: CSPViolationReportBody; + new(): CSPViolationReportBody; +}; + +/** + * The **`CSSAnimation`** interface of the Web Animations API represents an Animation object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSAnimation) + */ +interface CSSAnimation extends Animation { + /** + * The **`animationName`** property of the specifies one or more keyframe at-rules which describe the animation applied to the element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSAnimation/animationName) + */ + readonly animationName: string; + addEventListener(type: K, listener: (this: CSSAnimation, ev: AnimationEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: CSSAnimation, ev: AnimationEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var CSSAnimation: { + prototype: CSSAnimation; + new(): CSSAnimation; +}; + +/** + * An object implementing the **`CSSConditionRule`** interface represents a single condition CSS at-rule, which consists of a condition and a statement block. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSConditionRule) + */ +interface CSSConditionRule extends CSSGroupingRule { + /** + * The read-only **`conditionText`** property of the CSSConditionRule interface returns or sets the text of the CSS rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSConditionRule/conditionText) + */ + readonly conditionText: string; +} + +declare var CSSConditionRule: { + prototype: CSSConditionRule; + new(): CSSConditionRule; +}; + +/** + * The **`CSSContainerRule`** interface represents a single CSS @container rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSContainerRule) + */ +interface CSSContainerRule extends CSSConditionRule { + /** + * The read-only **`containerName`** property of the CSSContainerRule interface represents the container name of the associated CSS @container at-rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSContainerRule/containerName) + */ + readonly containerName: string; + /** + * The read-only **`containerQuery`** property of the CSSContainerRule interface returns a string representing the container conditions that are evaluated when the container changes size in order to determine if the styles in the associated @container are applied. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSContainerRule/containerQuery) + */ + readonly containerQuery: string; +} + +declare var CSSContainerRule: { + prototype: CSSContainerRule; + new(): CSSContainerRule; +}; + +/** + * The **`CSSCounterStyleRule`** interface represents an @counter-style at-rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule) + */ +interface CSSCounterStyleRule extends CSSRule { + /** + * The **`additiveSymbols`** property of the CSSCounterStyleRule interface gets and sets the value of the @counter-style/additive-symbols descriptor. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/additiveSymbols) + */ + additiveSymbols: string; + /** + * The **`fallback`** property of the CSSCounterStyleRule interface gets and sets the value of the @counter-style/fallback descriptor. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/fallback) + */ + fallback: string; + /** + * The **`name`** property of the CSSCounterStyleRule interface gets and sets the <custom-ident> defined as the `name` for the associated rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/name) + */ + name: string; + /** + * The **`negative`** property of the CSSCounterStyleRule interface gets and sets the value of the @counter-style/negative descriptor. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/negative) + */ + negative: string; + /** + * The **`pad`** property of the CSSCounterStyleRule interface gets and sets the value of the @counter-style/pad descriptor. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/pad) + */ + pad: string; + /** + * The **`prefix`** property of the CSSCounterStyleRule interface gets and sets the value of the @counter-style/prefix descriptor. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/prefix) + */ + prefix: string; + /** + * The **`range`** property of the CSSCounterStyleRule interface gets and sets the value of the @counter-style/range descriptor. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/range) + */ + range: string; + /** + * The **`speakAs`** property of the CSSCounterStyleRule interface gets and sets the value of the @counter-style/speak-as descriptor. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/speakAs) + */ + speakAs: string; + /** + * The **`suffix`** property of the CSSCounterStyleRule interface gets and sets the value of the @counter-style/suffix descriptor. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/suffix) + */ + suffix: string; + /** + * The **`symbols`** property of the CSSCounterStyleRule interface gets and sets the value of the @counter-style/symbols descriptor. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/symbols) + */ + symbols: string; + /** + * The **`system`** property of the CSSCounterStyleRule interface gets and sets the value of the @counter-style/system descriptor. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/system) + */ + system: string; +} + +declare var CSSCounterStyleRule: { + prototype: CSSCounterStyleRule; + new(): CSSCounterStyleRule; +}; + +/** + * The **`CSSFontFaceRule`** interface represents an @font-face at-rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontFaceRule) + */ +interface CSSFontFaceRule extends CSSRule { + /** + * The read-only **`style`** property of the CSSFontFaceRule interface returns the style information from the @font-face at-rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontFaceRule/style) + */ + get style(): CSSStyleDeclaration; + set style(cssText: string); +} + +declare var CSSFontFaceRule: { + prototype: CSSFontFaceRule; + new(): CSSFontFaceRule; +}; + +/** + * The **`CSSFontFeatureValuesRule`** interface represents an @font-feature-values at-rule, letting developers assign for each font face a common name to specify features indices to be used in font-variant-alternates. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontFeatureValuesRule) + */ +interface CSSFontFeatureValuesRule extends CSSRule { + /** + * The **`fontFamily`** property of the CSSConditionRule interface represents the name of the font family it applies to. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontFeatureValuesRule/fontFamily) + */ + fontFamily: string; +} + +declare var CSSFontFeatureValuesRule: { + prototype: CSSFontFeatureValuesRule; + new(): CSSFontFeatureValuesRule; +}; + +/** + * The **`CSSFontPaletteValuesRule`** interface represents an @font-palette-values at-rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontPaletteValuesRule) + */ +interface CSSFontPaletteValuesRule extends CSSRule { + /** + * The read-only **`basePalette`** property of the CSSFontPaletteValuesRule interface indicates the base palette associated with the rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontPaletteValuesRule/basePalette) + */ + readonly basePalette: string; + /** + * The read-only **`fontFamily`** property of the CSSFontPaletteValuesRule interface lists the font families the rule can be applied to. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontPaletteValuesRule/fontFamily) + */ + readonly fontFamily: string; + /** + * The read-only **`name`** property of the CSSFontPaletteValuesRule interface represents the name identifying the associated @font-palette-values at-rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontPaletteValuesRule/name) + */ + readonly name: string; + /** + * The read-only **`overrideColors`** property of the CSSFontPaletteValuesRule interface is a string containing a list of color index and color pair that are to be used instead. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontPaletteValuesRule/overrideColors) + */ + readonly overrideColors: string; +} + +declare var CSSFontPaletteValuesRule: { + prototype: CSSFontPaletteValuesRule; + new(): CSSFontPaletteValuesRule; +}; + +/** + * The **`CSSGroupingRule`** interface of the CSS Object Model represents any CSS at-rule that contains other rules nested within it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSGroupingRule) + */ +interface CSSGroupingRule extends CSSRule { + /** + * The **`cssRules`** property of the a collection of CSSRule objects. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSGroupingRule/cssRules) + */ + readonly cssRules: CSSRuleList; + /** + * The **`deleteRule()`** method of the rules. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSGroupingRule/deleteRule) + */ + deleteRule(index: number): void; + /** + * The **`insertRule()`** method of the ```js-nolint insertRule(rule) insertRule(rule, index) ``` - `rule` - : A string - `index` [MISSING: optional_inline] - : An optional index at which to insert the rule; defaults to 0. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSGroupingRule/insertRule) + */ + insertRule(rule: string, index?: number): number; +} + +declare var CSSGroupingRule: { + prototype: CSSGroupingRule; + new(): CSSGroupingRule; +}; + +/** + * The **`CSSImageValue`** interface of the CSS Typed Object Model API represents values for properties that take an image, for example background-image, list-style-image, or border-image-source. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSImageValue) + */ +interface CSSImageValue extends CSSStyleValue { +} + +declare var CSSImageValue: { + prototype: CSSImageValue; + new(): CSSImageValue; +}; + +/** + * The **`CSSImportRule`** interface represents an @import at-rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSImportRule) + */ +interface CSSImportRule extends CSSRule { + /** + * The read-only **`href`** property of the The resolved URL will be the `href` attribute of the associated stylesheet. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSImportRule/href) + */ + readonly href: string; + /** + * The read-only **`layerName`** property of the CSSImportRule interface returns the name of the cascade layer created by the @import at-rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSImportRule/layerName) + */ + readonly layerName: string | null; + /** + * The read-only **`media`** property of the containing the value of the `media` attribute of the associated stylesheet. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSImportRule/media) + */ + get media(): MediaList; + set media(mediaText: string); + /** + * The read-only **`styleSheet`** property of the in the form of a CSSStyleSheet object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSImportRule/styleSheet) + */ + readonly styleSheet: CSSStyleSheet | null; + /** + * The read-only **`supportsText`** property of the CSSImportRule interface returns the supports condition specified by the @import at-rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSImportRule/supportsText) + */ + readonly supportsText: string | null; +} + +declare var CSSImportRule: { + prototype: CSSImportRule; + new(): CSSImportRule; +}; + +/** + * The **`CSSKeyframeRule`** interface describes an object representing a set of styles for a given keyframe. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframeRule) + */ +interface CSSKeyframeRule extends CSSRule { + /** + * The **`keyText`** property of the CSSKeyframeRule interface represents the keyframe selector as a comma-separated list of percentage values. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframeRule/keyText) + */ + keyText: string; + /** + * The read-only **`CSSKeyframeRule.style`** property is the CSSStyleDeclaration interface for the declaration block of the CSSKeyframeRule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframeRule/style) + */ + get style(): CSSStyleDeclaration; + set style(cssText: string); +} + +declare var CSSKeyframeRule: { + prototype: CSSKeyframeRule; + new(): CSSKeyframeRule; +}; + +/** + * The **`CSSKeyframesRule`** interface describes an object representing a complete set of keyframes for a CSS animation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframesRule) + */ +interface CSSKeyframesRule extends CSSRule { + /** + * The read-only **`cssRules`** property of the CSSKeyframeRule interface returns a CSSRuleList containing the rules in the keyframes at-rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframesRule/cssRules) + */ + readonly cssRules: CSSRuleList; + /** + * The read-only **`length`** property of the CSSKeyframeRule interface returns the number of CSSKeyframeRule objects in its list. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframesRule/length) + */ + readonly length: number; + /** + * The **`name`** property of the CSSKeyframeRule interface gets and sets the name of the animation as used by the animation-name property. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframesRule/name) + */ + name: string; + /** + * The **`appendRule()`** method of the CSSKeyframeRule interface appends a CSSKeyFrameRule to the end of the rules. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframesRule/appendRule) + */ + appendRule(rule: string): void; + /** + * The **`deleteRule()`** method of the CSSKeyframeRule interface deletes the CSSKeyFrameRule that matches the specified keyframe selector. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframesRule/deleteRule) + */ + deleteRule(select: string): void; + /** + * The **`findRule()`** method of the CSSKeyframeRule interface finds the CSSKeyFrameRule that matches the specified keyframe selector. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframesRule/findRule) + */ + findRule(select: string): CSSKeyframeRule | null; + [index: number]: CSSKeyframeRule; +} + +declare var CSSKeyframesRule: { + prototype: CSSKeyframesRule; + new(): CSSKeyframesRule; +}; + +/** + * The **`CSSKeywordValue`** interface of the CSS Typed Object Model API creates an object to represent CSS keywords and other identifiers. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeywordValue) + */ +interface CSSKeywordValue extends CSSStyleValue { + /** + * The **`value`** property of the `CSSKeywordValue`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeywordValue/value) + */ + value: string; +} + +declare var CSSKeywordValue: { + prototype: CSSKeywordValue; + new(value: string): CSSKeywordValue; +}; + +/** + * The **`CSSLayerBlockRule`** represents a @layer block rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSLayerBlockRule) + */ +interface CSSLayerBlockRule extends CSSGroupingRule { + /** + * The read-only **`name`** property of the CSSLayerBlockRule interface represents the name of the associated cascade layer. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSLayerBlockRule/name) + */ + readonly name: string; +} + +declare var CSSLayerBlockRule: { + prototype: CSSLayerBlockRule; + new(): CSSLayerBlockRule; +}; + +/** + * The **`CSSLayerStatementRule`** represents a @layer statement rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSLayerStatementRule) + */ +interface CSSLayerStatementRule extends CSSRule { + /** + * The read-only **`nameList`** property of the CSSLayerStatementRule interface return the list of associated cascade layer names. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSLayerStatementRule/nameList) + */ + readonly nameList: ReadonlyArray; +} + +declare var CSSLayerStatementRule: { + prototype: CSSLayerStatementRule; + new(): CSSLayerStatementRule; +}; + +interface CSSMathClamp extends CSSMathValue { + readonly lower: CSSNumericValue; + readonly upper: CSSNumericValue; + readonly value: CSSNumericValue; +} + +declare var CSSMathClamp: { + prototype: CSSMathClamp; + new(lower: CSSNumberish, value: CSSNumberish, upper: CSSNumberish): CSSMathClamp; +}; + +/** + * The **`CSSMathInvert`** interface of the CSS Typed Object Model API represents a CSS calc used as `calc(1 / )`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathInvert) + */ +interface CSSMathInvert extends CSSMathValue { + /** + * The CSSMathInvert.value read-only property of the A CSSNumericValue. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathInvert/value) + */ + readonly value: CSSNumericValue; +} + +declare var CSSMathInvert: { + prototype: CSSMathInvert; + new(arg: CSSNumberish): CSSMathInvert; +}; + +/** + * The **`CSSMathMax`** interface of the CSS Typed Object Model API represents the CSS max function. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathMax) + */ +interface CSSMathMax extends CSSMathValue { + /** + * The CSSMathMax.values read-only property of the which contains one or more CSSNumericValue objects. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathMax/values) + */ + readonly values: CSSNumericArray; +} + +declare var CSSMathMax: { + prototype: CSSMathMax; + new(...args: CSSNumberish[]): CSSMathMax; +}; + +/** + * The **`CSSMathMin`** interface of the CSS Typed Object Model API represents the CSS min function. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathMin) + */ +interface CSSMathMin extends CSSMathValue { + /** + * The CSSMathMin.values read-only property of the which contains one or more CSSNumericValue objects. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathMin/values) + */ + readonly values: CSSNumericArray; +} + +declare var CSSMathMin: { + prototype: CSSMathMin; + new(...args: CSSNumberish[]): CSSMathMin; +}; + +/** + * The **`CSSMathNegate`** interface of the CSS Typed Object Model API negates the value passed into it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathNegate) + */ +interface CSSMathNegate extends CSSMathValue { + /** + * The CSSMathNegate.value read-only property of the A CSSNumericValue. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathNegate/value) + */ + readonly value: CSSNumericValue; +} + +declare var CSSMathNegate: { + prototype: CSSMathNegate; + new(arg: CSSNumberish): CSSMathNegate; +}; + +/** + * The **`CSSMathProduct`** interface of the CSS Typed Object Model API represents the result obtained by calling CSSNumericValue.add, CSSNumericValue.sub, or CSSNumericValue.toSum on CSSNumericValue. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathProduct) + */ +interface CSSMathProduct extends CSSMathValue { + /** + * The **`CSSMathProduct.values`** read-only property of the CSSMathProduct interface returns a A CSSNumericArray. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathProduct/values) + */ + readonly values: CSSNumericArray; +} + +declare var CSSMathProduct: { + prototype: CSSMathProduct; + new(...args: CSSNumberish[]): CSSMathProduct; +}; + +/** + * The **`CSSMathSum`** interface of the CSS Typed Object Model API represents the result obtained by calling CSSNumericValue.add, CSSNumericValue.sub, or CSSNumericValue.toSum on CSSNumericValue. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathSum) + */ +interface CSSMathSum extends CSSMathValue { + /** + * The **`CSSMathSum.values`** read-only property of the CSSMathSum interface returns a CSSNumericArray object which contains one or more CSSNumericValue objects. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathSum/values) + */ + readonly values: CSSNumericArray; +} + +declare var CSSMathSum: { + prototype: CSSMathSum; + new(...args: CSSNumberish[]): CSSMathSum; +}; + +/** + * The **`CSSMathValue`** interface of the CSS Typed Object Model API a base class for classes representing complex numeric values. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathValue) + */ +interface CSSMathValue extends CSSNumericValue { + /** + * The **`CSSMathValue.operator`** read-only property of the CSSMathValue interface indicates the operator that the current subtype represents. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathValue/operator) + */ + readonly operator: CSSMathOperator; +} + +declare var CSSMathValue: { + prototype: CSSMathValue; + new(): CSSMathValue; +}; + +/** + * The **`CSSMatrixComponent`** interface of the CSS Typed Object Model API represents the matrix() and matrix3d() values of the individual transform property in CSS. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMatrixComponent) + */ +interface CSSMatrixComponent extends CSSTransformComponent { + /** + * The **`matrix`** property of the See the matrix() and matrix3d() pages for examples. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMatrixComponent/matrix) + */ + matrix: DOMMatrix; +} + +declare var CSSMatrixComponent: { + prototype: CSSMatrixComponent; + new(matrix: DOMMatrixReadOnly, options?: CSSMatrixComponentOptions): CSSMatrixComponent; +}; + +/** + * The **`CSSMediaRule`** interface represents a single CSS @media rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMediaRule) + */ +interface CSSMediaRule extends CSSConditionRule { + /** + * The read-only **`media`** property of the destination medium for style information. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMediaRule/media) + */ + get media(): MediaList; + set media(mediaText: string); +} + +declare var CSSMediaRule: { + prototype: CSSMediaRule; + new(): CSSMediaRule; +}; + +/** + * The **`CSSNamespaceRule`** interface describes an object representing a single CSS @namespace at-rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNamespaceRule) + */ +interface CSSNamespaceRule extends CSSRule { + /** + * The read-only **`namespaceURI`** property of the CSSNamespaceRule returns a string containing the text of the URI of the given namespace. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNamespaceRule/namespaceURI) + */ + readonly namespaceURI: string; + /** + * The read-only **`prefix`** property of the CSSNamespaceRule returns a string with the name of the prefix associated to this namespace. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNamespaceRule/prefix) + */ + readonly prefix: string; +} + +declare var CSSNamespaceRule: { + prototype: CSSNamespaceRule; + new(): CSSNamespaceRule; +}; + +/** + * The **`CSSNestedDeclarations`** interface of the CSS Rule API is used to group nested CSSRules. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNestedDeclarations) + */ +interface CSSNestedDeclarations extends CSSRule { + /** + * The read-only **`style`** property of the CSSNestedDeclarations interface represents the styles associated with the nested rules. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNestedDeclarations/style) + */ + get style(): CSSStyleDeclaration; + set style(cssText: string); +} + +declare var CSSNestedDeclarations: { + prototype: CSSNestedDeclarations; + new(): CSSNestedDeclarations; +}; + +/** + * The **`CSSNumericArray`** interface of the CSS Typed Object Model API contains a list of CSSNumericValue objects. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericArray) + */ +interface CSSNumericArray { + /** + * The read-only **`length`** property of the An integer representing the number of CSSNumericValue objects in the list. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericArray/length) + */ + readonly length: number; + forEach(callbackfn: (value: CSSNumericValue, key: number, parent: CSSNumericArray) => void, thisArg?: any): void; + [index: number]: CSSNumericValue; +} + +declare var CSSNumericArray: { + prototype: CSSNumericArray; + new(): CSSNumericArray; +}; + +/** + * The **`CSSNumericValue`** interface of the CSS Typed Object Model API represents operations that all numeric values can perform. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue) + */ +interface CSSNumericValue extends CSSStyleValue { + /** + * The **`add()`** method of the `CSSNumericValue`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/add) + */ + add(...values: CSSNumberish[]): CSSNumericValue; + /** + * The **`div()`** method of the supplied value. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/div) + */ + div(...values: CSSNumberish[]): CSSNumericValue; + /** + * The **`equals()`** method of the value are strictly equal. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/equals) + */ + equals(...value: CSSNumberish[]): boolean; + /** + * The **`max()`** method of the passed. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/max) + */ + max(...values: CSSNumberish[]): CSSNumericValue; + /** + * The **`min()`** method of the values passed. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/min) + */ + min(...values: CSSNumberish[]): CSSNumericValue; + /** + * The **`mul()`** method of the the supplied value. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/mul) + */ + mul(...values: CSSNumberish[]): CSSNumericValue; + /** + * The **`sub()`** method of the `CSSNumericValue`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/sub) + */ + sub(...values: CSSNumberish[]): CSSNumericValue; + /** + * The **`to()`** method of the another. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/to) + */ + to(unit: string): CSSUnitValue; + /** + * The **`toSum()`** method of the ```js-nolint toSum(units) ``` - `units` - : The units to convert to. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/toSum) + */ + toSum(...units: string[]): CSSMathSum; + /** + * The **`type()`** method of the `CSSNumericValue`, one of `angle`, `flex`, `frequency`, `length`, `resolution`, `percent`, `percentHint`, or `time`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/type) + */ + type(): CSSNumericType; +} + +declare var CSSNumericValue: { + prototype: CSSNumericValue; + new(): CSSNumericValue; + /** + * The **`parse()`** static method of the members are value and the units. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/parse_static) + */ + parse(cssText: string): CSSNumericValue; +}; + +/** + * **`CSSPageRule`** represents a single CSS @page rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPageRule) + */ +interface CSSPageRule extends CSSGroupingRule { + /** + * The **`selectorText`** property of the CSSPageRule interface gets and sets the selectors associated with the `CSSPageRule`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPageRule/selectorText) + */ + selectorText: string; + /** + * The **`style`** read-only property of the CSSPageRule interface returns a CSSPageDescriptors object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPageRule/style) + */ + get style(): CSSStyleDeclaration; + set style(cssText: string); +} + +declare var CSSPageRule: { + prototype: CSSPageRule; + new(): CSSPageRule; +}; + +/** + * The **`CSSPerspective`** interface of the CSS Typed Object Model API represents the perspective() value of the individual transform property in CSS. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPerspective) + */ +interface CSSPerspective extends CSSTransformComponent { + /** + * The **`length`** property of the It is used to apply a perspective transform to the element and its content. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPerspective/length) + */ + length: CSSPerspectiveValue; +} + +declare var CSSPerspective: { + prototype: CSSPerspective; + new(length: CSSPerspectiveValue): CSSPerspective; +}; + +/** + * The **`CSSPropertyRule`** interface of the CSS Properties and Values API represents a single CSS @property rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPropertyRule) + */ +interface CSSPropertyRule extends CSSRule { + /** + * The read-only **`inherits`** property of the CSSPropertyRule interface returns the inherit flag of the custom property registration represented by the @property rule, a boolean describing whether or not the property inherits by default. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPropertyRule/inherits) + */ + readonly inherits: boolean; + /** + * The read-only **`initialValue`** nullable property of the CSSPropertyRule interface returns the initial value of the custom property registration represented by the @property rule, controlling the property's initial value. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPropertyRule/initialValue) + */ + readonly initialValue: string | null; + /** + * The read-only **`name`** property of the CSSPropertyRule interface represents the property name, this being the serialization of the name given to the custom property in the @property rule's prelude. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPropertyRule/name) + */ + readonly name: string; + /** + * The read-only **`syntax`** property of the CSSPropertyRule interface returns the literal syntax of the custom property registration represented by the @property rule, controlling how the property's value is parsed at computed-value time. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPropertyRule/syntax) + */ + readonly syntax: string; +} + +declare var CSSPropertyRule: { + prototype: CSSPropertyRule; + new(): CSSPropertyRule; +}; + +/** + * The **`CSSRotate`** interface of the CSS Typed Object Model API represents the rotate value of the individual transform property in CSS. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRotate) + */ +interface CSSRotate extends CSSTransformComponent { + /** + * The **`angle`** property of the denotes a clockwise rotation, a negative angle a counter-clockwise one. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRotate/angle) + */ + angle: CSSNumericValue; + /** + * The **`x`** property of the translating vector. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRotate/x) + */ + x: CSSNumberish; + /** + * The **`y`** property of the translating vector. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRotate/y) + */ + y: CSSNumberish; + /** + * The **`z`** property of the vector. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRotate/z) + */ + z: CSSNumberish; +} + +declare var CSSRotate: { + prototype: CSSRotate; + new(angle: CSSNumericValue): CSSRotate; + new(x: CSSNumberish, y: CSSNumberish, z: CSSNumberish, angle: CSSNumericValue): CSSRotate; +}; + +/** + * The **`CSSRule`** interface represents a single CSS rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRule) + */ +interface CSSRule { + /** + * The **`cssText`** property of the CSSRule interface returns the actual text of a CSSStyleSheet style-rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRule/cssText) + */ + cssText: string; + /** + * The **`parentRule`** property of the CSSRule interface returns the containing rule of the current rule if this exists, or otherwise returns null. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRule/parentRule) + */ + readonly parentRule: CSSRule | null; + /** + * The **`parentStyleSheet`** property of the the current rule is defined. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRule/parentStyleSheet) + */ + readonly parentStyleSheet: CSSStyleSheet | null; + /** + * The read-only **`type`** property of the indicating which type of rule the CSSRule represents. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRule/type) + */ + readonly type: number; + readonly STYLE_RULE: 1; + readonly CHARSET_RULE: 2; + readonly IMPORT_RULE: 3; + readonly MEDIA_RULE: 4; + readonly FONT_FACE_RULE: 5; + readonly PAGE_RULE: 6; + readonly NAMESPACE_RULE: 10; + readonly KEYFRAMES_RULE: 7; + readonly KEYFRAME_RULE: 8; + readonly SUPPORTS_RULE: 12; + readonly COUNTER_STYLE_RULE: 11; + readonly FONT_FEATURE_VALUES_RULE: 14; +} + +declare var CSSRule: { + prototype: CSSRule; + new(): CSSRule; + readonly STYLE_RULE: 1; + readonly CHARSET_RULE: 2; + readonly IMPORT_RULE: 3; + readonly MEDIA_RULE: 4; + readonly FONT_FACE_RULE: 5; + readonly PAGE_RULE: 6; + readonly NAMESPACE_RULE: 10; + readonly KEYFRAMES_RULE: 7; + readonly KEYFRAME_RULE: 8; + readonly SUPPORTS_RULE: 12; + readonly COUNTER_STYLE_RULE: 11; + readonly FONT_FEATURE_VALUES_RULE: 14; +}; + +/** + * A `CSSRuleList` represents an ordered collection of read-only CSSRule objects. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRuleList) + */ +interface CSSRuleList { + /** + * The **`length`** property of the CSSRuleList interface returns the number of CSSRule objects in the list. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRuleList/length) + */ + readonly length: number; + /** + * The **`item()`** method of the CSSRuleList interface returns the CSSRule object at the specified `index` or `null` if the specified `index` doesn't exist. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRuleList/item) + */ + item(index: number): CSSRule | null; + [index: number]: CSSRule; +} + +declare var CSSRuleList: { + prototype: CSSRuleList; + new(): CSSRuleList; +}; + +/** + * The **`CSSScale`** interface of the CSS Typed Object Model API represents the scale() and scale3d() values of the individual transform property in CSS. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSScale) + */ +interface CSSScale extends CSSTransformComponent { + /** + * The **`x`** property of the translating vector. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSScale/x) + */ + x: CSSNumberish; + /** + * The **`y`** property of the translating vector. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSScale/y) + */ + y: CSSNumberish; + /** + * The **`z`** property of the vector. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSScale/z) + */ + z: CSSNumberish; +} + +declare var CSSScale: { + prototype: CSSScale; + new(x: CSSNumberish, y: CSSNumberish, z?: CSSNumberish): CSSScale; +}; + +/** + * The **`CSSScopeRule`** interface of the CSS Object Model represents a CSS @scope at-rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSScopeRule) + */ +interface CSSScopeRule extends CSSGroupingRule { + /** + * The **`end`** property of the CSSScopeRule interface returns a string containing the value of the `@scope` at-rule's scope limit. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSScopeRule/end) + */ + readonly end: string | null; + /** + * The **`start`** property of the CSSScopeRule interface returns a string containing the value of the `@scope` at-rule's scope root. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSScopeRule/start) + */ + readonly start: string | null; +} + +declare var CSSScopeRule: { + prototype: CSSScopeRule; + new(): CSSScopeRule; +}; + +/** + * The **`CSSSkew`** interface of the CSS Typed Object Model API is part of the CSSTransformValue interface. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSSkew) + */ +interface CSSSkew extends CSSTransformComponent { + /** + * The **`ax`** property of the along the x-axis (or abscissa). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSSkew/ax) + */ + ax: CSSNumericValue; + /** + * The **`ay`** property of the along the y-axis (or ordinate). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSSkew/ay) + */ + ay: CSSNumericValue; +} + +declare var CSSSkew: { + prototype: CSSSkew; + new(ax: CSSNumericValue, ay: CSSNumericValue): CSSSkew; +}; + +/** + * The **`CSSSkewX`** interface of the CSS Typed Object Model API represents the `skewX()` value of the individual transform property in CSS. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSSkewX) + */ +interface CSSSkewX extends CSSTransformComponent { + /** + * The **`ax`** property of the along the x-axis (or abscissa). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSSkewX/ax) + */ + ax: CSSNumericValue; +} + +declare var CSSSkewX: { + prototype: CSSSkewX; + new(ax: CSSNumericValue): CSSSkewX; +}; + +/** + * The **`CSSSkewY`** interface of the CSS Typed Object Model API represents the `skewY()` value of the individual transform property in CSS. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSSkewY) + */ +interface CSSSkewY extends CSSTransformComponent { + /** + * The **`ay`** property of the along the y-axis (or ordinate). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSSkewY/ay) + */ + ay: CSSNumericValue; +} + +declare var CSSSkewY: { + prototype: CSSSkewY; + new(ay: CSSNumericValue): CSSSkewY; +}; + +/** + * The **`CSSStartingStyleRule`** interface of the CSS Object Model represents a CSS @starting-style at-rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStartingStyleRule) + */ +interface CSSStartingStyleRule extends CSSGroupingRule { +} + +declare var CSSStartingStyleRule: { + prototype: CSSStartingStyleRule; + new(): CSSStartingStyleRule; +}; + +/** + * The **`CSSStyleDeclaration`** interface represents an object that is a CSS declaration block, and exposes style information and various style-related methods and properties. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration) + */ +interface CSSStyleDeclaration { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/accent-color) */ + accentColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/align-content) */ + alignContent: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/align-items) */ + alignItems: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/align-self) */ + alignSelf: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/alignment-baseline) */ + alignmentBaseline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/all) */ + all: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation) */ + animation: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-composition) */ + animationComposition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-delay) */ + animationDelay: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-direction) */ + animationDirection: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-duration) */ + animationDuration: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-fill-mode) */ + animationFillMode: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-iteration-count) */ + animationIterationCount: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-name) */ + animationName: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-play-state) */ + animationPlayState: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-timing-function) */ + animationTimingFunction: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/appearance) */ + appearance: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/aspect-ratio) */ + aspectRatio: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/backdrop-filter) */ + backdropFilter: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/backface-visibility) */ + backfaceVisibility: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background) */ + background: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-attachment) */ + backgroundAttachment: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-blend-mode) */ + backgroundBlendMode: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-clip) */ + backgroundClip: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-color) */ + backgroundColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-image) */ + backgroundImage: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-origin) */ + backgroundOrigin: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-position) */ + backgroundPosition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-position-x) */ + backgroundPositionX: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-position-y) */ + backgroundPositionY: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-repeat) */ + backgroundRepeat: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-size) */ + backgroundSize: string; + baselineShift: string; + baselineSource: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/block-size) */ + blockSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border) */ + border: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block) */ + borderBlock: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-color) */ + borderBlockColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-end) */ + borderBlockEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-end-color) */ + borderBlockEndColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-end-style) */ + borderBlockEndStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-end-width) */ + borderBlockEndWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-start) */ + borderBlockStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-start-color) */ + borderBlockStartColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-start-style) */ + borderBlockStartStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-start-width) */ + borderBlockStartWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-style) */ + borderBlockStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-width) */ + borderBlockWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-bottom) */ + borderBottom: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-bottom-color) */ + borderBottomColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-bottom-left-radius) */ + borderBottomLeftRadius: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-bottom-right-radius) */ + borderBottomRightRadius: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-bottom-style) */ + borderBottomStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-bottom-width) */ + borderBottomWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-collapse) */ + borderCollapse: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-color) */ + borderColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-end-end-radius) */ + borderEndEndRadius: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-end-start-radius) */ + borderEndStartRadius: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-image) */ + borderImage: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-image-outset) */ + borderImageOutset: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-image-repeat) */ + borderImageRepeat: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-image-slice) */ + borderImageSlice: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-image-source) */ + borderImageSource: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-image-width) */ + borderImageWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline) */ + borderInline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-color) */ + borderInlineColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-end) */ + borderInlineEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-end-color) */ + borderInlineEndColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-end-style) */ + borderInlineEndStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-end-width) */ + borderInlineEndWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-start) */ + borderInlineStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-start-color) */ + borderInlineStartColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-start-style) */ + borderInlineStartStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-start-width) */ + borderInlineStartWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-style) */ + borderInlineStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-width) */ + borderInlineWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-left) */ + borderLeft: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-left-color) */ + borderLeftColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-left-style) */ + borderLeftStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-left-width) */ + borderLeftWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-radius) */ + borderRadius: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-right) */ + borderRight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-right-color) */ + borderRightColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-right-style) */ + borderRightStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-right-width) */ + borderRightWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-spacing) */ + borderSpacing: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-start-end-radius) */ + borderStartEndRadius: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-start-start-radius) */ + borderStartStartRadius: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-style) */ + borderStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-top) */ + borderTop: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-top-color) */ + borderTopColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-top-left-radius) */ + borderTopLeftRadius: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-top-right-radius) */ + borderTopRightRadius: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-top-style) */ + borderTopStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-top-width) */ + borderTopWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-width) */ + borderWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/bottom) */ + bottom: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/box-decoration-break) */ + boxDecorationBreak: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/box-shadow) */ + boxShadow: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/box-sizing) */ + boxSizing: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/break-after) */ + breakAfter: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/break-before) */ + breakBefore: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/break-inside) */ + breakInside: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/caption-side) */ + captionSide: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/caret-color) */ + caretColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/clear) */ + clear: string; + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/clip) + */ + clip: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/clip-path) */ + clipPath: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/clip-rule) */ + clipRule: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/color) */ + color: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/color-interpolation) */ + colorInterpolation: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/color-interpolation-filters) */ + colorInterpolationFilters: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/color-scheme) */ + colorScheme: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/column-count) */ + columnCount: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/column-fill) */ + columnFill: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/column-gap) */ + columnGap: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/column-rule) */ + columnRule: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/column-rule-color) */ + columnRuleColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/column-rule-style) */ + columnRuleStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/column-rule-width) */ + columnRuleWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/column-span) */ + columnSpan: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/column-width) */ + columnWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/columns) */ + columns: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/contain) */ + contain: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/contain-intrinsic-block-size) */ + containIntrinsicBlockSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/contain-intrinsic-height) */ + containIntrinsicHeight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/contain-intrinsic-inline-size) */ + containIntrinsicInlineSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/contain-intrinsic-size) */ + containIntrinsicSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/contain-intrinsic-width) */ + containIntrinsicWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/container) */ + container: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/container-name) */ + containerName: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/container-type) */ + containerType: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/content) */ + content: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/content-visibility) */ + contentVisibility: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/counter-increment) */ + counterIncrement: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/counter-reset) */ + counterReset: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/counter-set) */ + counterSet: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/cssFloat) */ + cssFloat: string; + /** + * The **`cssText`** property of the CSSStyleDeclaration interface returns or sets the text of the element's **inline** style declaration only. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/cssText) + */ + cssText: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/cursor) */ + cursor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/cx) */ + cx: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/cy) */ + cy: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/d) */ + d: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/direction) */ + direction: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/display) */ + display: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/dominant-baseline) */ + dominantBaseline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/empty-cells) */ + emptyCells: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/fill) */ + fill: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/fill-opacity) */ + fillOpacity: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/fill-rule) */ + fillRule: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/filter) */ + filter: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex) */ + flex: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-basis) */ + flexBasis: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-direction) */ + flexDirection: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-flow) */ + flexFlow: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-grow) */ + flexGrow: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-shrink) */ + flexShrink: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-wrap) */ + flexWrap: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/float) */ + float: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flood-color) */ + floodColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flood-opacity) */ + floodOpacity: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font) */ + font: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-family) */ + fontFamily: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-feature-settings) */ + fontFeatureSettings: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-kerning) */ + fontKerning: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-optical-sizing) */ + fontOpticalSizing: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-palette) */ + fontPalette: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-size) */ + fontSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-size-adjust) */ + fontSizeAdjust: string; + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-stretch) + */ + fontStretch: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-style) */ + fontStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-synthesis) */ + fontSynthesis: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-synthesis-small-caps) */ + fontSynthesisSmallCaps: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-synthesis-style) */ + fontSynthesisStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-synthesis-weight) */ + fontSynthesisWeight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-variant) */ + fontVariant: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-variant-alternates) */ + fontVariantAlternates: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-variant-caps) */ + fontVariantCaps: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-variant-east-asian) */ + fontVariantEastAsian: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-variant-ligatures) */ + fontVariantLigatures: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-variant-numeric) */ + fontVariantNumeric: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-variant-position) */ + fontVariantPosition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-variation-settings) */ + fontVariationSettings: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-weight) */ + fontWeight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/forced-color-adjust) */ + forcedColorAdjust: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/gap) */ + gap: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid) */ + grid: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-area) */ + gridArea: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-auto-columns) */ + gridAutoColumns: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-auto-flow) */ + gridAutoFlow: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-auto-rows) */ + gridAutoRows: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-column) */ + gridColumn: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-column-end) */ + gridColumnEnd: string; + /** @deprecated This is a legacy alias of `columnGap`. */ + gridColumnGap: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-column-start) */ + gridColumnStart: string; + /** @deprecated This is a legacy alias of `gap`. */ + gridGap: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-row) */ + gridRow: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-row-end) */ + gridRowEnd: string; + /** @deprecated This is a legacy alias of `rowGap`. */ + gridRowGap: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-row-start) */ + gridRowStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-template) */ + gridTemplate: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-template-areas) */ + gridTemplateAreas: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-template-columns) */ + gridTemplateColumns: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-template-rows) */ + gridTemplateRows: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/height) */ + height: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/hyphenate-character) */ + hyphenateCharacter: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/hyphenate-limit-chars) */ + hyphenateLimitChars: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/hyphens) */ + hyphens: string; + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/image-orientation) + */ + imageOrientation: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/image-rendering) */ + imageRendering: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/inline-size) */ + inlineSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/inset) */ + inset: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/inset-block) */ + insetBlock: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/inset-block-end) */ + insetBlockEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/inset-block-start) */ + insetBlockStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/inset-inline) */ + insetInline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/inset-inline-end) */ + insetInlineEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/inset-inline-start) */ + insetInlineStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/isolation) */ + isolation: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/justify-content) */ + justifyContent: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/justify-items) */ + justifyItems: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/justify-self) */ + justifySelf: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/left) */ + left: string; + /** + * The read-only property returns an integer that represents the number of style declarations in this CSS declaration block. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/length) + */ + readonly length: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/letter-spacing) */ + letterSpacing: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/lighting-color) */ + lightingColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/line-break) */ + lineBreak: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/line-height) */ + lineHeight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/list-style) */ + listStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/list-style-image) */ + listStyleImage: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/list-style-position) */ + listStylePosition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/list-style-type) */ + listStyleType: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin) */ + margin: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-block) */ + marginBlock: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-block-end) */ + marginBlockEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-block-start) */ + marginBlockStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-bottom) */ + marginBottom: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-inline) */ + marginInline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-inline-end) */ + marginInlineEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-inline-start) */ + marginInlineStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-left) */ + marginLeft: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-right) */ + marginRight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-top) */ + marginTop: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/marker) */ + marker: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/marker-end) */ + markerEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/marker-mid) */ + markerMid: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/marker-start) */ + markerStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask) */ + mask: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-clip) */ + maskClip: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-composite) */ + maskComposite: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-image) */ + maskImage: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-mode) */ + maskMode: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-origin) */ + maskOrigin: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-position) */ + maskPosition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-repeat) */ + maskRepeat: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-size) */ + maskSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-type) */ + maskType: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/math-depth) */ + mathDepth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/math-style) */ + mathStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/max-block-size) */ + maxBlockSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/max-height) */ + maxHeight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/max-inline-size) */ + maxInlineSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/max-width) */ + maxWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/min-block-size) */ + minBlockSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/min-height) */ + minHeight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/min-inline-size) */ + minInlineSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/min-width) */ + minWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mix-blend-mode) */ + mixBlendMode: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/object-fit) */ + objectFit: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/object-position) */ + objectPosition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/offset) */ + offset: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/offset-anchor) */ + offsetAnchor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/offset-distance) */ + offsetDistance: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/offset-path) */ + offsetPath: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/offset-position) */ + offsetPosition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/offset-rotate) */ + offsetRotate: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/opacity) */ + opacity: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/order) */ + order: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/orphans) */ + orphans: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/outline) */ + outline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/outline-color) */ + outlineColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/outline-offset) */ + outlineOffset: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/outline-style) */ + outlineStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/outline-width) */ + outlineWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overflow) */ + overflow: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overflow-anchor) */ + overflowAnchor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overflow-block) */ + overflowBlock: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overflow-clip-margin) */ + overflowClipMargin: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overflow-inline) */ + overflowInline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overflow-wrap) */ + overflowWrap: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overflow-x) */ + overflowX: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overflow-y) */ + overflowY: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior) */ + overscrollBehavior: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-block) */ + overscrollBehaviorBlock: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-inline) */ + overscrollBehaviorInline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-x) */ + overscrollBehaviorX: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-y) */ + overscrollBehaviorY: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding) */ + padding: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding-block) */ + paddingBlock: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding-block-end) */ + paddingBlockEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding-block-start) */ + paddingBlockStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding-bottom) */ + paddingBottom: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding-inline) */ + paddingInline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding-inline-end) */ + paddingInlineEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding-inline-start) */ + paddingInlineStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding-left) */ + paddingLeft: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding-right) */ + paddingRight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding-top) */ + paddingTop: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/page) */ + page: string; + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/page-break-after) + */ + pageBreakAfter: string; + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/page-break-before) + */ + pageBreakBefore: string; + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/page-break-inside) + */ + pageBreakInside: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/paint-order) */ + paintOrder: string; + /** + * The **CSSStyleDeclaration.parentRule** read-only property returns a CSSRule that is the parent of this style block, e.g., a CSSStyleRule representing the style for a CSS selector. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/parentRule) + */ + readonly parentRule: CSSRule | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/perspective) */ + perspective: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/perspective-origin) */ + perspectiveOrigin: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/place-content) */ + placeContent: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/place-items) */ + placeItems: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/place-self) */ + placeSelf: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/pointer-events) */ + pointerEvents: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/position) */ + position: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/print-color-adjust) */ + printColorAdjust: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/quotes) */ + quotes: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/r) */ + r: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/resize) */ + resize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/right) */ + right: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/rotate) */ + rotate: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/row-gap) */ + rowGap: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/ruby-align) */ + rubyAlign: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/ruby-position) */ + rubyPosition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/rx) */ + rx: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/ry) */ + ry: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scale) */ + scale: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-behavior) */ + scrollBehavior: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin) */ + scrollMargin: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block) */ + scrollMarginBlock: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block-end) */ + scrollMarginBlockEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block-start) */ + scrollMarginBlockStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin-bottom) */ + scrollMarginBottom: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline) */ + scrollMarginInline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline-end) */ + scrollMarginInlineEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline-start) */ + scrollMarginInlineStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin-left) */ + scrollMarginLeft: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin-right) */ + scrollMarginRight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin-top) */ + scrollMarginTop: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding) */ + scrollPadding: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block) */ + scrollPaddingBlock: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block-end) */ + scrollPaddingBlockEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block-start) */ + scrollPaddingBlockStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding-bottom) */ + scrollPaddingBottom: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline) */ + scrollPaddingInline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline-end) */ + scrollPaddingInlineEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline-start) */ + scrollPaddingInlineStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding-left) */ + scrollPaddingLeft: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding-right) */ + scrollPaddingRight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding-top) */ + scrollPaddingTop: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-snap-align) */ + scrollSnapAlign: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-snap-stop) */ + scrollSnapStop: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type) */ + scrollSnapType: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scrollbar-color) */ + scrollbarColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scrollbar-gutter) */ + scrollbarGutter: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scrollbar-width) */ + scrollbarWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/shape-image-threshold) */ + shapeImageThreshold: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/shape-margin) */ + shapeMargin: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/shape-outside) */ + shapeOutside: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/shape-rendering) */ + shapeRendering: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/stop-color) */ + stopColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/stop-opacity) */ + stopOpacity: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/stroke) */ + stroke: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/stroke-dasharray) */ + strokeDasharray: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/stroke-dashoffset) */ + strokeDashoffset: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/stroke-linecap) */ + strokeLinecap: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/stroke-linejoin) */ + strokeLinejoin: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/stroke-miterlimit) */ + strokeMiterlimit: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/stroke-opacity) */ + strokeOpacity: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/stroke-width) */ + strokeWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/tab-size) */ + tabSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/table-layout) */ + tableLayout: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-align) */ + textAlign: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-align-last) */ + textAlignLast: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-anchor) */ + textAnchor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-box) */ + textBox: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-box-edge) */ + textBoxEdge: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-box-trim) */ + textBoxTrim: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-combine-upright) */ + textCombineUpright: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-decoration) */ + textDecoration: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-decoration-color) */ + textDecorationColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-decoration-line) */ + textDecorationLine: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-decoration-skip-ink) */ + textDecorationSkipInk: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-decoration-style) */ + textDecorationStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-decoration-thickness) */ + textDecorationThickness: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-emphasis) */ + textEmphasis: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-emphasis-color) */ + textEmphasisColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-emphasis-position) */ + textEmphasisPosition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-emphasis-style) */ + textEmphasisStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-indent) */ + textIndent: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-orientation) */ + textOrientation: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-overflow) */ + textOverflow: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-rendering) */ + textRendering: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-shadow) */ + textShadow: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-transform) */ + textTransform: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-underline-offset) */ + textUnderlineOffset: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-underline-position) */ + textUnderlinePosition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-wrap) */ + textWrap: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-wrap-mode) */ + textWrapMode: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-wrap-style) */ + textWrapStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/top) */ + top: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/touch-action) */ + touchAction: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transform) */ + transform: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transform-box) */ + transformBox: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transform-origin) */ + transformOrigin: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transform-style) */ + transformStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition) */ + transition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition-behavior) */ + transitionBehavior: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition-delay) */ + transitionDelay: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition-duration) */ + transitionDuration: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition-property) */ + transitionProperty: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition-timing-function) */ + transitionTimingFunction: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/translate) */ + translate: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/unicode-bidi) */ + unicodeBidi: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/user-select) */ + userSelect: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/vector-effect) */ + vectorEffect: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/vertical-align) */ + verticalAlign: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/view-transition-class) */ + viewTransitionClass: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/view-transition-name) */ + viewTransitionName: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/visibility) */ + visibility: string; + /** + * @deprecated This is a legacy alias of `alignContent`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/align-content) + */ + webkitAlignContent: string; + /** + * @deprecated This is a legacy alias of `alignItems`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/align-items) + */ + webkitAlignItems: string; + /** + * @deprecated This is a legacy alias of `alignSelf`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/align-self) + */ + webkitAlignSelf: string; + /** + * @deprecated This is a legacy alias of `animation`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation) + */ + webkitAnimation: string; + /** + * @deprecated This is a legacy alias of `animationDelay`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-delay) + */ + webkitAnimationDelay: string; + /** + * @deprecated This is a legacy alias of `animationDirection`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-direction) + */ + webkitAnimationDirection: string; + /** + * @deprecated This is a legacy alias of `animationDuration`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-duration) + */ + webkitAnimationDuration: string; + /** + * @deprecated This is a legacy alias of `animationFillMode`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-fill-mode) + */ + webkitAnimationFillMode: string; + /** + * @deprecated This is a legacy alias of `animationIterationCount`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-iteration-count) + */ + webkitAnimationIterationCount: string; + /** + * @deprecated This is a legacy alias of `animationName`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-name) + */ + webkitAnimationName: string; + /** + * @deprecated This is a legacy alias of `animationPlayState`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-play-state) + */ + webkitAnimationPlayState: string; + /** + * @deprecated This is a legacy alias of `animationTimingFunction`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-timing-function) + */ + webkitAnimationTimingFunction: string; + /** + * @deprecated This is a legacy alias of `appearance`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/appearance) + */ + webkitAppearance: string; + /** + * @deprecated This is a legacy alias of `backfaceVisibility`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/backface-visibility) + */ + webkitBackfaceVisibility: string; + /** + * @deprecated This is a legacy alias of `backgroundClip`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-clip) + */ + webkitBackgroundClip: string; + /** + * @deprecated This is a legacy alias of `backgroundOrigin`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-origin) + */ + webkitBackgroundOrigin: string; + /** + * @deprecated This is a legacy alias of `backgroundSize`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-size) + */ + webkitBackgroundSize: string; + /** + * @deprecated This is a legacy alias of `borderBottomLeftRadius`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-bottom-left-radius) + */ + webkitBorderBottomLeftRadius: string; + /** + * @deprecated This is a legacy alias of `borderBottomRightRadius`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-bottom-right-radius) + */ + webkitBorderBottomRightRadius: string; + /** + * @deprecated This is a legacy alias of `borderRadius`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-radius) + */ + webkitBorderRadius: string; + /** + * @deprecated This is a legacy alias of `borderTopLeftRadius`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-top-left-radius) + */ + webkitBorderTopLeftRadius: string; + /** + * @deprecated This is a legacy alias of `borderTopRightRadius`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-top-right-radius) + */ + webkitBorderTopRightRadius: string; + /** + * @deprecated This is a legacy alias of `boxAlign`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/box-align) + */ + webkitBoxAlign: string; + /** + * @deprecated This is a legacy alias of `boxFlex`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/box-flex) + */ + webkitBoxFlex: string; + /** + * @deprecated This is a legacy alias of `boxOrdinalGroup`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/box-ordinal-group) + */ + webkitBoxOrdinalGroup: string; + /** + * @deprecated This is a legacy alias of `boxOrient`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/box-orient) + */ + webkitBoxOrient: string; + /** + * @deprecated This is a legacy alias of `boxPack`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/box-pack) + */ + webkitBoxPack: string; + /** + * @deprecated This is a legacy alias of `boxShadow`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/box-shadow) + */ + webkitBoxShadow: string; + /** + * @deprecated This is a legacy alias of `boxSizing`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/box-sizing) + */ + webkitBoxSizing: string; + /** + * @deprecated This is a legacy alias of `filter`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/filter) + */ + webkitFilter: string; + /** + * @deprecated This is a legacy alias of `flex`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex) + */ + webkitFlex: string; + /** + * @deprecated This is a legacy alias of `flexBasis`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-basis) + */ + webkitFlexBasis: string; + /** + * @deprecated This is a legacy alias of `flexDirection`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-direction) + */ + webkitFlexDirection: string; + /** + * @deprecated This is a legacy alias of `flexFlow`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-flow) + */ + webkitFlexFlow: string; + /** + * @deprecated This is a legacy alias of `flexGrow`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-grow) + */ + webkitFlexGrow: string; + /** + * @deprecated This is a legacy alias of `flexShrink`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-shrink) + */ + webkitFlexShrink: string; + /** + * @deprecated This is a legacy alias of `flexWrap`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-wrap) + */ + webkitFlexWrap: string; + /** + * @deprecated This is a legacy alias of `justifyContent`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/justify-content) + */ + webkitJustifyContent: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/line-clamp) */ + webkitLineClamp: string; + /** + * @deprecated This is a legacy alias of `mask`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask) + */ + webkitMask: string; + /** + * @deprecated This is a legacy alias of `maskBorder`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-border) + */ + webkitMaskBoxImage: string; + /** + * @deprecated This is a legacy alias of `maskBorderOutset`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-border-outset) + */ + webkitMaskBoxImageOutset: string; + /** + * @deprecated This is a legacy alias of `maskBorderRepeat`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-border-repeat) + */ + webkitMaskBoxImageRepeat: string; + /** + * @deprecated This is a legacy alias of `maskBorderSlice`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-border-slice) + */ + webkitMaskBoxImageSlice: string; + /** + * @deprecated This is a legacy alias of `maskBorderSource`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-border-source) + */ + webkitMaskBoxImageSource: string; + /** + * @deprecated This is a legacy alias of `maskBorderWidth`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-border-width) + */ + webkitMaskBoxImageWidth: string; + /** + * @deprecated This is a legacy alias of `maskClip`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-clip) + */ + webkitMaskClip: string; + /** + * @deprecated This is a legacy alias of `maskComposite`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-composite) + */ + webkitMaskComposite: string; + /** + * @deprecated This is a legacy alias of `maskImage`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-image) + */ + webkitMaskImage: string; + /** + * @deprecated This is a legacy alias of `maskOrigin`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-origin) + */ + webkitMaskOrigin: string; + /** + * @deprecated This is a legacy alias of `maskPosition`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-position) + */ + webkitMaskPosition: string; + /** + * @deprecated This is a legacy alias of `maskRepeat`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-repeat) + */ + webkitMaskRepeat: string; + /** + * @deprecated This is a legacy alias of `maskSize`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-size) + */ + webkitMaskSize: string; + /** + * @deprecated This is a legacy alias of `order`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/order) + */ + webkitOrder: string; + /** + * @deprecated This is a legacy alias of `perspective`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/perspective) + */ + webkitPerspective: string; + /** + * @deprecated This is a legacy alias of `perspectiveOrigin`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/perspective-origin) + */ + webkitPerspectiveOrigin: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/-webkit-text-fill-color) */ + webkitTextFillColor: string; + /** + * @deprecated This is a legacy alias of `textSizeAdjust`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-size-adjust) + */ + webkitTextSizeAdjust: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke) */ + webkitTextStroke: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke-color) */ + webkitTextStrokeColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke-width) */ + webkitTextStrokeWidth: string; + /** + * @deprecated This is a legacy alias of `transform`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transform) + */ + webkitTransform: string; + /** + * @deprecated This is a legacy alias of `transformOrigin`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transform-origin) + */ + webkitTransformOrigin: string; + /** + * @deprecated This is a legacy alias of `transformStyle`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transform-style) + */ + webkitTransformStyle: string; + /** + * @deprecated This is a legacy alias of `transition`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition) + */ + webkitTransition: string; + /** + * @deprecated This is a legacy alias of `transitionDelay`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition-delay) + */ + webkitTransitionDelay: string; + /** + * @deprecated This is a legacy alias of `transitionDuration`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition-duration) + */ + webkitTransitionDuration: string; + /** + * @deprecated This is a legacy alias of `transitionProperty`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition-property) + */ + webkitTransitionProperty: string; + /** + * @deprecated This is a legacy alias of `transitionTimingFunction`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition-timing-function) + */ + webkitTransitionTimingFunction: string; + /** + * @deprecated This is a legacy alias of `userSelect`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/user-select) + */ + webkitUserSelect: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/white-space) */ + whiteSpace: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/white-space-collapse) */ + whiteSpaceCollapse: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/widows) */ + widows: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/width) */ + width: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/will-change) */ + willChange: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/word-break) */ + wordBreak: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/word-spacing) */ + wordSpacing: string; + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overflow-wrap) + */ + wordWrap: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/writing-mode) */ + writingMode: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/x) */ + x: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/y) */ + y: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/z-index) */ + zIndex: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/zoom) */ + zoom: string; + /** + * The **CSSStyleDeclaration.getPropertyPriority()** method interface returns a string that provides all explicitly set priorities on the CSS property. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/getPropertyPriority) + */ + getPropertyPriority(property: string): string; + /** + * The **CSSStyleDeclaration.getPropertyValue()** method interface returns a string containing the value of a specified CSS property. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/getPropertyValue) + */ + getPropertyValue(property: string): string; + /** + * The `CSSStyleDeclaration.item()` method interface returns a CSS property name from a CSSStyleDeclaration by index. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/item) + */ + item(index: number): string; + /** + * The **`CSSStyleDeclaration.removeProperty()`** method interface removes a property from a CSS style declaration object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/removeProperty) + */ + removeProperty(property: string): string; + /** + * The **`CSSStyleDeclaration.setProperty()`** method interface sets a new value for a property on a CSS style declaration object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/setProperty) + */ + setProperty(property: string, value: string | null, priority?: string): void; + [index: number]: string; +} + +declare var CSSStyleDeclaration: { + prototype: CSSStyleDeclaration; + new(): CSSStyleDeclaration; +}; + +/** + * The **`CSSStyleRule`** interface represents a single CSS style rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleRule) + */ +interface CSSStyleRule extends CSSGroupingRule { + /** + * The **`selectorText`** property of the CSSStyleRule interface gets and sets the selectors associated with the `CSSStyleRule`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleRule/selectorText) + */ + selectorText: string; + /** + * The read-only **`style`** property is the CSSStyleDeclaration interface for the declaration block of the CSSStyleRule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleRule/style) + */ + get style(): CSSStyleDeclaration; + set style(cssText: string); + /** + * The **`styleMap`** read-only property of the which provides access to the rule's property-value pairs. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleRule/styleMap) + */ + readonly styleMap: StylePropertyMap; +} + +declare var CSSStyleRule: { + prototype: CSSStyleRule; + new(): CSSStyleRule; +}; + +/** + * The **`CSSStyleSheet`** interface represents a single CSS stylesheet, and lets you inspect and modify the list of rules contained in the stylesheet. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet) + */ +interface CSSStyleSheet extends StyleSheet { + /** + * The read-only CSSStyleSheet property **`cssRules`** returns a live CSSRuleList which provides a real-time, up-to-date list of every CSS rule which comprises the stylesheet. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/cssRules) + */ + readonly cssRules: CSSRuleList; + /** + * The read-only CSSStyleSheet property **`ownerRule`** returns the CSSImportRule corresponding to the @import at-rule which imported the stylesheet into the document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/ownerRule) + */ + readonly ownerRule: CSSRule | null; + /** + * **`rules`** is a _deprecated_ _legacy property_ of the CSSStyleSheet interface. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/rules) + */ + readonly rules: CSSRuleList; + /** + * The obsolete CSSStyleSheet interface's **`addRule()`** _legacy method_ adds a new rule to the stylesheet. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/addRule) + */ + addRule(selector?: string, style?: string, index?: number): number; + /** + * The CSSStyleSheet method **`deleteRule()`** removes a rule from the stylesheet object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/deleteRule) + */ + deleteRule(index: number): void; + /** + * The **`CSSStyleSheet.insertRule()`** method inserts a new CSS rule into the current style sheet. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/insertRule) + */ + insertRule(rule: string, index?: number): number; + /** + * The obsolete CSSStyleSheet method **`removeRule()`** removes a rule from the stylesheet object. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/removeRule) + */ + removeRule(index?: number): void; + /** + * The **`replace()`** method of the CSSStyleSheet interface asynchronously replaces the content of the stylesheet with the content passed into it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/replace) + */ + replace(text: string): Promise; + /** + * The **`replaceSync()`** method of the CSSStyleSheet interface synchronously replaces the content of the stylesheet with the content passed into it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/replaceSync) + */ + replaceSync(text: string): void; +} + +declare var CSSStyleSheet: { + prototype: CSSStyleSheet; + new(options?: CSSStyleSheetInit): CSSStyleSheet; +}; + +/** + * The **`CSSStyleValue`** interface of the CSS Typed Object Model API is the base class of all CSS values accessible through the Typed OM API. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleValue) + */ +interface CSSStyleValue { + toString(): string; +} + +declare var CSSStyleValue: { + prototype: CSSStyleValue; + new(): CSSStyleValue; + /** + * The **`parse()`** static method of the CSSStyleValue interface sets a specific CSS property to the specified values and returns the first value as a CSSStyleValue object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleValue/parse_static) + */ + parse(property: string, cssText: string): CSSStyleValue; + /** + * The **`parseAll()`** static method of the CSSStyleValue interface sets all occurrences of a specific CSS property to the specified value and returns an array of CSSStyleValue objects, each containing one of the supplied values. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleValue/parseAll_static) + */ + parseAll(property: string, cssText: string): CSSStyleValue[]; +}; + +/** + * The **`CSSSupportsRule`** interface represents a single CSS @supports at-rule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSSupportsRule) + */ +interface CSSSupportsRule extends CSSConditionRule { +} + +declare var CSSSupportsRule: { + prototype: CSSSupportsRule; + new(): CSSSupportsRule; +}; + +/** + * The **`CSSTransformComponent`** interface of the CSS Typed Object Model API is part of the CSSTransformValue interface. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTransformComponent) + */ +interface CSSTransformComponent { + /** + * The **`is2D`** read-only property of the CSSTransformComponent interface indicates where the transform is 2D or 3D. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTransformComponent/is2D) + */ + is2D: boolean; + /** + * The **`toMatrix()`** method of the object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTransformComponent/toMatrix) + */ + toMatrix(): DOMMatrix; + toString(): string; +} + +declare var CSSTransformComponent: { + prototype: CSSTransformComponent; + new(): CSSTransformComponent; +}; + +/** + * The **`CSSTransformValue`** interface of the CSS Typed Object Model API represents `transform-list` values as used by the CSS transform property. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTransformValue) + */ +interface CSSTransformValue extends CSSStyleValue { + /** + * The read-only **`is2D`** property of the In the case of the `CSSTransformValue` this property returns true unless any of the individual functions return false for `Is2D`, in which case it returns false. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTransformValue/is2D) + */ + readonly is2D: boolean; + /** + * The read-only **`length`** property of the the list. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTransformValue/length) + */ + readonly length: number; + /** + * The **`toMatrix()`** method of the ```js-nolint toMatrix() ``` None. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTransformValue/toMatrix) + */ + toMatrix(): DOMMatrix; + forEach(callbackfn: (value: CSSTransformComponent, key: number, parent: CSSTransformValue) => void, thisArg?: any): void; + [index: number]: CSSTransformComponent; +} + +declare var CSSTransformValue: { + prototype: CSSTransformValue; + new(transforms: CSSTransformComponent[]): CSSTransformValue; +}; + +/** + * The **`CSSTransition`** interface of the Web Animations API represents an Animation object used for a CSS Transition. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTransition) + */ +interface CSSTransition extends Animation { + /** + * The **`transitionProperty`** property of the name** of the transition. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTransition/transitionProperty) + */ + readonly transitionProperty: string; + addEventListener(type: K, listener: (this: CSSTransition, ev: AnimationEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: CSSTransition, ev: AnimationEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var CSSTransition: { + prototype: CSSTransition; + new(): CSSTransition; +}; + +/** + * The **`CSSTranslate`** interface of the CSS Typed Object Model API represents the translate() value of the individual transform property in CSS. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTranslate) + */ +interface CSSTranslate extends CSSTransformComponent { + /** + * The **`x`** property of the translating vector. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTranslate/x) + */ + x: CSSNumericValue; + /** + * The **`y`** property of the translating vector. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTranslate/y) + */ + y: CSSNumericValue; + /** + * The **`z`** property of the vector. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTranslate/z) + */ + z: CSSNumericValue; +} + +declare var CSSTranslate: { + prototype: CSSTranslate; + new(x: CSSNumericValue, y: CSSNumericValue, z?: CSSNumericValue): CSSTranslate; +}; + +/** + * The **`CSSUnitValue`** interface of the CSS Typed Object Model API represents values that contain a single unit type. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSUnitValue) + */ +interface CSSUnitValue extends CSSNumericValue { + /** + * The **`CSSUnitValue.unit`** read-only property of the CSSUnitValue interface returns a string indicating the type of unit. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSUnitValue/unit) + */ + readonly unit: string; + /** + * The **`CSSUnitValue.value`** property of the A double. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSUnitValue/value) + */ + value: number; +} + +declare var CSSUnitValue: { + prototype: CSSUnitValue; + new(value: number, unit: string): CSSUnitValue; +}; + +/** + * The **`CSSUnparsedValue`** interface of the CSS Typed Object Model API represents property values that reference custom properties. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSUnparsedValue) + */ +interface CSSUnparsedValue extends CSSStyleValue { + /** + * The **`length`** read-only property of the An integer. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSUnparsedValue/length) + */ + readonly length: number; + forEach(callbackfn: (value: CSSUnparsedSegment, key: number, parent: CSSUnparsedValue) => void, thisArg?: any): void; + [index: number]: CSSUnparsedSegment; +} + +declare var CSSUnparsedValue: { + prototype: CSSUnparsedValue; + new(members: CSSUnparsedSegment[]): CSSUnparsedValue; +}; + +/** + * The **`CSSVariableReferenceValue`** interface of the CSS Typed Object Model API allows you to create a custom name for a built-in CSS value. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSVariableReferenceValue) + */ +interface CSSVariableReferenceValue { + /** + * The **`fallback`** read-only property of the A CSSUnparsedValue. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSVariableReferenceValue/fallback) + */ + readonly fallback: CSSUnparsedValue | null; + /** + * The **`variable`** property of the A string beginning with `--` (that is, a custom property name). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSVariableReferenceValue/variable) + */ + variable: string; +} + +declare var CSSVariableReferenceValue: { + prototype: CSSVariableReferenceValue; + new(variable: string, fallback?: CSSUnparsedValue | null): CSSVariableReferenceValue; +}; + +interface CSSViewTransitionRule extends CSSRule { + readonly navigation: string; + readonly types: ReadonlyArray; +} + +declare var CSSViewTransitionRule: { + prototype: CSSViewTransitionRule; + new(): CSSViewTransitionRule; +}; + +/** + * The **`Cache`** interface provides a persistent storage mechanism for Request / Response object pairs that are cached in long lived memory. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache) + */ +interface Cache { + /** + * The **`add()`** method of the Cache interface takes a URL, retrieves it, and adds the resulting response object to the given cache. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/add) + */ + add(request: RequestInfo | URL): Promise; + /** + * The **`addAll()`** method of the Cache interface takes an array of URLs, retrieves them, and adds the resulting response objects to the given cache. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/addAll) + */ + addAll(requests: RequestInfo[]): Promise; + /** + * The **`delete()`** method of the Cache interface finds the Cache entry whose key is the request, and if found, deletes the Cache entry and returns a Promise that resolves to `true`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/delete) + */ + delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise; + /** + * The **`keys()`** method of the Cache interface returns a representing the keys of the Cache. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/keys) + */ + keys(request?: RequestInfo | URL, options?: CacheQueryOptions): Promise>; + /** + * The **`match()`** method of the Cache interface returns a Promise that resolves to the Response associated with the first matching request in the Cache object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/match) + */ + match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise; + /** + * The **`matchAll()`** method of the Cache interface returns a Promise that resolves to an array of all matching responses in the Cache object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/matchAll) + */ + matchAll(request?: RequestInfo | URL, options?: CacheQueryOptions): Promise>; + /** + * The **`put()`** method of the Often, you will just want to Window/fetch one or more requests, then add the result straight to your cache. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/put) + */ + put(request: RequestInfo | URL, response: Response): Promise; +} + +declare var Cache: { + prototype: Cache; + new(): Cache; +}; + +/** + * The **`CacheStorage`** interface represents the storage for Cache objects. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage) + */ +interface CacheStorage { + /** + * The **`delete()`** method of the CacheStorage interface finds the Cache object matching the `cacheName`, and if found, deletes the Cache object and returns a Promise that resolves to `true`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/delete) + */ + delete(cacheName: string): Promise; + /** + * The **`has()`** method of the CacheStorage interface returns a Promise that resolves to `true` if a You can access `CacheStorage` through the Window.caches property in windows or through the WorkerGlobalScope.caches property in workers. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/has) + */ + has(cacheName: string): Promise; + /** + * The **`keys()`** method of the CacheStorage interface returns a Promise that will resolve with an array containing strings corresponding to all of the named Cache objects tracked by the CacheStorage object in the order they were created. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/keys) + */ + keys(): Promise; + /** + * The **`match()`** method of the CacheStorage interface checks if a given Request or URL string is a key for a stored Response. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/match) + */ + match(request: RequestInfo | URL, options?: MultiCacheQueryOptions): Promise; + /** + * The **`open()`** method of the the Cache object matching the `cacheName`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open) + */ + open(cacheName: string): Promise; +} + +declare var CacheStorage: { + prototype: CacheStorage; + new(): CacheStorage; +}; + +/** + * The **`CanvasCaptureMediaStreamTrack`** interface of the Media Capture and Streams API represents the video track contained in a MediaStream being generated from a canvas following a call to HTMLCanvasElement.captureStream(). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasCaptureMediaStreamTrack) + */ +interface CanvasCaptureMediaStreamTrack extends MediaStreamTrack { + /** + * The **`canvas`** read-only property of the CanvasCaptureMediaStreamTrack interface returns the HTMLCanvasElement from which frames are being captured. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasCaptureMediaStreamTrack/canvas) + */ + readonly canvas: HTMLCanvasElement; + /** + * The **`requestFrame()`** method of the CanvasCaptureMediaStreamTrack interface requests that a frame be captured from the canvas and sent to the stream. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasCaptureMediaStreamTrack/requestFrame) + */ + requestFrame(): void; + addEventListener(type: K, listener: (this: CanvasCaptureMediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: CanvasCaptureMediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var CanvasCaptureMediaStreamTrack: { + prototype: CanvasCaptureMediaStreamTrack; + new(): CanvasCaptureMediaStreamTrack; +}; + +interface CanvasCompositing { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/globalAlpha) */ + globalAlpha: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation) */ + globalCompositeOperation: GlobalCompositeOperation; +} + +interface CanvasDrawImage { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/drawImage) */ + drawImage(image: CanvasImageSource, dx: number, dy: number): void; + drawImage(image: CanvasImageSource, dx: number, dy: number, dw: number, dh: number): void; + drawImage(image: CanvasImageSource, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void; +} + +interface CanvasDrawPath { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/beginPath) */ + beginPath(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/clip) */ + clip(fillRule?: CanvasFillRule): void; + clip(path: Path2D, fillRule?: CanvasFillRule): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fill) */ + fill(fillRule?: CanvasFillRule): void; + fill(path: Path2D, fillRule?: CanvasFillRule): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/isPointInPath) */ + isPointInPath(x: number, y: number, fillRule?: CanvasFillRule): boolean; + isPointInPath(path: Path2D, x: number, y: number, fillRule?: CanvasFillRule): boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/isPointInStroke) */ + isPointInStroke(x: number, y: number): boolean; + isPointInStroke(path: Path2D, x: number, y: number): boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/stroke) */ + stroke(): void; + stroke(path: Path2D): void; +} + +interface CanvasFillStrokeStyles { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fillStyle) */ + fillStyle: string | CanvasGradient | CanvasPattern; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/strokeStyle) */ + strokeStyle: string | CanvasGradient | CanvasPattern; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/createConicGradient) */ + createConicGradient(startAngle: number, x: number, y: number): CanvasGradient; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/createLinearGradient) */ + createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/createPattern) */ + createPattern(image: CanvasImageSource, repetition: string | null): CanvasPattern | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/createRadialGradient) */ + createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; +} + +interface CanvasFilters { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/filter) */ + filter: string; +} + +/** + * The **`CanvasGradient`** interface represents an opaque object describing a gradient. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasGradient) + */ +interface CanvasGradient { + /** + * The **`CanvasGradient.addColorStop()`** method adds a new color stop, defined by an `offset` and a `color`, to a given canvas gradient. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasGradient/addColorStop) + */ + addColorStop(offset: number, color: string): void; +} + +declare var CanvasGradient: { + prototype: CanvasGradient; + new(): CanvasGradient; +}; + +interface CanvasImageData { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/createImageData) */ + createImageData(sw: number, sh: number, settings?: ImageDataSettings): ImageData; + createImageData(imageData: ImageData): ImageData; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/getImageData) */ + getImageData(sx: number, sy: number, sw: number, sh: number, settings?: ImageDataSettings): ImageData; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/putImageData) */ + putImageData(imageData: ImageData, dx: number, dy: number): void; + putImageData(imageData: ImageData, dx: number, dy: number, dirtyX: number, dirtyY: number, dirtyWidth: number, dirtyHeight: number): void; +} + +interface CanvasImageSmoothing { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled) */ + imageSmoothingEnabled: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/imageSmoothingQuality) */ + imageSmoothingQuality: ImageSmoothingQuality; +} + +interface CanvasPath { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/arc) */ + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/arcTo) */ + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/bezierCurveTo) */ + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/closePath) */ + closePath(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/ellipse) */ + ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/lineTo) */ + lineTo(x: number, y: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/moveTo) */ + moveTo(x: number, y: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/quadraticCurveTo) */ + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/rect) */ + rect(x: number, y: number, w: number, h: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/roundRect) */ + roundRect(x: number, y: number, w: number, h: number, radii?: number | DOMPointInit | (number | DOMPointInit)[]): void; +} + +interface CanvasPathDrawingStyles { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/lineCap) */ + lineCap: CanvasLineCap; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/lineDashOffset) */ + lineDashOffset: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/lineJoin) */ + lineJoin: CanvasLineJoin; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/lineWidth) */ + lineWidth: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/miterLimit) */ + miterLimit: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/getLineDash) */ + getLineDash(): number[]; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash) */ + setLineDash(segments: number[]): void; +} + +/** + * The **`CanvasPattern`** interface represents an opaque object describing a pattern, based on an image, a canvas, or a video, created by the CanvasRenderingContext2D.createPattern() method. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasPattern) + */ +interface CanvasPattern { + /** + * The **`CanvasPattern.setTransform()`** method uses a DOMMatrix object as the pattern's transformation matrix and invokes it on the pattern. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasPattern/setTransform) + */ + setTransform(transform?: DOMMatrix2DInit): void; +} + +declare var CanvasPattern: { + prototype: CanvasPattern; + new(): CanvasPattern; +}; + +interface CanvasRect { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/clearRect) */ + clearRect(x: number, y: number, w: number, h: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fillRect) */ + fillRect(x: number, y: number, w: number, h: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/strokeRect) */ + strokeRect(x: number, y: number, w: number, h: number): void; +} + +/** + * The **`CanvasRenderingContext2D`** interface, part of the Canvas API, provides the 2D rendering context for the drawing surface of a canvas element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D) + */ +interface CanvasRenderingContext2D extends CanvasCompositing, CanvasDrawImage, CanvasDrawPath, CanvasFillStrokeStyles, CanvasFilters, CanvasImageData, CanvasImageSmoothing, CanvasPath, CanvasPathDrawingStyles, CanvasRect, CanvasSettings, CanvasShadowStyles, CanvasState, CanvasText, CanvasTextDrawingStyles, CanvasTransform, CanvasUserInterface { + /** + * The **`CanvasRenderingContext2D.canvas`** property, part of the Canvas API, is a read-only reference to the might be `null` if there is no associated canvas element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/canvas) + */ + readonly canvas: HTMLCanvasElement; +} + +declare var CanvasRenderingContext2D: { + prototype: CanvasRenderingContext2D; + new(): CanvasRenderingContext2D; +}; + +interface CanvasSettings { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/getContextAttributes) */ + getContextAttributes(): CanvasRenderingContext2DSettings; +} + +interface CanvasShadowStyles { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/shadowBlur) */ + shadowBlur: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/shadowColor) */ + shadowColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/shadowOffsetX) */ + shadowOffsetX: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/shadowOffsetY) */ + shadowOffsetY: number; +} + +interface CanvasState { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/isContextLost) */ + isContextLost(): boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/reset) */ + reset(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/restore) */ + restore(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/save) */ + save(): void; +} + +interface CanvasText { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fillText) */ + fillText(text: string, x: number, y: number, maxWidth?: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/measureText) */ + measureText(text: string): TextMetrics; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/strokeText) */ + strokeText(text: string, x: number, y: number, maxWidth?: number): void; +} + +interface CanvasTextDrawingStyles { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/direction) */ + direction: CanvasDirection; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/font) */ + font: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fontKerning) */ + fontKerning: CanvasFontKerning; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fontStretch) */ + fontStretch: CanvasFontStretch; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fontVariantCaps) */ + fontVariantCaps: CanvasFontVariantCaps; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/letterSpacing) */ + letterSpacing: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/textAlign) */ + textAlign: CanvasTextAlign; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/textBaseline) */ + textBaseline: CanvasTextBaseline; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/textRendering) */ + textRendering: CanvasTextRendering; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/wordSpacing) */ + wordSpacing: string; +} + +interface CanvasTransform { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/getTransform) */ + getTransform(): DOMMatrix; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/resetTransform) */ + resetTransform(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/rotate) */ + rotate(angle: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/scale) */ + scale(x: number, y: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setTransform) */ + setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void; + setTransform(transform?: DOMMatrix2DInit): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/transform) */ + transform(a: number, b: number, c: number, d: number, e: number, f: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/translate) */ + translate(x: number, y: number): void; +} + +interface CanvasUserInterface { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/drawFocusIfNeeded) */ + drawFocusIfNeeded(element: Element): void; + drawFocusIfNeeded(path: Path2D, element: Element): void; +} + +/** + * The `CaretPosition` interface represents the caret position, an indicator for the text insertion point. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CaretPosition) + */ +interface CaretPosition { + readonly offset: number; + readonly offsetNode: Node; + getClientRect(): DOMRect | null; +} + +declare var CaretPosition: { + prototype: CaretPosition; + new(): CaretPosition; +}; + +/** + * The `ChannelMergerNode` interface, often used in conjunction with its opposite, ChannelSplitterNode, reunites different mono inputs into a single output. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ChannelMergerNode) + */ +interface ChannelMergerNode extends AudioNode { +} + +declare var ChannelMergerNode: { + prototype: ChannelMergerNode; + new(context: BaseAudioContext, options?: ChannelMergerOptions): ChannelMergerNode; +}; + +/** + * The `ChannelSplitterNode` interface, often used in conjunction with its opposite, ChannelMergerNode, separates the different channels of an audio source into a set of mono outputs. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ChannelSplitterNode) + */ +interface ChannelSplitterNode extends AudioNode { +} + +declare var ChannelSplitterNode: { + prototype: ChannelSplitterNode; + new(context: BaseAudioContext, options?: ChannelSplitterOptions): ChannelSplitterNode; +}; + +/** + * The **`CharacterData`** abstract interface represents a Node object that contains characters. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData) + */ +interface CharacterData extends Node, ChildNode, NonDocumentTypeChildNode { + /** + * The **`data`** property of the CharacterData interface represent the value of the current object's data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/data) + */ + data: string; + /** + * The read-only **`CharacterData.length`** property returns the number of characters in the contained data, as a positive integer. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/length) + */ + readonly length: number; + readonly ownerDocument: Document; + /** + * The **`appendData()`** method of the CharacterData interface adds the provided data to the end of the node's current data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/appendData) + */ + appendData(data: string): void; + /** + * The **`deleteData()`** method of the CharacterData interface removes all or part of the data from this `CharacterData` node. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/deleteData) + */ + deleteData(offset: number, count: number): void; + /** + * The **`insertData()`** method of the CharacterData interface inserts the provided data into this `CharacterData` node's current data, at the provided offset from the start of the existing data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/insertData) + */ + insertData(offset: number, data: string): void; + /** + * The **`replaceData()`** method of the CharacterData interface removes a certain number of characters of the existing text in a given `CharacterData` node and replaces those characters with the text provided. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/replaceData) + */ + replaceData(offset: number, count: number, data: string): void; + /** + * The **`substringData()`** method of the CharacterData interface returns a portion of the existing data, starting at the specified index and extending for a given number of characters afterwards. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/substringData) + */ + substringData(offset: number, count: number): string; + /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent) */ + get textContent(): string; + set textContent(value: string | null); +} + +declare var CharacterData: { + prototype: CharacterData; + new(): CharacterData; +}; + +interface ChildNode extends Node { + /** + * Inserts nodes just after node, while replacing strings in nodes with equivalent Text nodes. + * + * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/after) + */ + after(...nodes: (Node | string)[]): void; + /** + * Inserts nodes just before node, while replacing strings in nodes with equivalent Text nodes. + * + * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/before) + */ + before(...nodes: (Node | string)[]): void; + /** + * Removes node. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/remove) + */ + remove(): void; + /** + * Replaces node with nodes, while replacing strings in nodes with equivalent Text nodes. + * + * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/replaceWith) + */ + replaceWith(...nodes: (Node | string)[]): void; +} + +/** @deprecated */ +interface ClientRect extends DOMRect { +} + +/** + * The **`Clipboard`** interface of the Clipboard API provides read and write access to the contents of the system clipboard. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Clipboard) + */ +interface Clipboard extends EventTarget { + /** + * The **`read()`** method of the Clipboard interface requests a copy of the clipboard's contents, fulfilling the returned Promise with the data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Clipboard/read) + */ + read(): Promise; + /** + * The **`readText()`** method of the Clipboard interface returns a Promise which fulfills with a copy of the textual contents of the system clipboard. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Clipboard/readText) + */ + readText(): Promise; + /** + * The **`write()`** method of the Clipboard interface writes arbitrary ClipboardItem data such as images and text to the clipboard, fulfilling the returned Promise on completion. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Clipboard/write) + */ + write(data: ClipboardItems): Promise; + /** + * The **`writeText()`** method of the Clipboard interface writes the specified text to the system clipboard, returning a Promise that is resolved once the system clipboard has been updated. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Clipboard/writeText) + */ + writeText(data: string): Promise; +} + +declare var Clipboard: { + prototype: Clipboard; + new(): Clipboard; +}; + +/** + * The **`ClipboardEvent`** interface of the Clipboard API represents events providing information related to modification of the clipboard, that is Element/cut_event, Element/copy_event, and Element/paste_event events. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ClipboardEvent) + */ +interface ClipboardEvent extends Event { + /** + * The **`clipboardData`** property of the ClipboardEvent interface holds a DataTransfer object, which can be used to: - specify what data should be put into the clipboard from the Element/cut_event and Element/copy_event event handlers, typically with a DataTransfer.setData call; - obtain the data to be pasted from the Element/paste_event event handler, typically with a DataTransfer.getData call. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ClipboardEvent/clipboardData) + */ + readonly clipboardData: DataTransfer | null; +} + +declare var ClipboardEvent: { + prototype: ClipboardEvent; + new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent; +}; + +/** + * The **`ClipboardItem`** interface of the Clipboard API represents a single item format, used when reading or writing clipboard data using Clipboard.read() and Clipboard.write() respectively. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ClipboardItem) + */ +interface ClipboardItem { + /** + * The read-only **`presentationStyle`** property of the ClipboardItem interface returns a string indicating how an item should be presented. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ClipboardItem/presentationStyle) + */ + readonly presentationStyle: PresentationStyle; + /** + * The read-only **`types`** property of the ClipboardItem interface returns an Array of MIME type available within the ClipboardItem. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ClipboardItem/types) + */ + readonly types: ReadonlyArray; + /** + * The **`getType()`** method of the ClipboardItem interface returns a Promise that resolves with a Blob of the requested MIME type or an error if the MIME type is not found. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ClipboardItem/getType) + */ + getType(type: string): Promise; +} + +declare var ClipboardItem: { + prototype: ClipboardItem; + new(items: Record>, options?: ClipboardItemOptions): ClipboardItem; + /** + * The **`supports()`** static method of the ClipboardItem interface returns `true` if the given MIME type is supported by the clipboard, and `false` otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ClipboardItem/supports_static) + */ + supports(type: string): boolean; +}; + +/** + * A `CloseEvent` is sent to clients using WebSockets when the connection is closed. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent) + */ +interface CloseEvent extends Event { + /** + * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code) + */ + readonly code: number; + /** + * The **`reason`** read-only property of the CloseEvent interface returns the WebSocket connection close reason the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason) + */ + readonly reason: string; + /** + * The **`wasClean`** read-only property of the CloseEvent interface returns `true` if the connection closed cleanly. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean) + */ + readonly wasClean: boolean; +} + +declare var CloseEvent: { + prototype: CloseEvent; + new(type: string, eventInitDict?: CloseEventInit): CloseEvent; +}; + +/** + * The **`Comment`** interface represents textual notations within markup; although it is generally not visually shown, such comments are available to be read in the source view. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Comment) + */ +interface Comment extends CharacterData { +} + +declare var Comment: { + prototype: Comment; + new(data?: string): Comment; +}; + +/** + * The DOM **`CompositionEvent`** represents events that occur due to the user indirectly entering text. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompositionEvent) + */ +interface CompositionEvent extends UIEvent { + /** + * The **`data`** read-only property of the method that raised the event; its exact nature varies depending on the type of event that generated the `CompositionEvent` object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompositionEvent/data) + */ + readonly data: string; + /** + * The **`initCompositionEvent()`** method of the CompositionEvent interface initializes the attributes of a `CompositionEvent` object instance. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompositionEvent/initCompositionEvent) + */ + initCompositionEvent(typeArg: string, bubblesArg?: boolean, cancelableArg?: boolean, viewArg?: WindowProxy | null, dataArg?: string): void; +} + +declare var CompositionEvent: { + prototype: CompositionEvent; + new(type: string, eventInitDict?: CompositionEventInit): CompositionEvent; +}; + +/** + * The **`CompressionStream`** interface of the Compression Streams API is an API for compressing a stream of data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream) + */ +interface CompressionStream extends GenericTransformStream { + readonly readable: ReadableStream>; + readonly writable: WritableStream; +} + +declare var CompressionStream: { + prototype: CompressionStream; + new(format: CompressionFormat): CompressionStream; +}; + +/** + * The `ConstantSourceNode` interface—part of the Web Audio API—represents an audio source (based upon AudioScheduledSourceNode) whose output is single unchanging value. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ConstantSourceNode) + */ +interface ConstantSourceNode extends AudioScheduledSourceNode { + /** + * The read-only `offset` property of the ConstantSourceNode interface returns a AudioParam object indicating the numeric a-rate value which is always returned by the source when asked for the next sample. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ConstantSourceNode/offset) + */ + readonly offset: AudioParam; + addEventListener(type: K, listener: (this: ConstantSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: ConstantSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var ConstantSourceNode: { + prototype: ConstantSourceNode; + new(context: BaseAudioContext, options?: ConstantSourceOptions): ConstantSourceNode; +}; + +/** + * The **`ContentVisibilityAutoStateChangeEvent`** interface is the event object for the element/contentvisibilityautostatechange_event event, which fires on any element with content-visibility set on it when it starts or stops being relevant to the user and skipping its contents. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ContentVisibilityAutoStateChangeEvent) + */ +interface ContentVisibilityAutoStateChangeEvent extends Event { + /** + * The `skipped` read-only property of the ContentVisibilityAutoStateChangeEvent interface returns `true` if the user agent skips the element's contents, or `false` otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ContentVisibilityAutoStateChangeEvent/skipped) + */ + readonly skipped: boolean; +} + +declare var ContentVisibilityAutoStateChangeEvent: { + prototype: ContentVisibilityAutoStateChangeEvent; + new(type: string, eventInitDict?: ContentVisibilityAutoStateChangeEventInit): ContentVisibilityAutoStateChangeEvent; +}; + +/** + * The `ConvolverNode` interface is an AudioNode that performs a Linear Convolution on a given AudioBuffer, often used to achieve a reverb effect. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ConvolverNode) + */ +interface ConvolverNode extends AudioNode { + /** + * The **`buffer`** property of the ConvolverNode interface represents a mono, stereo, or 4-channel AudioBuffer containing the (possibly multichannel) impulse response used by the `ConvolverNode` to create the reverb effect. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ConvolverNode/buffer) + */ + buffer: AudioBuffer | null; + /** + * The `normalize` property of the ConvolverNode interface is a boolean that controls whether the impulse response from the buffer will be scaled by an equal-power normalization when the `buffer` attribute is set, or not. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ConvolverNode/normalize) + */ + normalize: boolean; +} + +declare var ConvolverNode: { + prototype: ConvolverNode; + new(context: BaseAudioContext, options?: ConvolverOptions): ConvolverNode; +}; + +/** + * The **`CookieChangeEvent`** interface of the Cookie Store API is the event type of the CookieStore/change_event event fired at a CookieStore when any cookies are created or deleted. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CookieChangeEvent) + */ +interface CookieChangeEvent extends Event { + /** + * The **`changed`** read-only property of the CookieChangeEvent interface returns an array of the cookies that have been changed. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CookieChangeEvent/changed) + */ + readonly changed: ReadonlyArray; + /** + * The **`deleted`** read-only property of the CookieChangeEvent interface returns an array of the cookies that have been deleted by the given `CookieChangeEvent` instance. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CookieChangeEvent/deleted) + */ + readonly deleted: ReadonlyArray; +} + +declare var CookieChangeEvent: { + prototype: CookieChangeEvent; + new(type: string, eventInitDict?: CookieChangeEventInit): CookieChangeEvent; +}; + +interface CookieStoreEventMap { + "change": CookieChangeEvent; +} + +/** + * The **`CookieStore`** interface of the Cookie Store API provides methods for getting and setting cookies asynchronously from either a page or a service worker. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CookieStore) + */ +interface CookieStore extends EventTarget { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CookieStore/change_event) */ + onchange: ((this: CookieStore, ev: CookieChangeEvent) => any) | null; + /** + * The **`delete()`** method of the CookieStore interface deletes a cookie that matches the given `name` or `options` object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CookieStore/delete) + */ + delete(name: string): Promise; + delete(options: CookieStoreDeleteOptions): Promise; + /** + * The **`get()`** method of the CookieStore interface returns a Promise that resolves to a single cookie matching the given `name` or `options` object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CookieStore/get) + */ + get(name: string): Promise; + get(options?: CookieStoreGetOptions): Promise; + /** + * The **`getAll()`** method of the CookieStore interface returns a Promise that resolves as an array of cookies that match the `name` or `options` passed to it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CookieStore/getAll) + */ + getAll(name: string): Promise; + getAll(options?: CookieStoreGetOptions): Promise; + /** + * The **`set()`** method of the CookieStore interface sets a cookie with the given `name` and `value` or `options` object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CookieStore/set) + */ + set(name: string, value: string): Promise; + set(options: CookieInit): Promise; + addEventListener(type: K, listener: (this: CookieStore, ev: CookieStoreEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: CookieStore, ev: CookieStoreEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var CookieStore: { + prototype: CookieStore; + new(): CookieStore; +}; + +/** + * The **`CookieStoreManager`** interface of the Cookie Store API allows service workers to subscribe to cookie change events. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CookieStoreManager) + */ +interface CookieStoreManager { + /** + * The **`getSubscriptions()`** method of the CookieStoreManager interface returns a list of all the cookie change subscriptions for this ServiceWorkerRegistration. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CookieStoreManager/getSubscriptions) + */ + getSubscriptions(): Promise; + /** + * The **`subscribe()`** method of the CookieStoreManager interface subscribes a ServiceWorkerRegistration to cookie change events. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CookieStoreManager/subscribe) + */ + subscribe(subscriptions: CookieStoreGetOptions[]): Promise; + /** + * The **`unsubscribe()`** method of the CookieStoreManager interface stops the ServiceWorkerRegistration from receiving previously subscribed events. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CookieStoreManager/unsubscribe) + */ + unsubscribe(subscriptions: CookieStoreGetOptions[]): Promise; +} + +declare var CookieStoreManager: { + prototype: CookieStoreManager; + new(): CookieStoreManager; +}; + +/** + * The **`CountQueuingStrategy`** interface of the Streams API provides a built-in chunk counting queuing strategy that can be used when constructing streams. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy) + */ +interface CountQueuingStrategy extends QueuingStrategy { + /** + * The read-only **`CountQueuingStrategy.highWaterMark`** property returns the total number of chunks that can be contained in the internal queue before backpressure is applied. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark) + */ + readonly highWaterMark: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */ + readonly size: QueuingStrategySize; +} + +declare var CountQueuingStrategy: { + prototype: CountQueuingStrategy; + new(init: QueuingStrategyInit): CountQueuingStrategy; +}; + +/** + * The **`Credential`** interface of the Credential Management API provides information about an entity (usually a user) normally as a prerequisite to a trust decision. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Credential) + */ +interface Credential { + /** + * The **`id`** read-only property of the Credential interface returns a string containing the credential's identifier. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Credential/id) + */ + readonly id: string; + /** + * The **`type`** read-only property of the Credential interface returns a string containing the credential's type. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Credential/type) + */ + readonly type: string; +} + +declare var Credential: { + prototype: Credential; + new(): Credential; +}; + +/** + * The **`CredentialsContainer`** interface of the Credential Management API exposes methods to request credentials and notify the user agent when events such as successful sign in or sign out happen. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CredentialsContainer) + */ +interface CredentialsContainer { + /** + * The **`create()`** method of the CredentialsContainer interface creates a new credential, which can then be stored and later retrieved using the CredentialsContainer.get method. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CredentialsContainer/create) + */ + create(options?: CredentialCreationOptions): Promise; + /** + * The **`get()`** method of the CredentialsContainer interface returns a Promise that fulfills with a single credential, which can then be used to authenticate a user to a website. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CredentialsContainer/get) + */ + get(options?: CredentialRequestOptions): Promise; + /** + * The **`preventSilentAccess()`** method of the CredentialsContainer interface sets a flag that specifies whether automatic log in is allowed for future visits to the current origin, then returns a Promise that resolves to `undefined`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CredentialsContainer/preventSilentAccess) + */ + preventSilentAccess(): Promise; + /** + * The **`store()`** method of the ```js-nolint store(credentials) ``` - `credentials` - : A valid Credential instance. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CredentialsContainer/store) + */ + store(credential: Credential): Promise; +} + +declare var CredentialsContainer: { + prototype: CredentialsContainer; + new(): CredentialsContainer; +}; + +/** + * The **`Crypto`** interface represents basic cryptography features available in the current context. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto) + */ +interface Crypto { + /** + * The **`Crypto.subtle`** read-only property returns a cryptographic operations. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle) + */ + readonly subtle: SubtleCrypto; + /** + * The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) + */ + getRandomValues(array: T): T; + /** + * The **`randomUUID()`** method of the Crypto interface is used to generate a v4 UUID using a cryptographically secure random number generator. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID) + */ + randomUUID(): `${string}-${string}-${string}-${string}-${string}`; +} + +declare var Crypto: { + prototype: Crypto; + new(): Crypto; +}; + +/** + * The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods SubtleCrypto.generateKey, SubtleCrypto.deriveKey, SubtleCrypto.importKey, or SubtleCrypto.unwrapKey. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey) + */ +interface CryptoKey { + /** + * The read-only **`algorithm`** property of the CryptoKey interface returns an object describing the algorithm for which this key can be used, and any associated extra parameters. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) + */ + readonly algorithm: KeyAlgorithm; + /** + * The read-only **`extractable`** property of the CryptoKey interface indicates whether or not the key may be extracted using `SubtleCrypto.exportKey()` or `SubtleCrypto.wrapKey()`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) + */ + readonly extractable: boolean; + /** + * The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) + */ + readonly type: KeyType; + /** + * The read-only **`usages`** property of the CryptoKey interface indicates what can be done with the key. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) + */ + readonly usages: KeyUsage[]; +} + +declare var CryptoKey: { + prototype: CryptoKey; + new(): CryptoKey; +}; + +/** + * The **`CustomElementRegistry`** interface provides methods for registering custom elements and querying registered elements. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomElementRegistry) + */ +interface CustomElementRegistry { + /** + * The **`define()`** method of the CustomElementRegistry interface adds a definition for a custom element to the custom element registry, mapping its name to the constructor which will be used to create it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomElementRegistry/define) + */ + define(name: string, constructor: CustomElementConstructor, options?: ElementDefinitionOptions): void; + /** + * The **`get()`** method of the previously-defined custom element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomElementRegistry/get) + */ + get(name: string): CustomElementConstructor | undefined; + /** + * The **`getName()`** method of the previously-defined custom element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomElementRegistry/getName) + */ + getName(constructor: CustomElementConstructor): string | null; + /** + * The **`upgrade()`** method of the elements in a Node subtree, even before they are connected to the main document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomElementRegistry/upgrade) + */ + upgrade(root: Node): void; + /** + * The **`whenDefined()`** method of the resolves when the named element is defined. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomElementRegistry/whenDefined) + */ + whenDefined(name: string): Promise; +} + +declare var CustomElementRegistry: { + prototype: CustomElementRegistry; + new(): CustomElementRegistry; +}; + +/** + * The **`CustomEvent`** interface represents events initialized by an application for any purpose. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent) + */ +interface CustomEvent extends Event { + /** + * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail) + */ + readonly detail: T; + /** + * The **`CustomEvent.initCustomEvent()`** method initializes a CustomEvent object. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/initCustomEvent) + */ + initCustomEvent(type: string, bubbles?: boolean, cancelable?: boolean, detail?: T): void; +} + +declare var CustomEvent: { + prototype: CustomEvent; + new(type: string, eventInitDict?: CustomEventInit): CustomEvent; +}; + +/** + * The **`CustomStateSet`** interface of the Document Object Model stores a list of states for an autonomous custom element, and allows states to be added and removed from the set. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomStateSet) + */ +interface CustomStateSet { + forEach(callbackfn: (value: string, key: string, parent: CustomStateSet) => void, thisArg?: any): void; +} + +declare var CustomStateSet: { + prototype: CustomStateSet; + new(): CustomStateSet; +}; + +/** + * The **`DOMException`** interface represents an abnormal event (called an **exception**) that occurs as a result of calling a method or accessing a property of a web API. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException) + */ +interface DOMException extends Error { + /** + * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or `0` if none match. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code) + */ + readonly code: number; + /** + * The **`message`** read-only property of the a message or description associated with the given error name. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) + */ + readonly message: string; + /** + * The **`name`** read-only property of the one of the strings associated with an error name. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) + */ + readonly name: string; + readonly INDEX_SIZE_ERR: 1; + readonly DOMSTRING_SIZE_ERR: 2; + readonly HIERARCHY_REQUEST_ERR: 3; + readonly WRONG_DOCUMENT_ERR: 4; + readonly INVALID_CHARACTER_ERR: 5; + readonly NO_DATA_ALLOWED_ERR: 6; + readonly NO_MODIFICATION_ALLOWED_ERR: 7; + readonly NOT_FOUND_ERR: 8; + readonly NOT_SUPPORTED_ERR: 9; + readonly INUSE_ATTRIBUTE_ERR: 10; + readonly INVALID_STATE_ERR: 11; + readonly SYNTAX_ERR: 12; + readonly INVALID_MODIFICATION_ERR: 13; + readonly NAMESPACE_ERR: 14; + readonly INVALID_ACCESS_ERR: 15; + readonly VALIDATION_ERR: 16; + readonly TYPE_MISMATCH_ERR: 17; + readonly SECURITY_ERR: 18; + readonly NETWORK_ERR: 19; + readonly ABORT_ERR: 20; + readonly URL_MISMATCH_ERR: 21; + readonly QUOTA_EXCEEDED_ERR: 22; + readonly TIMEOUT_ERR: 23; + readonly INVALID_NODE_TYPE_ERR: 24; + readonly DATA_CLONE_ERR: 25; +} + +declare var DOMException: { + prototype: DOMException; + new(message?: string, name?: string): DOMException; + readonly INDEX_SIZE_ERR: 1; + readonly DOMSTRING_SIZE_ERR: 2; + readonly HIERARCHY_REQUEST_ERR: 3; + readonly WRONG_DOCUMENT_ERR: 4; + readonly INVALID_CHARACTER_ERR: 5; + readonly NO_DATA_ALLOWED_ERR: 6; + readonly NO_MODIFICATION_ALLOWED_ERR: 7; + readonly NOT_FOUND_ERR: 8; + readonly NOT_SUPPORTED_ERR: 9; + readonly INUSE_ATTRIBUTE_ERR: 10; + readonly INVALID_STATE_ERR: 11; + readonly SYNTAX_ERR: 12; + readonly INVALID_MODIFICATION_ERR: 13; + readonly NAMESPACE_ERR: 14; + readonly INVALID_ACCESS_ERR: 15; + readonly VALIDATION_ERR: 16; + readonly TYPE_MISMATCH_ERR: 17; + readonly SECURITY_ERR: 18; + readonly NETWORK_ERR: 19; + readonly ABORT_ERR: 20; + readonly URL_MISMATCH_ERR: 21; + readonly QUOTA_EXCEEDED_ERR: 22; + readonly TIMEOUT_ERR: 23; + readonly INVALID_NODE_TYPE_ERR: 24; + readonly DATA_CLONE_ERR: 25; +}; + +/** + * The **`DOMImplementation`** interface represents an object providing methods which are not dependent on any particular document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMImplementation) + */ +interface DOMImplementation { + /** + * The **`DOMImplementation.createDocument()`** method creates and returns an XMLDocument. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMImplementation/createDocument) + */ + createDocument(namespace: string | null, qualifiedName: string | null, doctype?: DocumentType | null): XMLDocument; + /** + * The **`DOMImplementation.createDocumentType()`** method returns a DocumentType object which can either be used with into the document via methods like Node.insertBefore() or ```js-nolint createDocumentType(qualifiedNameStr, publicId, systemId) ``` - `qualifiedNameStr` - : A string containing the qualified name, like `svg:svg`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMImplementation/createDocumentType) + */ + createDocumentType(name: string, publicId: string, systemId: string): DocumentType; + /** + * The **`DOMImplementation.createHTMLDocument()`** method creates a new HTML Document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMImplementation/createHTMLDocument) + */ + createHTMLDocument(title?: string): Document; + /** + * The **`DOMImplementation.hasFeature()`** method returns a boolean flag indicating if a given feature is supported. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMImplementation/hasFeature) + */ + hasFeature(...args: any[]): true; +} + +declare var DOMImplementation: { + prototype: DOMImplementation; + new(): DOMImplementation; +}; + +/** + * The **`DOMMatrix`** interface represents 4×4 matrices, suitable for 2D and 3D operations including rotation and translation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix) + */ +interface DOMMatrix extends DOMMatrixReadOnly { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + a: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + b: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + c: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + d: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + e: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + f: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + m11: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + m12: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + m13: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + m14: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + m21: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + m22: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + m23: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + m24: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + m31: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + m32: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + m33: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + m34: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + m41: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + m42: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + m43: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix#instance_properties) */ + m44: number; + /** + * The **`invertSelf()`** method of the DOMMatrix interface inverts the original matrix. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix/invertSelf) + */ + invertSelf(): DOMMatrix; + /** + * The **`multiplySelf()`** method of the DOMMatrix interface multiplies a matrix by the `otherMatrix` parameter, computing the dot product of the original matrix and the specified matrix: `A⋅B`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix/multiplySelf) + */ + multiplySelf(other?: DOMMatrixInit): DOMMatrix; + /** + * The **`preMultiplySelf()`** method of the DOMMatrix interface modifies the matrix by pre-multiplying it with the specified `DOMMatrix`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix/preMultiplySelf) + */ + preMultiplySelf(other?: DOMMatrixInit): DOMMatrix; + /** + * The `rotateAxisAngleSelf()` method of the DOMMatrix interface is a transformation method that rotates the source matrix by the given vector and angle, returning the altered matrix. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix/rotateAxisAngleSelf) + */ + rotateAxisAngleSelf(x?: number, y?: number, z?: number, angle?: number): DOMMatrix; + /** + * The `rotateFromVectorSelf()` method of the DOMMatrix interface is a mutable transformation method that modifies a matrix by rotating the matrix by the angle between the specified vector and `(1, 0)`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix/rotateFromVectorSelf) + */ + rotateFromVectorSelf(x?: number, y?: number): DOMMatrix; + /** + * The `rotateSelf()` method of the DOMMatrix interface is a mutable transformation method that modifies a matrix. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix/rotateSelf) + */ + rotateSelf(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix; + /** + * The **`scale3dSelf()`** method of the DOMMatrix interface is a mutable transformation method that modifies a matrix by applying a specified scaling factor to all three axes, centered on the given origin, with a default origin of `(0, 0, 0)`, returning the 3D-scaled matrix. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix/scale3dSelf) + */ + scale3dSelf(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; + /** + * The **`scaleSelf()`** method of the DOMMatrix interface is a mutable transformation method that modifies a matrix by applying a specified scaling factor, centered on the given origin, with a default origin of `(0, 0)`, returning the scaled matrix. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix/scaleSelf) + */ + scaleSelf(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; + /** + * The **`setMatrixValue()`** method of the DOMMatrix interface replaces the contents of the matrix with the matrix described by the specified transform or transforms, returning itself. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix/setMatrixValue) + */ + setMatrixValue(transformList: string): DOMMatrix; + /** + * The `skewXSelf()` method of the DOMMatrix interface is a mutable transformation method that modifies a matrix. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix/skewXSelf) + */ + skewXSelf(sx?: number): DOMMatrix; + /** + * The `skewYSelf()` method of the DOMMatrix interface is a mutable transformation method that modifies a matrix. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix/skewYSelf) + */ + skewYSelf(sy?: number): DOMMatrix; + /** + * The `translateSelf()` method of the DOMMatrix interface is a mutable transformation method that modifies a matrix. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix/translateSelf) + */ + translateSelf(tx?: number, ty?: number, tz?: number): DOMMatrix; +} + +declare var DOMMatrix: { + prototype: DOMMatrix; + new(init?: string | number[]): DOMMatrix; + fromFloat32Array(array32: Float32Array): DOMMatrix; + fromFloat64Array(array64: Float64Array): DOMMatrix; + fromMatrix(other?: DOMMatrixInit): DOMMatrix; +}; + +type SVGMatrix = DOMMatrix; +declare var SVGMatrix: typeof DOMMatrix; + +type WebKitCSSMatrix = DOMMatrix; +declare var WebKitCSSMatrix: typeof DOMMatrix; + +/** + * The **`DOMMatrixReadOnly`** interface represents a read-only 4×4 matrix, suitable for 2D and 3D operations. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly) + */ +interface DOMMatrixReadOnly { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly a: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly b: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly c: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly d: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly e: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly f: number; + /** + * The readonly **`is2D`** property of the DOMMatrixReadOnly interface is a Boolean flag that is `true` when the matrix is 2D. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/is2D) + */ + readonly is2D: boolean; + /** + * The readonly **`isIdentity`** property of the DOMMatrixReadOnly interface is a Boolean whose value is `true` if the matrix is the identity matrix. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/isIdentity) + */ + readonly isIdentity: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly m11: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly m12: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly m13: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly m14: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly m21: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly m22: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly m23: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly m24: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly m31: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly m32: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly m33: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly m34: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly m41: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly m42: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly m43: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly#instance_properties) */ + readonly m44: number; + /** + * The **`flipX()`** method of the DOMMatrixReadOnly interface creates a new matrix being the result of the original matrix flipped about the x-axis. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/flipX) + */ + flipX(): DOMMatrix; + /** + * The **`flipY()`** method of the DOMMatrixReadOnly interface creates a new matrix being the result of the original matrix flipped about the y-axis. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/flipY) + */ + flipY(): DOMMatrix; + /** + * The **`inverse()`** method of the DOMMatrixReadOnly interface creates a new matrix which is the inverse of the original matrix. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/inverse) + */ + inverse(): DOMMatrix; + /** + * The **`multiply()`** method of the DOMMatrixReadOnly interface creates and returns a new matrix which is the dot product of the matrix and the `otherMatrix` parameter. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/multiply) + */ + multiply(other?: DOMMatrixInit): DOMMatrix; + /** + * The `rotate()` method of the DOMMatrixReadOnly interface returns a new DOMMatrix created by rotating the source matrix around each of its axes by the specified number of degrees. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/rotate) + */ + rotate(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix; + /** + * The `rotateAxisAngle()` method of the DOMMatrixReadOnly interface returns a new DOMMatrix created by rotating the source matrix by the given vector and angle. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/rotateAxisAngle) + */ + rotateAxisAngle(x?: number, y?: number, z?: number, angle?: number): DOMMatrix; + /** + * The `rotateFromVector()` method of the DOMMatrixReadOnly interface is returns a new DOMMatrix created by rotating the source matrix by the angle between the specified vector and `(1, 0)`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/rotateFromVector) + */ + rotateFromVector(x?: number, y?: number): DOMMatrix; + /** + * The **`scale()`** method of the original matrix with a scale transform applied. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/scale) + */ + scale(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; + /** + * The **`scale3d()`** method of the DOMMatrixReadOnly interface creates a new matrix which is the result of a 3D scale transform being applied to the matrix. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/scale3d) + */ + scale3d(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; + /** @deprecated */ + scaleNonUniform(scaleX?: number, scaleY?: number): DOMMatrix; + /** + * The `skewX()` method of the DOMMatrixReadOnly interface returns a new DOMMatrix created by applying the specified skew transformation to the source matrix along its x-axis. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/skewX) + */ + skewX(sx?: number): DOMMatrix; + /** + * The `skewY()` method of the DOMMatrixReadOnly interface returns a new DOMMatrix created by applying the specified skew transformation to the source matrix along its y-axis. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/skewY) + */ + skewY(sy?: number): DOMMatrix; + /** + * The **`toFloat32Array()`** method of the DOMMatrixReadOnly interface returns a new Float32Array containing all 16 elements (`m11`, `m12`, `m13`, `m14`, `m21`, `m22`, `m23`, `m24`, `m31`, `m32`, `m33`, `m34`, `m41`, `m42`, `m43`, `m44`) which comprise the matrix. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/toFloat32Array) + */ + toFloat32Array(): Float32Array; + /** + * The **`toFloat64Array()`** method of the DOMMatrixReadOnly interface returns a new Float64Array containing all 16 elements (`m11`, `m12`, `m13`, `m14`, `m21`, `m22`, `m23`, `m24`, `m31`, `m32`, `m33`, `m34`, `m41`, `m42`, `m43`, `m44`) which comprise the matrix. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/toFloat64Array) + */ + toFloat64Array(): Float64Array; + /** + * The **`toJSON()`** method of the DOMMatrixReadOnly interface creates and returns a JSON object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/toJSON) + */ + toJSON(): any; + /** + * The **`transformPoint`** method of the You can also create a new `DOMPoint` by applying a matrix to a point with the DOMPointReadOnly.matrixTransform() method. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/transformPoint) + */ + transformPoint(point?: DOMPointInit): DOMPoint; + /** + * The `translate()` method of the DOMMatrixReadOnly interface creates a new matrix being the result of the original matrix with a translation applied. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/translate) + */ + translate(tx?: number, ty?: number, tz?: number): DOMMatrix; + toString(): string; +} + +declare var DOMMatrixReadOnly: { + prototype: DOMMatrixReadOnly; + new(init?: string | number[]): DOMMatrixReadOnly; + fromFloat32Array(array32: Float32Array): DOMMatrixReadOnly; + fromFloat64Array(array64: Float64Array): DOMMatrixReadOnly; + fromMatrix(other?: DOMMatrixInit): DOMMatrixReadOnly; +}; + +/** + * The **`DOMParser`** interface provides the ability to parse XML or HTML source code from a string into a DOM Document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMParser) + */ +interface DOMParser { + /** + * The **`parseFromString()`** method of the DOMParser interface parses a string containing either HTML or XML, returning an HTMLDocument or an XMLDocument. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMParser/parseFromString) + */ + parseFromString(string: string, type: DOMParserSupportedType): Document; +} + +declare var DOMParser: { + prototype: DOMParser; + new(): DOMParser; +}; + +/** + * A **`DOMPoint`** object represents a 2D or 3D point in a coordinate system; it includes values for the coordinates in up to three dimensions, as well as an optional perspective value. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPoint) + */ +interface DOMPoint extends DOMPointReadOnly { + /** + * The **`DOMPoint`** interface's **`w`** property holds the point's perspective value, w, for a point in space. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPoint/w) + */ + w: number; + /** + * The **`DOMPoint`** interface's **`x`** property holds the horizontal coordinate, x, for a point in space. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPoint/x) + */ + x: number; + /** + * The **`DOMPoint`** interface's **`y`** property holds the vertical coordinate, _y_, for a point in space. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPoint/y) + */ + y: number; + /** + * The **`DOMPoint`** interface's **`z`** property specifies the depth coordinate of a point in space. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPoint/z) + */ + z: number; +} + +declare var DOMPoint: { + prototype: DOMPoint; + new(x?: number, y?: number, z?: number, w?: number): DOMPoint; + /** + * The **`fromPoint()`** static method of the DOMPoint interface creates and returns a new mutable `DOMPoint` object given a source point. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPoint/fromPoint_static) + */ + fromPoint(other?: DOMPointInit): DOMPoint; +}; + +type SVGPoint = DOMPoint; +declare var SVGPoint: typeof DOMPoint; + +/** + * The **`DOMPointReadOnly`** interface specifies the coordinate and perspective fields used by DOMPoint to define a 2D or 3D point in a coordinate system. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly) + */ +interface DOMPointReadOnly { + /** + * The **`DOMPointReadOnly`** interface's **`w`** property holds the point's perspective value, `w`, for a read-only point in space. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly/w) + */ + readonly w: number; + /** + * The **`DOMPointReadOnly`** interface's **`x`** property holds the horizontal coordinate, x, for a read-only point in space. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly/x) + */ + readonly x: number; + /** + * The **`DOMPointReadOnly`** interface's **`y`** property holds the vertical coordinate, y, for a read-only point in space. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly/y) + */ + readonly y: number; + /** + * The **`DOMPointReadOnly`** interface's **`z`** property holds the depth coordinate, z, for a read-only point in space. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly/z) + */ + readonly z: number; + /** + * The **`matrixTransform()`** method of the DOMPointReadOnly interface applies a matrix transform specified as an object to the DOMPointReadOnly object, creating and returning a new `DOMPointReadOnly` object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly/matrixTransform) + */ + matrixTransform(matrix?: DOMMatrixInit): DOMPoint; + /** + * The DOMPointReadOnly method `toJSON()` returns an object giving the ```js-nolint toJSON() ``` None. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly/toJSON) + */ + toJSON(): any; +} + +declare var DOMPointReadOnly: { + prototype: DOMPointReadOnly; + new(x?: number, y?: number, z?: number, w?: number): DOMPointReadOnly; + /** + * The static **DOMPointReadOnly** method `fromPoint()` creates and returns a new `DOMPointReadOnly` object given a source point. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly/fromPoint_static) + */ + fromPoint(other?: DOMPointInit): DOMPointReadOnly; +}; + +/** + * A `DOMQuad` is a collection of four `DOMPoint`s defining the corners of an arbitrary quadrilateral. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMQuad) + */ +interface DOMQuad { + /** + * The **`DOMQuad`** interface's **`p1`** property holds the DOMPoint object that represents one of the four corners of the `DOMQuad`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMQuad/p1) + */ + readonly p1: DOMPoint; + /** + * The **`DOMQuad`** interface's **`p2`** property holds the DOMPoint object that represents one of the four corners of the `DOMQuad`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMQuad/p2) + */ + readonly p2: DOMPoint; + /** + * The **`DOMQuad`** interface's **`p3`** property holds the DOMPoint object that represents one of the four corners of the `DOMQuad`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMQuad/p3) + */ + readonly p3: DOMPoint; + /** + * The **`DOMQuad`** interface's **`p4`** property holds the DOMPoint object that represents one of the four corners of the `DOMQuad`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMQuad/p4) + */ + readonly p4: DOMPoint; + /** + * The DOMQuad method `getBounds()` returns a DOMRect object representing the smallest rectangle that fully contains the `DOMQuad` object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMQuad/getBounds) + */ + getBounds(): DOMRect; + /** + * The DOMQuad method `toJSON()` returns a ```js-nolint toJSON() ``` None. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMQuad/toJSON) + */ + toJSON(): any; +} + +declare var DOMQuad: { + prototype: DOMQuad; + new(p1?: DOMPointInit, p2?: DOMPointInit, p3?: DOMPointInit, p4?: DOMPointInit): DOMQuad; + fromQuad(other?: DOMQuadInit): DOMQuad; + fromRect(other?: DOMRectInit): DOMQuad; +}; + +/** + * A **`DOMRect`** describes the size and position of a rectangle. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRect) + */ +interface DOMRect extends DOMRectReadOnly { + /** + * The **`height`** property of the DOMRect interface represents the height of the rectangle. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRect/height) + */ + height: number; + /** + * The **`width`** property of the DOMRect interface represents the width of the rectangle. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRect/width) + */ + width: number; + /** + * The **`x`** property of the DOMRect interface represents the x-coordinate of the rectangle, which is the horizontal distance between the viewport's left edge and the rectangle's origin. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRect/x) + */ + x: number; + /** + * The **`y`** property of the DOMRect interface represents the y-coordinate of the rectangle, which is the vertical distance between the viewport's top edge and the rectangle's origin. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRect/y) + */ + y: number; +} + +declare var DOMRect: { + prototype: DOMRect; + new(x?: number, y?: number, width?: number, height?: number): DOMRect; + /** + * The **`fromRect()`** static method of the object with a given location and dimensions. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRect/fromRect_static) + */ + fromRect(other?: DOMRectInit): DOMRect; +}; + +type SVGRect = DOMRect; +declare var SVGRect: typeof DOMRect; + +/** + * The **`DOMRectList`** interface represents a collection of DOMRect objects, typically used to hold the rectangles associated with a particular element, like bounding boxes returned by methods such as Element.getClientRects. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectList) + */ +interface DOMRectList { + /** + * The read-only **`length`** property of the DOMRectList interface returns the number of DOMRect objects in the list. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectList/length) + */ + readonly length: number; + /** + * The DOMRectList method `item()` returns the DOMRect at the specified index within the list, or `null` if the index is out of range. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectList/item) + */ + item(index: number): DOMRect | null; + [index: number]: DOMRect; +} + +declare var DOMRectList: { + prototype: DOMRectList; + new(): DOMRectList; +}; + +/** + * The **`DOMRectReadOnly`** interface specifies the standard properties (also used by DOMRect) to define a rectangle whose properties are immutable. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly) + */ +interface DOMRectReadOnly { + /** + * The **`bottom`** read-only property of the **`DOMRectReadOnly`** interface returns the bottom coordinate value of the `DOMRect`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/bottom) + */ + readonly bottom: number; + /** + * The **`height`** read-only property of the **`DOMRectReadOnly`** interface represents the height of the `DOMRect`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/height) + */ + readonly height: number; + /** + * The **`left`** read-only property of the **`DOMRectReadOnly`** interface returns the left coordinate value of the `DOMRect`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/left) + */ + readonly left: number; + /** + * The **`right`** read-only property of the **`DOMRectReadOnly`** interface returns the right coordinate value of the `DOMRect`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/right) + */ + readonly right: number; + /** + * The **`top`** read-only property of the **`DOMRectReadOnly`** interface returns the top coordinate value of the `DOMRect`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/top) + */ + readonly top: number; + /** + * The **`width`** read-only property of the **`DOMRectReadOnly`** interface represents the width of the `DOMRect`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/width) + */ + readonly width: number; + /** + * The **`x`** read-only property of the **`DOMRectReadOnly`** interface represents the x coordinate of the `DOMRect`'s origin. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/x) + */ + readonly x: number; + /** + * The **`y`** read-only property of the **`DOMRectReadOnly`** interface represents the y coordinate of the `DOMRect`'s origin. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/y) + */ + readonly y: number; + /** + * The DOMRectReadOnly method `toJSON()` returns a JSON representation of the `DOMRectReadOnly` object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/toJSON) + */ + toJSON(): any; +} + +declare var DOMRectReadOnly: { + prototype: DOMRectReadOnly; + new(x?: number, y?: number, width?: number, height?: number): DOMRectReadOnly; + /** + * The **`fromRect()`** static method of the object with a given location and dimensions. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/fromRect_static) + */ + fromRect(other?: DOMRectInit): DOMRectReadOnly; +}; + +/** + * The **`DOMStringList`** interface is a legacy type returned by some APIs and represents a non-modifiable list of strings (`DOMString`). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMStringList) + */ +interface DOMStringList { + /** + * The read-only **`length`** property indicates the number of strings in the DOMStringList. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMStringList/length) + */ + readonly length: number; + /** + * The **`contains()`** method returns a boolean indicating whether the given string is in the list. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMStringList/contains) + */ + contains(string: string): boolean; + /** + * The **`item()`** method returns a string from a `DOMStringList` by index. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMStringList/item) + */ + item(index: number): string | null; + [index: number]: string; +} + +declare var DOMStringList: { + prototype: DOMStringList; + new(): DOMStringList; +}; + +/** + * The **`DOMStringMap`** interface is used for the HTMLElement.dataset attribute, to represent data for custom attributes added to elements. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMStringMap) + */ +interface DOMStringMap { + [name: string]: string | undefined; +} + +declare var DOMStringMap: { + prototype: DOMStringMap; + new(): DOMStringMap; +}; + +/** + * The **`DOMTokenList`** interface represents a set of space-separated tokens. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMTokenList) + */ +interface DOMTokenList { + /** + * The read-only **`length`** property of the DOMTokenList interface is an `integer` representing the number of objects stored in the object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMTokenList/length) + */ + readonly length: number; + /** + * The **`value`** property of the DOMTokenList interface is a stringifier that returns the value of the list serialized as a string, or clears and sets the list to the given value. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMTokenList/value) + */ + value: string; + toString(): string; + /** + * The **`add()`** method of the DOMTokenList interface adds the given tokens to the list, omitting any that are already present. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMTokenList/add) + */ + add(...tokens: string[]): void; + /** + * The **`contains()`** method of the DOMTokenList interface returns a boolean value — `true` if the underlying list contains the given token, otherwise `false`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMTokenList/contains) + */ + contains(token: string): boolean; + /** + * The **`item()`** method of the DOMTokenList interface returns an item in the list, determined by its position in the list, its index. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMTokenList/item) + */ + item(index: number): string | null; + /** + * The **`remove()`** method of the DOMTokenList interface removes the specified _tokens_ from the list. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMTokenList/remove) + */ + remove(...tokens: string[]): void; + /** + * The **`replace()`** method of the DOMTokenList interface replaces an existing token with a new token. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMTokenList/replace) + */ + replace(token: string, newToken: string): boolean; + /** + * The **`supports()`** method of the DOMTokenList interface returns `true` if a given `token` is in the associated attribute's supported tokens. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMTokenList/supports) + */ + supports(token: string): boolean; + /** + * The **`toggle()`** method of the DOMTokenList interface removes an existing token from the list and returns `false`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMTokenList/toggle) + */ + toggle(token: string, force?: boolean): boolean; + forEach(callbackfn: (value: string, key: number, parent: DOMTokenList) => void, thisArg?: any): void; + [index: number]: string; +} + +declare var DOMTokenList: { + prototype: DOMTokenList; + new(): DOMTokenList; +}; + +/** + * The **`DataTransfer`** object is used to hold any data transferred between contexts, such as a drag and drop operation, or clipboard read/write. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransfer) + */ +interface DataTransfer { + /** + * The **`DataTransfer.dropEffect`** property controls the feedback (typically visual) the user is given during a drag and drop operation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransfer/dropEffect) + */ + dropEffect: "none" | "copy" | "link" | "move"; + /** + * The **`DataTransfer.effectAllowed`** property specifies the effect that is allowed for a drag operation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransfer/effectAllowed) + */ + effectAllowed: "none" | "copy" | "copyLink" | "copyMove" | "link" | "linkMove" | "move" | "all" | "uninitialized"; + /** + * The **`files`** read-only property of `DataTransfer` objects is a list of the files in the drag operation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransfer/files) + */ + readonly files: FileList; + /** + * The read-only `items` property of the DataTransfer interface is a A DataTransferItemList object containing DataTransferItem objects representing the items being dragged in a drag operation, one list item for each object being dragged. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransfer/items) + */ + readonly items: DataTransferItemList; + /** + * The **`DataTransfer.types`** read-only property returns the available types that exist in the DataTransfer.items. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransfer/types) + */ + readonly types: ReadonlyArray; + /** + * The **`DataTransfer.clearData()`** method removes the drag operation's drag data for the given type. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransfer/clearData) + */ + clearData(format?: string): void; + /** + * The **`DataTransfer.getData()`** method retrieves drag data (as a string) for the specified type. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransfer/getData) + */ + getData(format: string): string; + /** + * The **`DataTransfer.setData()`** method sets the drag operation's drag data to the specified data and type. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransfer/setData) + */ + setData(format: string, data: string): void; + /** + * When a drag occurs, a translucent image is generated from the drag target (the element the HTMLElement/dragstart_event event is fired at), and follows the mouse pointer during the drag. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransfer/setDragImage) + */ + setDragImage(image: Element, x: number, y: number): void; +} + +declare var DataTransfer: { + prototype: DataTransfer; + new(): DataTransfer; +}; + +/** + * The **`DataTransferItem`** object represents one drag data item. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItem) + */ +interface DataTransferItem { + /** + * The read-only **`DataTransferItem.kind`** property returns the kind–a string or a file–of the DataTransferItem object representing the _drag data item_. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItem/kind) + */ + readonly kind: string; + /** + * The read-only **`DataTransferItem.type`** property returns the type (format) of the DataTransferItem object representing the drag data item. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItem/type) + */ + readonly type: string; + /** + * If the item is a file, the **`DataTransferItem.getAsFile()`** method returns the drag data item's File object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItem/getAsFile) + */ + getAsFile(): File | null; + /** + * The **`DataTransferItem.getAsString()`** method invokes the given callback with the drag data item's string data as the argument if the item's DataTransferItem.kind is a _Plain unicode string_ (i.e., `kind` is `string`). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItem/getAsString) + */ + getAsString(callback: FunctionStringCallback | null): void; + /** + * If the item described by the DataTransferItem is a file, `webkitGetAsEntry()` returns a FileSystemFileEntry or FileSystemDirectoryEntry representing it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItem/webkitGetAsEntry) + */ + webkitGetAsEntry(): FileSystemEntry | null; +} + +declare var DataTransferItem: { + prototype: DataTransferItem; + new(): DataTransferItem; +}; + +/** + * The **`DataTransferItemList`** object is a list of DataTransferItem objects representing items being dragged. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItemList) + */ +interface DataTransferItemList { + /** + * The read-only **`length`** property of the the drag item list. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItemList/length) + */ + readonly length: number; + /** + * The **`DataTransferItemList.add()`** method creates a new list. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItemList/add) + */ + add(data: string, type: string): DataTransferItem | null; + add(data: File): DataTransferItem | null; + /** + * The DataTransferItemList method **`clear()`** removes all DataTransferItem objects from the drag data items list, leaving the list empty. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItemList/clear) + */ + clear(): void; + /** + * The **`DataTransferItemList.remove()`** method removes the less than zero or greater than one less than the length of the list, the list will not be changed. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItemList/remove) + */ + remove(index: number): void; + [index: number]: DataTransferItem; +} + +declare var DataTransferItemList: { + prototype: DataTransferItemList; + new(): DataTransferItemList; +}; + +/** + * The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream) + */ +interface DecompressionStream extends GenericTransformStream { + readonly readable: ReadableStream>; + readonly writable: WritableStream; +} + +declare var DecompressionStream: { + prototype: DecompressionStream; + new(format: CompressionFormat): DecompressionStream; +}; + +/** + * The **`DelayNode`** interface represents a delay-line; an AudioNode audio-processing module that causes a delay between the arrival of an input data and its propagation to the output. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DelayNode) + */ +interface DelayNode extends AudioNode { + /** + * The `delayTime` property of the DelayNode interface is an a-rate AudioParam representing the amount of delay to apply. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DelayNode/delayTime) + */ + readonly delayTime: AudioParam; +} + +declare var DelayNode: { + prototype: DelayNode; + new(context: BaseAudioContext, options?: DelayOptions): DelayNode; +}; + +/** + * The **`DeviceMotionEvent`** interface of the Device Orientation Events provides web developers with information about the speed of changes for the device's position and orientation. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent) + */ +interface DeviceMotionEvent extends Event { + /** + * The **`acceleration`** read-only property of the DeviceMotionEvent interface returns the acceleration recorded by the device, in meters per second squared (m/s²). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent/acceleration) + */ + readonly acceleration: DeviceMotionEventAcceleration | null; + /** + * The **`accelerationIncludingGravity`** read-only property of the DeviceMotionEvent interface returns the amount of acceleration recorded by the device, in meters per second squared (m/s²). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent/accelerationIncludingGravity) + */ + readonly accelerationIncludingGravity: DeviceMotionEventAcceleration | null; + /** + * The **`interval`** read-only property of the DeviceMotionEvent interface returns the interval, in milliseconds, at which data is obtained from the underlying hardware. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent/interval) + */ + readonly interval: number; + /** + * The **`rotationRate`** read-only property of the DeviceMotionEvent interface returns the rate at which the device is rotating around each of its axes in degrees per second. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent/rotationRate) + */ + readonly rotationRate: DeviceMotionEventRotationRate | null; +} + +declare var DeviceMotionEvent: { + prototype: DeviceMotionEvent; + new(type: string, eventInitDict?: DeviceMotionEventInit): DeviceMotionEvent; +}; + +/** + * The **`DeviceMotionEventAcceleration`** interface of the Device Orientation Events provides information about the amount of acceleration the device is experiencing along all three axes. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEventAcceleration) + */ +interface DeviceMotionEventAcceleration { + /** + * The **`x`** read-only property of the DeviceMotionEventAcceleration interface indicates the amount of acceleration that occurred along the X axis in a `DeviceMotionEventAcceleration` object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEventAcceleration/x) + */ + readonly x: number | null; + /** + * The **`y`** read-only property of the DeviceMotionEventAcceleration interface indicates the amount of acceleration that occurred along the Y axis in a `DeviceMotionEventAcceleration` object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEventAcceleration/y) + */ + readonly y: number | null; + /** + * The **`z`** read-only property of the DeviceMotionEventAcceleration interface indicates the amount of acceleration that occurred along the Z axis in a `DeviceMotionEventAcceleration` object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEventAcceleration/z) + */ + readonly z: number | null; +} + +/** + * A **`DeviceMotionEventRotationRate`** interface of the Device Orientation Events provides information about the rate at which the device is rotating around all three axes. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEventRotationRate) + */ +interface DeviceMotionEventRotationRate { + /** + * The **`alpha`** read-only property of the DeviceMotionEventRotationRate interface indicates the rate of rotation around the Z axis, in degrees per second. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEventRotationRate/alpha) + */ + readonly alpha: number | null; + /** + * The **`beta`** read-only property of the DeviceMotionEventRotationRate interface indicates the rate of rotation around the X axis, in degrees per second. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEventRotationRate/beta) + */ + readonly beta: number | null; + /** + * The **`gamma`** read-only property of the DeviceMotionEventRotationRate interface indicates the rate of rotation around the Y axis, in degrees per second. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEventRotationRate/gamma) + */ + readonly gamma: number | null; +} + +/** + * The **`DeviceOrientationEvent`** interface of the Device Orientation Events provides web developers with information from the physical orientation of the device running the web page. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceOrientationEvent) + */ +interface DeviceOrientationEvent extends Event { + /** + * The **`absolute`** read-only property of the DeviceOrientationEvent interface indicates whether or not the device is providing orientation data absolutely (that is, in reference to the Earth's coordinate frame) or using some arbitrary frame determined by the device. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceOrientationEvent/absolute) + */ + readonly absolute: boolean; + /** + * The **`alpha`** read-only property of the DeviceOrientationEvent interface returns the rotation of the device around the Z axis; that is, the number of degrees by which the device is being twisted around the center of the screen. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceOrientationEvent/alpha) + */ + readonly alpha: number | null; + /** + * The **`beta`** read-only property of the DeviceOrientationEvent interface returns the rotation of the device around the X axis; that is, the number of degrees, ranged between -180 and 180, by which the device is tipped forward or backward. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceOrientationEvent/beta) + */ + readonly beta: number | null; + /** + * The **`gamma`** read-only property of the DeviceOrientationEvent interface returns the rotation of the device around the Y axis; that is, the number of degrees, ranged between `-90` and `90`, by which the device is tilted left or right. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceOrientationEvent/gamma) + */ + readonly gamma: number | null; +} + +declare var DeviceOrientationEvent: { + prototype: DeviceOrientationEvent; + new(type: string, eventInitDict?: DeviceOrientationEventInit): DeviceOrientationEvent; +}; + +interface DocumentEventMap extends GlobalEventHandlersEventMap { + "DOMContentLoaded": Event; + "fullscreenchange": Event; + "fullscreenerror": Event; + "pointerlockchange": Event; + "pointerlockerror": Event; + "readystatechange": Event; + "visibilitychange": Event; +} + +/** + * The **`Document`** interface represents any web page loaded in the browser and serves as an entry point into the web page's content, which is the DOM tree. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document) + */ +interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEventHandlers, NonElementParentNode, ParentNode, XPathEvaluatorBase { + /** + * The **`URL`** read-only property of the Document interface returns the document location as a string. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/URL) + */ + readonly URL: string; + /** + * Returns or sets the color of an active link in the document body. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/alinkColor) + */ + alinkColor: string; + /** + * The Document interface's read-only **`all`** property returns an HTMLAllCollection rooted at the document node. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/all) + */ + readonly all: HTMLAllCollection; + /** + * The **`anchors`** read-only property of the An HTMLCollection. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/anchors) + */ + readonly anchors: HTMLCollectionOf; + /** + * The **`applets`** property of the Document returns an empty HTMLCollection. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/applets) + */ + readonly applets: HTMLCollection; + /** + * The deprecated `bgColor` property gets or sets the background color of the current document. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/bgColor) + */ + bgColor: string; + /** + * The **`Document.body`** property represents the `null` if no such element exists. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/body) + */ + body: HTMLElement; + /** + * The **`Document.characterSet`** read-only property returns the character encoding of the document that it's currently rendered with. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/characterSet) + */ + readonly characterSet: string; + /** + * @deprecated This is a legacy alias of `characterSet`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/characterSet) + */ + readonly charset: string; + /** + * The **`Document.compatMode`** read-only property indicates whether the document is rendered in Quirks mode or Standards mode. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/compatMode) + */ + readonly compatMode: string; + /** + * The **`Document.contentType`** read-only property returns the MIME type that the document is being rendered as. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/contentType) + */ + readonly contentType: string; + /** + * The Document property `cookie` lets you read and write cookies associated with the document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/cookie) + */ + cookie: string; + /** + * The **`Document.currentScript`** property returns the script element whose script is currently being processed and isn't a JavaScript module. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/currentScript) + */ + readonly currentScript: HTMLOrSVGScriptElement | null; + /** + * In browsers, **`document.defaultView`** returns the This property is read-only. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/defaultView) + */ + readonly defaultView: (WindowProxy & typeof globalThis) | null; + /** + * **`document.designMode`** controls whether the entire document is editable. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/designMode) + */ + designMode: string; + /** + * The **`Document.dir`** property is a string representing the directionality of the text of the document, whether left to right (default) or right to left. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/dir) + */ + dir: string; + /** + * The **`doctype`** read-only property of the Document interface is a DocumentType object representing the Doctype associated with the current document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/doctype) + */ + readonly doctype: DocumentType | null; + /** + * The **`documentElement`** read-only property of the Document interface returns the example, the html element for HTML documents). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/documentElement) + */ + readonly documentElement: HTMLElement; + /** + * The **`documentURI`** read-only property of the A string. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/documentURI) + */ + readonly documentURI: string; + /** + * The **`domain`** property of the Document interface gets/sets the domain portion of the origin of the current document, as used by the same-origin policy. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/domain) + */ + domain: string; + /** + * The **`embeds`** read-only property of the An HTMLCollection. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/embeds) + */ + readonly embeds: HTMLCollectionOf; + /** + * **`fgColor`** gets/sets the foreground color, or text color, of the current document. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/fgColor) + */ + fgColor: string; + /** + * The **`forms`** read-only property of the Document interface returns an HTMLCollection listing all the form elements contained in the document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/forms) + */ + readonly forms: HTMLCollectionOf; + /** + * The **`fragmentDirective`** read-only property of the Document interface returns the FragmentDirective for the current document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/fragmentDirective) + */ + readonly fragmentDirective: FragmentDirective; + /** + * The obsolete Document interface's **`fullscreen`** read-only property reports whether or not the document is currently displaying content in fullscreen mode. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/fullscreen) + */ + readonly fullscreen: boolean; + /** + * The read-only **`fullscreenEnabled`** property on the Document interface indicates whether or not fullscreen mode is available. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/fullscreenEnabled) + */ + readonly fullscreenEnabled: boolean; + /** + * The **`head`** read-only property of the Document interface returns the head element of the current document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/head) + */ + readonly head: HTMLHeadElement; + /** + * The **`Document.hidden`** read-only property returns a Boolean value indicating if the page is considered hidden or not. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/hidden) + */ + readonly hidden: boolean; + /** + * The **`images`** read-only property of the Document interface returns a collection of the images in the current HTML document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/images) + */ + readonly images: HTMLCollectionOf; + /** + * The **`Document.implementation`** property returns a A DOMImplementation object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/implementation) + */ + readonly implementation: DOMImplementation; + /** + * @deprecated This is a legacy alias of `characterSet`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/characterSet) + */ + readonly inputEncoding: string; + /** + * The **`lastModified`** property of the Document interface returns a string containing the date and local time on which the current document was last modified. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/lastModified) + */ + readonly lastModified: string; + /** + * The **`Document.linkColor`** property gets/sets the color of links within the document. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/linkColor) + */ + linkColor: string; + /** + * The **`links`** read-only property of the Document interface returns a collection of all area elements and a elements in a document with a value for the href attribute. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/links) + */ + readonly links: HTMLCollectionOf; + /** + * The **`Document.location`** read-only property returns a and provides methods for changing that URL and loading another URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/location) + */ + get location(): Location; + set location(href: string); + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/fullscreenchange_event) */ + onfullscreenchange: ((this: Document, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/fullscreenerror_event) */ + onfullscreenerror: ((this: Document, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/pointerlockchange_event) */ + onpointerlockchange: ((this: Document, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/pointerlockerror_event) */ + onpointerlockerror: ((this: Document, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/readystatechange_event) */ + onreadystatechange: ((this: Document, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/visibilitychange_event) */ + onvisibilitychange: ((this: Document, ev: Event) => any) | null; + readonly ownerDocument: null; + /** + * The read-only **`pictureInPictureEnabled`** property of the available. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/pictureInPictureEnabled) + */ + readonly pictureInPictureEnabled: boolean; + /** + * The **`plugins`** read-only property of the containing one or more HTMLEmbedElements representing the An HTMLCollection. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/plugins) + */ + readonly plugins: HTMLCollectionOf; + /** + * The **`Document.readyState`** property describes the loading state of the document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/readyState) + */ + readonly readyState: DocumentReadyState; + /** + * The **`Document.referrer`** property returns the URI of the page that linked to this page. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/referrer) + */ + readonly referrer: string; + /** + * **`Document.rootElement`** returns the Element that is the root element of the document if it is an documents. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/rootElement) + */ + readonly rootElement: SVGSVGElement | null; + /** + * The **`scripts`** property of the Document interface returns a list of the script elements in the document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/scripts) + */ + readonly scripts: HTMLCollectionOf; + /** + * The **`scrollingElement`** read-only property of the scrolls the document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/scrollingElement) + */ + readonly scrollingElement: Element | null; + /** + * The `timeline` readonly property of the Document interface represents the default timeline of the current document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/timeline) + */ + readonly timeline: DocumentTimeline; + /** + * The **`document.title`** property gets or sets the current title of the document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/title) + */ + title: string; + /** + * The **`Document.visibilityState`** read-only property returns the visibility of the document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/visibilityState) + */ + readonly visibilityState: DocumentVisibilityState; + /** + * The **`Document.vlinkColor`** property gets/sets the color of links that the user has visited in the document. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/vlinkColor) + */ + vlinkColor: string; + /** + * **`Document.adoptNode()`** transfers a node/dom from another Document into the method's document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/adoptNode) + */ + adoptNode(node: T): T; + /** @deprecated */ + captureEvents(): void; + /** + * The **`caretPositionFromPoint()`** method of the Document interface returns a CaretPosition object, containing the DOM node, along with the caret and caret's character offset within that node. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/caretPositionFromPoint) + */ + caretPositionFromPoint(x: number, y: number, options?: CaretPositionFromPointOptions): CaretPosition | null; + /** @deprecated */ + caretRangeFromPoint(x: number, y: number): Range | null; + /** + * The **`Document.clear()`** method does nothing, but doesn't raise any error. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/clear) + */ + clear(): void; + /** + * The **`Document.close()`** method finishes writing to a document, opened with Document.open(). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/close) + */ + close(): void; + /** + * The **`Document.createAttribute()`** method creates a new attribute node, and returns it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createAttribute) + */ + createAttribute(localName: string): Attr; + /** + * The **`Document.createAttributeNS()`** method creates a new attribute node with the specified namespace URI and qualified name, and returns it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createAttributeNS) + */ + createAttributeNS(namespace: string | null, qualifiedName: string): Attr; + /** + * **`createCDATASection()`** creates a new CDATA section node, and returns it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createCDATASection) + */ + createCDATASection(data: string): CDATASection; + /** + * **`createComment()`** creates a new comment node, and returns it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createComment) + */ + createComment(data: string): Comment; + /** + * Creates a new empty DocumentFragment into which DOM nodes can be added to build an offscreen DOM tree. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createDocumentFragment) + */ + createDocumentFragment(): DocumentFragment; + /** + * In an HTML document, the **`document.createElement()`** method creates the HTML element specified by `localName`, or an HTMLUnknownElement if `localName` isn't recognized. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createElement) + */ + createElement(tagName: K, options?: ElementCreationOptions): HTMLElementTagNameMap[K]; + /** @deprecated */ + createElement(tagName: K, options?: ElementCreationOptions): HTMLElementDeprecatedTagNameMap[K]; + createElement(tagName: string, options?: ElementCreationOptions): HTMLElement; + /** + * Creates an element with the specified namespace URI and qualified name. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createElementNS) + */ + createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement; + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: K): SVGElementTagNameMap[K]; + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement; + createElementNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", qualifiedName: K): MathMLElementTagNameMap[K]; + createElementNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", qualifiedName: string): MathMLElement; + createElementNS(namespaceURI: string | null, qualifiedName: string, options?: ElementCreationOptions): Element; + createElementNS(namespace: string | null, qualifiedName: string, options?: string | ElementCreationOptions): Element; + /** + * Creates an event of the type specified. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createEvent) + */ + createEvent(eventInterface: "AnimationEvent"): AnimationEvent; + createEvent(eventInterface: "AnimationPlaybackEvent"): AnimationPlaybackEvent; + createEvent(eventInterface: "AudioProcessingEvent"): AudioProcessingEvent; + createEvent(eventInterface: "BeforeUnloadEvent"): BeforeUnloadEvent; + createEvent(eventInterface: "BlobEvent"): BlobEvent; + createEvent(eventInterface: "ClipboardEvent"): ClipboardEvent; + createEvent(eventInterface: "CloseEvent"): CloseEvent; + createEvent(eventInterface: "CompositionEvent"): CompositionEvent; + createEvent(eventInterface: "ContentVisibilityAutoStateChangeEvent"): ContentVisibilityAutoStateChangeEvent; + createEvent(eventInterface: "CookieChangeEvent"): CookieChangeEvent; + createEvent(eventInterface: "CustomEvent"): CustomEvent; + createEvent(eventInterface: "DeviceMotionEvent"): DeviceMotionEvent; + createEvent(eventInterface: "DeviceOrientationEvent"): DeviceOrientationEvent; + createEvent(eventInterface: "DragEvent"): DragEvent; + createEvent(eventInterface: "ErrorEvent"): ErrorEvent; + createEvent(eventInterface: "Event"): Event; + createEvent(eventInterface: "Events"): Event; + createEvent(eventInterface: "FocusEvent"): FocusEvent; + createEvent(eventInterface: "FontFaceSetLoadEvent"): FontFaceSetLoadEvent; + createEvent(eventInterface: "FormDataEvent"): FormDataEvent; + createEvent(eventInterface: "GamepadEvent"): GamepadEvent; + createEvent(eventInterface: "HashChangeEvent"): HashChangeEvent; + createEvent(eventInterface: "IDBVersionChangeEvent"): IDBVersionChangeEvent; + createEvent(eventInterface: "InputEvent"): InputEvent; + createEvent(eventInterface: "KeyboardEvent"): KeyboardEvent; + createEvent(eventInterface: "MIDIConnectionEvent"): MIDIConnectionEvent; + createEvent(eventInterface: "MIDIMessageEvent"): MIDIMessageEvent; + createEvent(eventInterface: "MediaEncryptedEvent"): MediaEncryptedEvent; + createEvent(eventInterface: "MediaKeyMessageEvent"): MediaKeyMessageEvent; + createEvent(eventInterface: "MediaQueryListEvent"): MediaQueryListEvent; + createEvent(eventInterface: "MediaStreamTrackEvent"): MediaStreamTrackEvent; + createEvent(eventInterface: "MessageEvent"): MessageEvent; + createEvent(eventInterface: "MouseEvent"): MouseEvent; + createEvent(eventInterface: "MouseEvents"): MouseEvent; + createEvent(eventInterface: "OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; + createEvent(eventInterface: "PageRevealEvent"): PageRevealEvent; + createEvent(eventInterface: "PageSwapEvent"): PageSwapEvent; + createEvent(eventInterface: "PageTransitionEvent"): PageTransitionEvent; + createEvent(eventInterface: "PaymentMethodChangeEvent"): PaymentMethodChangeEvent; + createEvent(eventInterface: "PaymentRequestUpdateEvent"): PaymentRequestUpdateEvent; + createEvent(eventInterface: "PictureInPictureEvent"): PictureInPictureEvent; + createEvent(eventInterface: "PointerEvent"): PointerEvent; + createEvent(eventInterface: "PopStateEvent"): PopStateEvent; + createEvent(eventInterface: "ProgressEvent"): ProgressEvent; + createEvent(eventInterface: "PromiseRejectionEvent"): PromiseRejectionEvent; + createEvent(eventInterface: "RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; + createEvent(eventInterface: "RTCDataChannelEvent"): RTCDataChannelEvent; + createEvent(eventInterface: "RTCErrorEvent"): RTCErrorEvent; + createEvent(eventInterface: "RTCPeerConnectionIceErrorEvent"): RTCPeerConnectionIceErrorEvent; + createEvent(eventInterface: "RTCPeerConnectionIceEvent"): RTCPeerConnectionIceEvent; + createEvent(eventInterface: "RTCTrackEvent"): RTCTrackEvent; + createEvent(eventInterface: "SecurityPolicyViolationEvent"): SecurityPolicyViolationEvent; + createEvent(eventInterface: "SpeechSynthesisErrorEvent"): SpeechSynthesisErrorEvent; + createEvent(eventInterface: "SpeechSynthesisEvent"): SpeechSynthesisEvent; + createEvent(eventInterface: "StorageEvent"): StorageEvent; + createEvent(eventInterface: "SubmitEvent"): SubmitEvent; + createEvent(eventInterface: "TextEvent"): TextEvent; + createEvent(eventInterface: "ToggleEvent"): ToggleEvent; + createEvent(eventInterface: "TouchEvent"): TouchEvent; + createEvent(eventInterface: "TrackEvent"): TrackEvent; + createEvent(eventInterface: "TransitionEvent"): TransitionEvent; + createEvent(eventInterface: "UIEvent"): UIEvent; + createEvent(eventInterface: "UIEvents"): UIEvent; + createEvent(eventInterface: "WebGLContextEvent"): WebGLContextEvent; + createEvent(eventInterface: "WheelEvent"): WheelEvent; + createEvent(eventInterface: string): Event; + /** + * The **`Document.createNodeIterator()`** method returns a new `NodeIterator` object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createNodeIterator) + */ + createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter | null): NodeIterator; + /** + * `createProcessingInstruction()` generates a new processing instruction node and returns it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createProcessingInstruction) + */ + createProcessingInstruction(target: string, data: string): ProcessingInstruction; + /** + * The **`Document.createRange()`** method returns a new ```js-nolint createRange() ``` None. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createRange) + */ + createRange(): Range; + /** + * Creates a new Text node. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createTextNode) + */ + createTextNode(data: string): Text; + /** + * The **`Document.createTreeWalker()`** creator method returns a newly created TreeWalker object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createTreeWalker) + */ + createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter | null): TreeWalker; + /** + * The **`execCommand`** method implements multiple different commands. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/execCommand) + */ + execCommand(commandId: string, showUI?: boolean, value?: string): boolean; + /** + * The Document method **`exitFullscreen()`** requests that the element on this document which is currently being presented in fullscreen mode be taken out of fullscreen mode, restoring the previous state of the screen. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/exitFullscreen) + */ + exitFullscreen(): Promise; + /** + * The **`exitPictureInPicture()`** method of the Document interface requests that a video contained in this document, which is currently floating, be taken out of picture-in-picture mode, restoring the previous state of the screen. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/exitPictureInPicture) + */ + exitPictureInPicture(): Promise; + /** + * The **`exitPointerLock()`** method of the Document interface asynchronously releases a pointer lock previously requested through Element.requestPointerLock. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/exitPointerLock) + */ + exitPointerLock(): void; + getElementById(elementId: string): HTMLElement | null; + /** + * The **`getElementsByClassName`** method of of all child elements which have all of the given class name(s). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/getElementsByClassName) + */ + getElementsByClassName(classNames: string): HTMLCollectionOf; + /** + * The **`getElementsByName()`** method of the Document object returns a NodeList Collection of elements with a given `name` attribute in the document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/getElementsByName) + */ + getElementsByName(elementName: string): NodeListOf; + /** + * The **`getElementsByTagName`** method of The complete document is searched, including the root node. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/getElementsByTagName) + */ + getElementsByTagName(qualifiedName: K): HTMLCollectionOf; + getElementsByTagName(qualifiedName: K): HTMLCollectionOf; + getElementsByTagName(qualifiedName: K): HTMLCollectionOf; + /** @deprecated */ + getElementsByTagName(qualifiedName: K): HTMLCollectionOf; + getElementsByTagName(qualifiedName: string): HTMLCollectionOf; + /** + * Returns a list of elements with the given tag name belonging to the given namespace. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/getElementsByTagNameNS) + */ + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf; + /** + * The **`getSelection()`** method of the Document interface returns the Selection object associated with this document, representing the range of text selected by the user, or the current position of the caret. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/getSelection) + */ + getSelection(): Selection | null; + /** + * The **`hasFocus()`** method of the Document interface returns a boolean value indicating whether the document or any element inside the document has focus. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/hasFocus) + */ + hasFocus(): boolean; + /** + * The **`hasStorageAccess()`** method of the Document interface returns a Promise that resolves with a boolean value indicating whether the document has access to third-party, unpartitioned cookies. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/hasStorageAccess) + */ + hasStorageAccess(): Promise; + /** + * The Document object's **`importNode()`** method creates a copy of a inserted into the current document later. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/importNode) + */ + importNode(node: T, options?: boolean | ImportNodeOptions): T; + /** + * The **`Document.open()`** method opens a document for This does come with some side effects. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/open) + */ + open(unused1?: string, unused2?: string): Document; + open(url: string | URL, name: string, features: string): WindowProxy | null; + /** + * The **`Document.queryCommandEnabled()`** method reports whether or not the specified editor command is enabled by the browser. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/queryCommandEnabled) + */ + queryCommandEnabled(commandId: string): boolean; + /** @deprecated */ + queryCommandIndeterm(commandId: string): boolean; + /** + * The **`queryCommandState()`** method will tell you if the current selection has a certain Document.execCommand() command applied. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/queryCommandState) + */ + queryCommandState(commandId: string): boolean; + /** + * The **`Document.queryCommandSupported()`** method reports whether or not the specified editor command is supported by the browser. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/queryCommandSupported) + */ + queryCommandSupported(commandId: string): boolean; + /** @deprecated */ + queryCommandValue(commandId: string): string; + /** @deprecated */ + releaseEvents(): void; + /** + * The **`requestStorageAccess()`** method of the Document interface allows content loaded in a third-party context (i.e., embedded in an iframe) to request access to third-party cookies and unpartitioned state. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/requestStorageAccess) + */ + requestStorageAccess(): Promise; + /** + * The **`startViewTransition()`** method of the Document interface starts a new same-document (SPA) view transition and returns a ViewTransition object to represent it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/startViewTransition) + */ + startViewTransition(callbackOptions?: ViewTransitionUpdateCallback | StartViewTransitionOptions): ViewTransition; + /** + * The **`write()`** method of the Document interface writes text in one or more TrustedHTML or string parameters to a document stream opened by document.open(). + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/write) + */ + write(...text: string[]): void; + /** + * The **`writeln()`** method of the Document interface writes text in one or more TrustedHTML or string parameters to a document stream opened by document.open(), followed by a newline character. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/writeln) + */ + writeln(...text: string[]): void; + /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent) */ + get textContent(): null; + addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var Document: { + prototype: Document; + new(): Document; + /** + * The **`parseHTMLUnsafe()`** static method of the Document object is used to parse an HTML input, optionally filtering unwanted HTML elements and attributes, in order to create a new Document instance. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/parseHTMLUnsafe_static) + */ + parseHTMLUnsafe(html: string): Document; +}; + +/** + * The **`DocumentFragment`** interface represents a minimal document object that has no parent. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DocumentFragment) + */ +interface DocumentFragment extends Node, NonElementParentNode, ParentNode { + readonly ownerDocument: Document; + getElementById(elementId: string): HTMLElement | null; + /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent) */ + get textContent(): string; + set textContent(value: string | null); +} + +declare var DocumentFragment: { + prototype: DocumentFragment; + new(): DocumentFragment; +}; + +interface DocumentOrShadowRoot { + /** + * Returns the deepest element in the document through which or to which key events are being routed. This is, roughly speaking, the focused element in the document. + * + * For the purposes of this API, when a child browsing context is focused, its container is focused in the parent browsing context. For example, if the user moves the focus to a text control in an iframe, the iframe is the element returned by the activeElement API in the iframe's node document. + * + * Similarly, when the focused element is in a different node tree than documentOrShadowRoot, the element returned will be the host that's located in the same node tree as documentOrShadowRoot if documentOrShadowRoot is a shadow-including inclusive ancestor of the focused element, and null if not. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/activeElement) + */ + readonly activeElement: Element | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/adoptedStyleSheets) */ + adoptedStyleSheets: CSSStyleSheet[]; + /** + * Returns document's fullscreen element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/fullscreenElement) + */ + readonly fullscreenElement: Element | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/pictureInPictureElement) */ + readonly pictureInPictureElement: Element | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/pointerLockElement) */ + readonly pointerLockElement: Element | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/styleSheets) */ + readonly styleSheets: StyleSheetList; + elementFromPoint(x: number, y: number): Element | null; + elementsFromPoint(x: number, y: number): Element[]; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/getAnimations) */ + getAnimations(): Animation[]; +} + +/** + * The **`DocumentTimeline`** interface of the Web Animations API represents animation timelines, including the default document timeline (accessed via Document.timeline). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DocumentTimeline) + */ +interface DocumentTimeline extends AnimationTimeline { +} + +declare var DocumentTimeline: { + prototype: DocumentTimeline; + new(options?: DocumentTimelineOptions): DocumentTimeline; +}; + +/** + * The **`DocumentType`** interface represents a Node containing a doctype. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DocumentType) + */ +interface DocumentType extends Node, ChildNode { + /** + * The read-only **`name`** property of the DocumentType returns the type of the document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DocumentType/name) + */ + readonly name: string; + readonly ownerDocument: Document; + /** + * The read-only **`publicId`** property of the DocumentType returns a formal identifier of the document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DocumentType/publicId) + */ + readonly publicId: string; + /** + * The read-only **`systemId`** property of the DocumentType returns the URL of the associated DTD. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DocumentType/systemId) + */ + readonly systemId: string; + /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent) */ + get textContent(): null; +} + +declare var DocumentType: { + prototype: DocumentType; + new(): DocumentType; +}; + +/** + * The **`DragEvent`** interface is a DOM event that represents a drag and drop interaction. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DragEvent) + */ +interface DragEvent extends MouseEvent { + /** + * The **`DragEvent.dataTransfer`** read-only property holds the drag operation's data (as a DataTransfer object). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DragEvent/dataTransfer) + */ + readonly dataTransfer: DataTransfer | null; +} + +declare var DragEvent: { + prototype: DragEvent; + new(type: string, eventInitDict?: DragEventInit): DragEvent; +}; + +/** + * The `DynamicsCompressorNode` interface provides a compression effect, which lowers the volume of the loudest parts of the signal in order to help prevent clipping and distortion that can occur when multiple sounds are played and multiplexed together at once. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DynamicsCompressorNode) + */ +interface DynamicsCompressorNode extends AudioNode { + /** + * The `attack` property of the DynamicsCompressorNode interface is a k-rate AudioParam representing the amount of time, in seconds, required to reduce the gain by 10 dB. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DynamicsCompressorNode/attack) + */ + readonly attack: AudioParam; + /** + * The `knee` property of the DynamicsCompressorNode interface is a k-rate AudioParam containing a decibel value representing the range above the threshold where the curve smoothly transitions to the compressed portion. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DynamicsCompressorNode/knee) + */ + readonly knee: AudioParam; + /** + * The `ratio` property of the DynamicsCompressorNode interface Is a k-rate AudioParam representing the amount of change, in dB, needed in the input for a 1 dB change in the output. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DynamicsCompressorNode/ratio) + */ + readonly ratio: AudioParam; + /** + * The **`reduction`** read-only property of the DynamicsCompressorNode interface is a float representing the amount of gain reduction currently applied by the compressor to the signal. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DynamicsCompressorNode/reduction) + */ + readonly reduction: number; + /** + * The `release` property of the DynamicsCompressorNode interface Is a k-rate AudioParam representing the amount of time, in seconds, required to increase the gain by 10 dB. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DynamicsCompressorNode/release) + */ + readonly release: AudioParam; + /** + * The `threshold` property of the DynamicsCompressorNode interface is a k-rate AudioParam representing the decibel value above which the compression will start taking effect. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DynamicsCompressorNode/threshold) + */ + readonly threshold: AudioParam; +} + +declare var DynamicsCompressorNode: { + prototype: DynamicsCompressorNode; + new(context: BaseAudioContext, options?: DynamicsCompressorOptions): DynamicsCompressorNode; +}; + +/** + * The **`EXT_blend_minmax`** extension is part of the WebGL API and extends blending capabilities by adding two new blend equations: the minimum or maximum color components of the source and destination colors. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_blend_minmax) + */ +interface EXT_blend_minmax { + readonly MIN_EXT: 0x8007; + readonly MAX_EXT: 0x8008; +} + +/** + * The **`EXT_color_buffer_float`** extension is part of WebGL and adds the ability to render a variety of floating point formats. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_color_buffer_float) + */ +interface EXT_color_buffer_float { +} + +/** + * The **`EXT_color_buffer_half_float`** extension is part of the WebGL API and adds the ability to render to 16-bit floating-point color buffers. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_color_buffer_half_float) + */ +interface EXT_color_buffer_half_float { + readonly RGBA16F_EXT: 0x881A; + readonly RGB16F_EXT: 0x881B; + readonly FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: 0x8211; + readonly UNSIGNED_NORMALIZED_EXT: 0x8C17; +} + +/** + * The WebGL API's `EXT_float_blend` extension allows blending and draw buffers with 32-bit floating-point components. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_float_blend) + */ +interface EXT_float_blend { +} + +/** + * The **`EXT_frag_depth`** extension is part of the WebGL API and enables to set a depth value of a fragment from within the fragment shader. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_frag_depth) + */ +interface EXT_frag_depth { +} + +/** + * The **`EXT_sRGB`** extension is part of the WebGL API and adds sRGB support to textures and framebuffer objects. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_sRGB) + */ +interface EXT_sRGB { + readonly SRGB_EXT: 0x8C40; + readonly SRGB_ALPHA_EXT: 0x8C42; + readonly SRGB8_ALPHA8_EXT: 0x8C43; + readonly FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: 0x8210; +} + +/** + * The **`EXT_shader_texture_lod`** extension is part of the WebGL API and adds additional texture functions to the OpenGL ES Shading Language which provide the shader writer with explicit control of LOD (Level of detail). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_shader_texture_lod) + */ +interface EXT_shader_texture_lod { +} + +/** + * The `EXT_texture_compression_bptc` extension is part of the WebGL API and exposes 4 BPTC compressed texture formats. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_texture_compression_bptc) + */ +interface EXT_texture_compression_bptc { + readonly COMPRESSED_RGBA_BPTC_UNORM_EXT: 0x8E8C; + readonly COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: 0x8E8D; + readonly COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT: 0x8E8E; + readonly COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT: 0x8E8F; +} + +/** + * The `EXT_texture_compression_rgtc` extension is part of the WebGL API and exposes 4 RGTC compressed texture formats. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_texture_compression_rgtc) + */ +interface EXT_texture_compression_rgtc { + readonly COMPRESSED_RED_RGTC1_EXT: 0x8DBB; + readonly COMPRESSED_SIGNED_RED_RGTC1_EXT: 0x8DBC; + readonly COMPRESSED_RED_GREEN_RGTC2_EXT: 0x8DBD; + readonly COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: 0x8DBE; +} + +/** + * The **`EXT_texture_filter_anisotropic`** extension is part of the WebGL API and exposes two constants for anisotropic filtering (AF). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_texture_filter_anisotropic) + */ +interface EXT_texture_filter_anisotropic { + readonly TEXTURE_MAX_ANISOTROPY_EXT: 0x84FE; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: 0x84FF; +} + +/** + * The **`EXT_texture_norm16`** extension is part of the WebGL API and provides a set of new 16-bit signed normalized and unsigned normalized formats (fixed-point texture, renderbuffer and texture buffer). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_texture_norm16) + */ +interface EXT_texture_norm16 { + readonly R16_EXT: 0x822A; + readonly RG16_EXT: 0x822C; + readonly RGB16_EXT: 0x8054; + readonly RGBA16_EXT: 0x805B; + readonly R16_SNORM_EXT: 0x8F98; + readonly RG16_SNORM_EXT: 0x8F99; + readonly RGB16_SNORM_EXT: 0x8F9A; + readonly RGBA16_SNORM_EXT: 0x8F9B; +} + +interface ElementEventMap { + "fullscreenchange": Event; + "fullscreenerror": Event; +} + +/** + * **`Element`** is the most general base class from which all element objects (i.e., objects that represent elements) in a Document inherit. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element) + */ +interface Element extends Node, ARIAMixin, Animatable, ChildNode, NonDocumentTypeChildNode, ParentNode, Slottable { + /** + * The **`Element.attributes`** property returns a live collection of all attribute nodes registered to the specified node. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/attributes) + */ + readonly attributes: NamedNodeMap; + /** + * The **`Element.classList`** is a read-only property that returns a live DOMTokenList collection of the `class` attributes of the element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/classList) + */ + get classList(): DOMTokenList; + set classList(value: string); + /** + * The **`className`** property of the of the specified element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/className) + */ + className: string; + /** + * The **`clientHeight`** read-only property of the Element interface is zero for elements with no CSS or inline layout boxes; otherwise, it's the inner height of an element in pixels. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/clientHeight) + */ + readonly clientHeight: number; + /** + * The **`clientLeft`** read-only property of the Element interface returns the width of the left border of an element in pixels. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/clientLeft) + */ + readonly clientLeft: number; + /** + * The **`clientTop`** read-only property of the Element interface returns the width of the top border of an element in pixels. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/clientTop) + */ + readonly clientTop: number; + /** + * The **`clientWidth`** read-only property of the Element interface is zero for inline elements and elements with no CSS; otherwise, it's the inner width of an element in pixels. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/clientWidth) + */ + readonly clientWidth: number; + /** + * The **`currentCSSZoom`** read-only property of the Element interface provides the 'effective' CSS `zoom` of an element, taking into account the zoom applied to the element and all its parent elements. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/currentCSSZoom) + */ + readonly currentCSSZoom: number; + /** + * The **`id`** property of the Element interface represents the element's identifier, reflecting the **`id`** global attribute. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/id) + */ + id: string; + /** + * The **`innerHTML`** property of the Element interface gets or sets the HTML or XML markup contained within the element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/innerHTML) + */ + innerHTML: string; + /** + * The **`Element.localName`** read-only property returns the local part of the qualified name of an element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/localName) + */ + readonly localName: string; + /** + * The **`Element.namespaceURI`** read-only property returns the namespace URI of the element, or `null` if the element is not in a namespace. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/namespaceURI) + */ + readonly namespaceURI: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/fullscreenchange_event) */ + onfullscreenchange: ((this: Element, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/fullscreenerror_event) */ + onfullscreenerror: ((this: Element, ev: Event) => any) | null; + /** + * The **`outerHTML`** attribute of the Element DOM interface gets the serialized HTML fragment describing the element including its descendants. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/outerHTML) + */ + outerHTML: string; + readonly ownerDocument: Document; + /** + * The **`part`** property of the Element interface represents the part identifier(s) of the element (i.e., set using the `part` attribute), returned as a DOMTokenList. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/part) + */ + get part(): DOMTokenList; + set part(value: string); + /** + * The **`Element.prefix`** read-only property returns the namespace prefix of the specified element, or `null` if no prefix is specified. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/prefix) + */ + readonly prefix: string | null; + /** + * The **`scrollHeight`** read-only property of the Element interface is a measurement of the height of an element's content, including content not visible on the screen due to overflow. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollHeight) + */ + readonly scrollHeight: number; + /** + * The **`scrollLeft`** property of the Element interface gets or sets the number of pixels by which an element's content is scrolled from its left edge. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollLeft) + */ + scrollLeft: number; + /** + * The **`scrollTop`** property of the Element interface gets or sets the number of pixels by which an element's content is scrolled from its top edge. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollTop) + */ + scrollTop: number; + /** + * The **`scrollWidth`** read-only property of the Element interface is a measurement of the width of an element's content, including content not visible on the screen due to overflow. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollWidth) + */ + readonly scrollWidth: number; + /** + * The `Element.shadowRoot` read-only property represents the shadow root hosted by the element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/shadowRoot) + */ + readonly shadowRoot: ShadowRoot | null; + /** + * The **`slot`** property of the Element interface returns the name of the shadow DOM slot the element is inserted in. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/slot) + */ + slot: string; + /** + * The **`tagName`** read-only property of the Element interface returns the tag name of the element on which it's called. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/tagName) + */ + readonly tagName: string; + /** + * The **`Element.attachShadow()`** method attaches a shadow DOM tree to the specified element and returns a reference to its ShadowRoot. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/attachShadow) + */ + attachShadow(init: ShadowRootInit): ShadowRoot; + /** + * The **`checkVisibility()`** method of the Element interface checks whether the element is visible. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/checkVisibility) + */ + checkVisibility(options?: CheckVisibilityOptions): boolean; + /** + * The **`closest()`** method of the Element interface traverses the element and its parents (heading toward the document root) until it finds a node that matches the specified CSS selector. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/closest) + */ + closest(selector: K): HTMLElementTagNameMap[K] | null; + closest(selector: K): SVGElementTagNameMap[K] | null; + closest(selector: K): MathMLElementTagNameMap[K] | null; + closest(selectors: string): E | null; + /** + * The **`computedStyleMap()`** method of the Element interface returns a StylePropertyMapReadOnly interface which provides a read-only representation of a CSS declaration block that is an alternative to CSSStyleDeclaration. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/computedStyleMap) + */ + computedStyleMap(): StylePropertyMapReadOnly; + /** + * The **`getAttribute()`** method of the element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAttribute) + */ + getAttribute(qualifiedName: string): string | null; + /** + * The **`getAttributeNS()`** method of the Element interface returns the string value of the attribute with the specified namespace and name. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAttributeNS) + */ + getAttributeNS(namespace: string | null, localName: string): string | null; + /** + * The **`getAttributeNames()`** method of the array. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAttributeNames) + */ + getAttributeNames(): string[]; + /** + * Returns the specified attribute of the specified element, as an Attr node. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAttributeNode) + */ + getAttributeNode(qualifiedName: string): Attr | null; + /** + * The **`getAttributeNodeNS()`** method of the Element interface returns the namespaced Attr node of an element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAttributeNodeNS) + */ + getAttributeNodeNS(namespace: string | null, localName: string): Attr | null; + /** + * The **`Element.getBoundingClientRect()`** method returns a position relative to the viewport. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getBoundingClientRect) + */ + getBoundingClientRect(): DOMRect; + /** + * The **`getClientRects()`** method of the Element interface returns a collection of DOMRect objects that indicate the bounding rectangles for each CSS border box in a client. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getClientRects) + */ + getClientRects(): DOMRectList; + /** + * The Element method **`getElementsByClassName()`** returns a live specified class name or names. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getElementsByClassName) + */ + getElementsByClassName(classNames: string): HTMLCollectionOf; + /** + * The **`Element.getElementsByTagName()`** method returns a live All descendants of the specified element are searched, but not the element itself. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getElementsByTagName) + */ + getElementsByTagName(qualifiedName: K): HTMLCollectionOf; + getElementsByTagName(qualifiedName: K): HTMLCollectionOf; + getElementsByTagName(qualifiedName: K): HTMLCollectionOf; + /** @deprecated */ + getElementsByTagName(qualifiedName: K): HTMLCollectionOf; + getElementsByTagName(qualifiedName: string): HTMLCollectionOf; + /** + * The **`Element.getElementsByTagNameNS()`** method returns a live HTMLCollection of elements with the given tag name belonging to the given namespace. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getElementsByTagNameNS) + */ + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf; + /** + * The **`getHTML()`** method of the Element interface is used to serialize an element's DOM to an HTML string. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getHTML) + */ + getHTML(options?: GetHTMLOptions): string; + /** + * The **`Element.hasAttribute()`** method returns a **Boolean** value indicating whether the specified element has the specified attribute or not. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/hasAttribute) + */ + hasAttribute(qualifiedName: string): boolean; + /** + * The **`hasAttributeNS()`** method of the Element interface returns a boolean value indicating whether the current element has the specified attribute with the specified namespace. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/hasAttributeNS) + */ + hasAttributeNS(namespace: string | null, localName: string): boolean; + /** + * The **`hasAttributes()`** method of the Element interface returns a boolean value indicating whether the current element has any attributes or not. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/hasAttributes) + */ + hasAttributes(): boolean; + /** + * The **`hasPointerCapture()`** method of the pointer capture for the pointer identified by the given pointer ID. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/hasPointerCapture) + */ + hasPointerCapture(pointerId: number): boolean; + /** + * The **`insertAdjacentElement()`** method of the relative to the element it is invoked upon. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/insertAdjacentElement) + */ + insertAdjacentElement(where: InsertPosition, element: Element): Element | null; + /** + * The **`insertAdjacentHTML()`** method of the the resulting nodes into the DOM tree at a specified position. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/insertAdjacentHTML) + */ + insertAdjacentHTML(position: InsertPosition, string: string): void; + /** + * The **`insertAdjacentText()`** method of the Element interface, given a relative position and a string, inserts a new text node at the given position relative to the element it is called from. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/insertAdjacentText) + */ + insertAdjacentText(where: InsertPosition, data: string): void; + /** + * The **`matches()`** method of the Element interface tests whether the element would be selected by the specified CSS selector. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/matches) + */ + matches(selectors: string): boolean; + /** + * The **`releasePointerCapture()`** method of the previously set for a specific (PointerEvent) _pointer_. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/releasePointerCapture) + */ + releasePointerCapture(pointerId: number): void; + /** + * The Element method **`removeAttribute()`** removes the attribute with the specified name from the element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/removeAttribute) + */ + removeAttribute(qualifiedName: string): void; + /** + * The **`removeAttributeNS()`** method of the If you are working with HTML and you don't need to specify the requested attribute as being part of a specific namespace, use the Element.removeAttribute() method instead. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/removeAttributeNS) + */ + removeAttributeNS(namespace: string | null, localName: string): void; + /** + * The **`removeAttributeNode()`** method of the Element interface removes the specified Attr node from the element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/removeAttributeNode) + */ + removeAttributeNode(attr: Attr): Attr; + /** + * The **`Element.requestFullscreen()`** method issues an asynchronous request to make the element be displayed in fullscreen mode. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/requestFullscreen) + */ + requestFullscreen(options?: FullscreenOptions): Promise; + /** + * The **`requestPointerLock()`** method of the Element interface lets you asynchronously ask for the pointer to be locked on the given element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/requestPointerLock) + */ + requestPointerLock(options?: PointerLockOptions): Promise; + /** + * The **`scroll()`** method of the Element interface scrolls the element to a particular set of coordinates inside a given element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scroll) + */ + scroll(options?: ScrollToOptions): void; + scroll(x: number, y: number): void; + /** + * The **`scrollBy()`** method of the Element interface scrolls an element by the given amount. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollBy) + */ + scrollBy(options?: ScrollToOptions): void; + scrollBy(x: number, y: number): void; + /** + * The Element interface's **`scrollIntoView()`** method scrolls the element's ancestor containers such that the element on which `scrollIntoView()` is called is visible to the user. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollIntoView) + */ + scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void; + /** + * The **`scrollTo()`** method of the Element interface scrolls to a particular set of coordinates inside a given element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollTo) + */ + scrollTo(options?: ScrollToOptions): void; + scrollTo(x: number, y: number): void; + /** + * The **`setAttribute()`** method of the Element interface sets the value of an attribute on the specified element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setAttribute) + */ + setAttribute(qualifiedName: string, value: string): void; + /** + * `setAttributeNS` adds a new attribute or changes the value of an attribute with the given namespace and name. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setAttributeNS) + */ + setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void; + /** + * The **`setAttributeNode()`** method of the Element interface adds a new Attr node to the specified element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setAttributeNode) + */ + setAttributeNode(attr: Attr): Attr | null; + /** + * The **`setAttributeNodeNS()`** method of the Element interface adds a new namespaced Attr node to an element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setAttributeNodeNS) + */ + setAttributeNodeNS(attr: Attr): Attr | null; + /** + * The **`setHTMLUnsafe()`** method of the Element interface is used to parse a string of HTML into a DocumentFragment, optionally filtering out unwanted elements and attributes, and those that don't belong in the context, and then using it to replace the element's subtree in the DOM. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setHTMLUnsafe) + */ + setHTMLUnsafe(html: string): void; + /** + * The **`setPointerCapture()`** method of the _capture target_ of future pointer events. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setPointerCapture) + */ + setPointerCapture(pointerId: number): void; + /** + * The **`toggleAttribute()`** method of the present and adding it if it is not present) on the given element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/toggleAttribute) + */ + toggleAttribute(qualifiedName: string, force?: boolean): boolean; + /** + * @deprecated This is a legacy alias of `matches`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/matches) + */ + webkitMatchesSelector(selectors: string): boolean; + /** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent) */ + get textContent(): string; + set textContent(value: string | null); + addEventListener(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var Element: { + prototype: Element; + new(): Element; +}; + +interface ElementCSSInlineStyle { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/attributeStyleMap) */ + readonly attributeStyleMap: StylePropertyMap; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/style) */ + get style(): CSSStyleDeclaration; + set style(cssText: string); +} + +interface ElementContentEditable { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/contentEditable) */ + contentEditable: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/enterKeyHint) */ + enterKeyHint: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/inputMode) */ + inputMode: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/isContentEditable) */ + readonly isContentEditable: boolean; +} + +/** + * The **`ElementInternals`** interface of the Document Object Model gives web developers a way to allow custom elements to fully participate in HTML forms. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals) + */ +interface ElementInternals extends ARIAMixin { + /** + * The **`form`** read-only property of the ElementInternals interface returns the HTMLFormElement associated with this element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/form) + */ + readonly form: HTMLFormElement | null; + /** + * The **`labels`** read-only property of the ElementInternals interface returns the labels associated with the element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/labels) + */ + readonly labels: NodeList; + /** + * The **`shadowRoot`** read-only property of the ElementInternals interface returns the ShadowRoot for this element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/shadowRoot) + */ + readonly shadowRoot: ShadowRoot | null; + /** + * The **`states`** read-only property of the ElementInternals interface returns a CustomStateSet representing the possible states of the custom element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/states) + */ + readonly states: CustomStateSet; + /** + * The **`validationMessage`** read-only property of the ElementInternals interface returns the validation message for the element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/validationMessage) + */ + readonly validationMessage: string; + /** + * The **`validity`** read-only property of the ElementInternals interface returns a ValidityState object which represents the different validity states the element can be in, with respect to constraint validation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/validity) + */ + readonly validity: ValidityState; + /** + * The **`willValidate`** read-only property of the ElementInternals interface returns `true` if the element is a submittable element that is a candidate for constraint validation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/willValidate) + */ + readonly willValidate: boolean; + /** + * The **`checkValidity()`** method of the ElementInternals interface checks if the element meets any constraint validation rules applied to it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/checkValidity) + */ + checkValidity(): boolean; + /** + * The **`reportValidity()`** method of the ElementInternals interface checks if the element meets any constraint validation rules applied to it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/reportValidity) + */ + reportValidity(): boolean; + /** + * The **`setFormValue()`** method of the ElementInternals interface sets the element's submission value and state, communicating these to the user agent. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/setFormValue) + */ + setFormValue(value: File | string | FormData | null, state?: File | string | FormData | null): void; + /** + * The **`setValidity()`** method of the ElementInternals interface sets the validity of the element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/setValidity) + */ + setValidity(flags?: ValidityStateFlags, message?: string, anchor?: HTMLElement): void; +} + +declare var ElementInternals: { + prototype: ElementInternals; + new(): ElementInternals; +}; + +/** + * The **`EncodedAudioChunk`** interface of the WebCodecs API represents a chunk of encoded audio data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EncodedAudioChunk) + */ +interface EncodedAudioChunk { + /** + * The **`byteLength`** read-only property of the EncodedAudioChunk interface returns the length in bytes of the encoded audio data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EncodedAudioChunk/byteLength) + */ + readonly byteLength: number; + /** + * The **`duration`** read-only property of the EncodedAudioChunk interface returns an integer indicating the duration of the audio in microseconds. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EncodedAudioChunk/duration) + */ + readonly duration: number | null; + /** + * The **`timestamp`** read-only property of the EncodedAudioChunk interface returns an integer indicating the timestamp of the audio in microseconds. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EncodedAudioChunk/timestamp) + */ + readonly timestamp: number; + /** + * The **`type`** read-only property of the EncodedAudioChunk interface returns a value indicating whether the audio chunk is a key chunk, which does not relying on other frames for decoding. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EncodedAudioChunk/type) + */ + readonly type: EncodedAudioChunkType; + /** + * The **`copyTo()`** method of the EncodedAudioChunk interface copies the encoded chunk of audio data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EncodedAudioChunk/copyTo) + */ + copyTo(destination: AllowSharedBufferSource): void; +} + +declare var EncodedAudioChunk: { + prototype: EncodedAudioChunk; + new(init: EncodedAudioChunkInit): EncodedAudioChunk; +}; + +/** + * The **`EncodedVideoChunk`** interface of the WebCodecs API represents a chunk of encoded video data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EncodedVideoChunk) + */ +interface EncodedVideoChunk { + /** + * The **`byteLength`** read-only property of the EncodedVideoChunk interface returns the length in bytes of the encoded video data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EncodedVideoChunk/byteLength) + */ + readonly byteLength: number; + /** + * The **`duration`** read-only property of the EncodedVideoChunk interface returns an integer indicating the duration of the video in microseconds. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EncodedVideoChunk/duration) + */ + readonly duration: number | null; + /** + * The **`timestamp`** read-only property of the EncodedVideoChunk interface returns an integer indicating the timestamp of the video in microseconds. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EncodedVideoChunk/timestamp) + */ + readonly timestamp: number; + /** + * The **`type`** read-only property of the EncodedVideoChunk interface returns a value indicating whether the video chunk is a key chunk, which does not rely on other frames for decoding. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EncodedVideoChunk/type) + */ + readonly type: EncodedVideoChunkType; + /** + * The **`copyTo()`** method of the EncodedVideoChunk interface copies the encoded chunk of video data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EncodedVideoChunk/copyTo) + */ + copyTo(destination: AllowSharedBufferSource): void; +} + +declare var EncodedVideoChunk: { + prototype: EncodedVideoChunk; + new(init: EncodedVideoChunkInit): EncodedVideoChunk; +}; + +/** + * The **`ErrorEvent`** interface represents events providing information related to errors in scripts or in files. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent) + */ +interface ErrorEvent extends Event { + /** + * The **`colno`** read-only property of the ErrorEvent interface returns an integer containing the column number of the script file on which the error occurred. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) + */ + readonly colno: number; + /** + * The **`error`** read-only property of the ErrorEvent interface returns a JavaScript value, such as an Error or DOMException, representing the error associated with this event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) + */ + readonly error: any; + /** + * The **`filename`** read-only property of the ErrorEvent interface returns a string containing the name of the script file in which the error occurred. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) + */ + readonly filename: string; + /** + * The **`lineno`** read-only property of the ErrorEvent interface returns an integer containing the line number of the script file on which the error occurred. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) + */ + readonly lineno: number; + /** + * The **`message`** read-only property of the ErrorEvent interface returns a string containing a human-readable error message describing the problem. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) + */ + readonly message: string; +} + +declare var ErrorEvent: { + prototype: ErrorEvent; + new(type: string, eventInitDict?: ErrorEventInit): ErrorEvent; +}; + +/** + * The **`Event`** interface represents an event which takes place on an `EventTarget`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event) + */ +interface Event { + /** + * The **`bubbles`** read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles) + */ + readonly bubbles: boolean; + /** + * The **`cancelBubble`** property of the Event interface is deprecated. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble) + */ + cancelBubble: boolean; + /** + * The **`cancelable`** read-only property of the Event interface indicates whether the event can be canceled, and therefore prevented as if the event never happened. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable) + */ + readonly cancelable: boolean; + /** + * The read-only **`composed`** property of the or not the event will propagate across the shadow DOM boundary into the standard DOM. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed) + */ + readonly composed: boolean; + /** + * The **`currentTarget`** read-only property of the Event interface identifies the element to which the event handler has been attached. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget) + */ + readonly currentTarget: EventTarget | null; + /** + * The **`defaultPrevented`** read-only property of the Event interface returns a boolean value indicating whether or not the call to Event.preventDefault() canceled the event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented) + */ + readonly defaultPrevented: boolean; + /** + * The **`eventPhase`** read-only property of the being evaluated. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase) + */ + readonly eventPhase: number; + /** + * The **`isTrusted`** read-only property of the when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and `false` when the event was dispatched via The only exception is the `click` event, which initializes the `isTrusted` property to `false` in user agents. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted) + */ + readonly isTrusted: boolean; + /** + * The Event property **`returnValue`** indicates whether the default action for this event has been prevented or not. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue) + */ + returnValue: boolean; + /** + * The deprecated **`Event.srcElement`** is an alias for the Event.target property. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement) + */ + readonly srcElement: EventTarget | null; + /** + * The read-only **`target`** property of the dispatched. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target) + */ + readonly target: EventTarget | null; + /** + * The **`timeStamp`** read-only property of the Event interface returns the time (in milliseconds) at which the event was created. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp) + */ + readonly timeStamp: DOMHighResTimeStamp; + /** + * The **`type`** read-only property of the Event interface returns a string containing the event's type. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type) + */ + readonly type: string; + /** + * The **`composedPath()`** method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath) + */ + composedPath(): EventTarget[]; + /** + * The **`Event.initEvent()`** method is used to initialize the value of an event created using Document.createEvent(). + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/initEvent) + */ + initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void; + /** + * The **`preventDefault()`** method of the Event interface tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault) + */ + preventDefault(): void; + /** + * The **`stopImmediatePropagation()`** method of the If several listeners are attached to the same element for the same event type, they are called in the order in which they were added. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation) + */ + stopImmediatePropagation(): void; + /** + * The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation) + */ + stopPropagation(): void; + readonly NONE: 0; + readonly CAPTURING_PHASE: 1; + readonly AT_TARGET: 2; + readonly BUBBLING_PHASE: 3; +} + +declare var Event: { + prototype: Event; + new(type: string, eventInitDict?: EventInit): Event; + readonly NONE: 0; + readonly CAPTURING_PHASE: 1; + readonly AT_TARGET: 2; + readonly BUBBLING_PHASE: 3; +}; + +/** + * The **`EventCounts`** interface of the Performance API provides the number of events that have been dispatched for each event type. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventCounts) + */ +interface EventCounts { + forEach(callbackfn: (value: number, key: string, parent: EventCounts) => void, thisArg?: any): void; +} + +declare var EventCounts: { + prototype: EventCounts; + new(): EventCounts; +}; + +interface EventListener { + (evt: Event): void; +} + +interface EventListenerObject { + handleEvent(object: Event): void; +} + +interface EventSourceEventMap { + "error": Event; + "message": MessageEvent; + "open": Event; +} + +/** + * The **`EventSource`** interface is web content's interface to server-sent events. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) + */ +interface EventSource extends EventTarget { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */ + onerror: ((this: EventSource, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */ + onmessage: ((this: EventSource, ev: MessageEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */ + onopen: ((this: EventSource, ev: Event) => any) | null; + /** + * The **`readyState`** read-only property of the connection. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState) + */ + readonly readyState: number; + /** + * The **`url`** read-only property of the URL of the source. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url) + */ + readonly url: string; + /** + * The **`withCredentials`** read-only property of the the `EventSource` object was instantiated with CORS credentials set. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials) + */ + readonly withCredentials: boolean; + /** + * The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the ```js-nolint close() ``` None. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close) + */ + close(): void; + readonly CONNECTING: 0; + readonly OPEN: 1; + readonly CLOSED: 2; + addEventListener(type: K, listener: (this: EventSource, ev: EventSourceEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: (this: EventSource, event: MessageEvent) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: EventSource, ev: EventSourceEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: (this: EventSource, event: MessageEvent) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var EventSource: { + prototype: EventSource; + new(url: string | URL, eventSourceInitDict?: EventSourceInit): EventSource; + readonly CONNECTING: 0; + readonly OPEN: 1; + readonly CLOSED: 2; +}; + +/** + * The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget) + */ +interface EventTarget { + /** + * The **`addEventListener()`** method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener) + */ + addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void; + /** + * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent) + */ + dispatchEvent(event: Event): boolean; + /** + * The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener) + */ + removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void; +} + +declare var EventTarget: { + prototype: EventTarget; + new(): EventTarget; +}; + +/** @deprecated */ +interface External { + /** @deprecated */ + AddSearchProvider(): void; + /** @deprecated */ + IsSearchProviderInstalled(): void; +} + +/** @deprecated */ +declare var External: { + prototype: External; + new(): External; +}; + +/** + * The **`File`** interface provides information about files and allows JavaScript in a web page to access their content. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File) + */ +interface File extends Blob { + /** + * The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) + */ + readonly lastModified: number; + /** + * The **`name`** read-only property of the File interface returns the name of the file represented by a File object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) + */ + readonly name: string; + /** + * The **`webkitRelativePath`** read-only property of the File interface contains a string which specifies the file's path relative to the directory selected by the user in an input element with its `webkitdirectory` attribute set. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/webkitRelativePath) + */ + readonly webkitRelativePath: string; +} + +declare var File: { + prototype: File; + new(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File; +}; + +/** + * The **`FileList`** interface represents an object of this type returned by the `files` property of the HTML input element; this lets you access the list of files selected with the `` element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileList) + */ +interface FileList { + /** + * The **`length`** read-only property of the FileList interface returns the number of files in the `FileList`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileList/length) + */ + readonly length: number; + /** + * The **`item()`** method of the FileList interface returns a File object representing the file at the specified index in the file list. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileList/item) + */ + item(index: number): File | null; + [index: number]: File; +} + +declare var FileList: { + prototype: FileList; + new(): FileList; +}; + +interface FileReaderEventMap { + "abort": ProgressEvent; + "error": ProgressEvent; + "load": ProgressEvent; + "loadend": ProgressEvent; + "loadstart": ProgressEvent; + "progress": ProgressEvent; +} + +/** + * The **`FileReader`** interface lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user's computer, using File or Blob objects to specify the file or data to read. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader) + */ +interface FileReader extends EventTarget { + /** + * The **`error`** read-only property of the FileReader interface returns the error that occurred while reading the file. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/error) + */ + readonly error: DOMException | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/abort_event) */ + onabort: ((this: FileReader, ev: ProgressEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/error_event) */ + onerror: ((this: FileReader, ev: ProgressEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/load_event) */ + onload: ((this: FileReader, ev: ProgressEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/loadend_event) */ + onloadend: ((this: FileReader, ev: ProgressEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/loadstart_event) */ + onloadstart: ((this: FileReader, ev: ProgressEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/progress_event) */ + onprogress: ((this: FileReader, ev: ProgressEvent) => any) | null; + /** + * The **`readyState`** read-only property of the FileReader interface provides the current state of the reading operation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/readyState) + */ + readonly readyState: typeof FileReader.EMPTY | typeof FileReader.LOADING | typeof FileReader.DONE; + /** + * The **`result`** read-only property of the FileReader interface returns the file's contents. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/result) + */ + readonly result: string | ArrayBuffer | null; + /** + * The **`abort()`** method of the FileReader interface aborts the read operation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/abort) + */ + abort(): void; + /** + * The **`readAsArrayBuffer()`** method of the FileReader interface is used to start reading the contents of a specified Blob or File. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/readAsArrayBuffer) + */ + readAsArrayBuffer(blob: Blob): void; + /** + * The **`readAsBinaryString()`** method of the FileReader interface is used to start reading the contents of the specified Blob or File. + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/readAsBinaryString) + */ + readAsBinaryString(blob: Blob): void; + /** + * The **`readAsDataURL()`** method of the FileReader interface is used to read the contents of the specified file's data as a base64 encoded string. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/readAsDataURL) + */ + readAsDataURL(blob: Blob): void; + /** + * The **`readAsText()`** method of the FileReader interface is used to read the contents of the specified Blob or File. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/readAsText) + */ + readAsText(blob: Blob, encoding?: string): void; + readonly EMPTY: 0; + readonly LOADING: 1; + readonly DONE: 2; + addEventListener(type: K, listener: (this: FileReader, ev: FileReaderEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: FileReader, ev: FileReaderEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var FileReader: { + prototype: FileReader; + new(): FileReader; + readonly EMPTY: 0; + readonly LOADING: 1; + readonly DONE: 2; +}; + +/** + * The File and Directory Entries API interface **`FileSystem`** is used to represent a file system. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystem) + */ +interface FileSystem { + /** + * The read-only **`name`** property of the string is unique among all file systems currently exposed by the File and Directory Entries API. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystem/name) + */ + readonly name: string; + /** + * The read-only **`root`** property of the object representing the root directory of the file system, for use with the File and Directory Entries API. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystem/root) + */ + readonly root: FileSystemDirectoryEntry; +} + +declare var FileSystem: { + prototype: FileSystem; + new(): FileSystem; +}; + +/** + * The **`FileSystemDirectoryEntry`** interface of the File and Directory Entries API represents a directory in a file system. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryEntry) + */ +interface FileSystemDirectoryEntry extends FileSystemEntry { + /** + * The FileSystemDirectoryEntry interface's method **`createReader()`** returns a the directory. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryEntry/createReader) + */ + createReader(): FileSystemDirectoryReader; + /** + * The FileSystemDirectoryEntry interface's method **`getDirectory()`** returns a somewhere within the directory subtree rooted at the directory on which it's called. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryEntry/getDirectory) + */ + getDirectory(path?: string | null, options?: FileSystemFlags, successCallback?: FileSystemEntryCallback, errorCallback?: ErrorCallback): void; + /** + * The FileSystemDirectoryEntry interface's method **`getFile()`** returns a within the directory subtree rooted at the directory on which it's called. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryEntry/getFile) + */ + getFile(path?: string | null, options?: FileSystemFlags, successCallback?: FileSystemEntryCallback, errorCallback?: ErrorCallback): void; +} + +declare var FileSystemDirectoryEntry: { + prototype: FileSystemDirectoryEntry; + new(): FileSystemDirectoryEntry; +}; + +/** + * The **`FileSystemDirectoryHandle`** interface of the File System API provides a handle to a file system directory. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle) + */ +interface FileSystemDirectoryHandle extends FileSystemHandle { + readonly kind: "directory"; + /** + * The **`getDirectoryHandle()`** method of the within the directory handle on which the method is called. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/getDirectoryHandle) + */ + getDirectoryHandle(name: string, options?: FileSystemGetDirectoryOptions): Promise; + /** + * The **`getFileHandle()`** method of the directory the method is called. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/getFileHandle) + */ + getFileHandle(name: string, options?: FileSystemGetFileOptions): Promise; + /** + * The **`removeEntry()`** method of the directory handle contains a file or directory called the name specified. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/removeEntry) + */ + removeEntry(name: string, options?: FileSystemRemoveOptions): Promise; + /** + * The **`resolve()`** method of the directory names from the parent handle to the specified child entry, with the name of the child entry as the last array item. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/resolve) + */ + resolve(possibleDescendant: FileSystemHandle): Promise; +} + +declare var FileSystemDirectoryHandle: { + prototype: FileSystemDirectoryHandle; + new(): FileSystemDirectoryHandle; +}; + +/** + * The `FileSystemDirectoryReader` interface of the File and Directory Entries API lets you access the FileSystemFileEntry-based objects (generally FileSystemFileEntry or FileSystemDirectoryEntry) representing each entry in a directory. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryReader) + */ +interface FileSystemDirectoryReader { + /** + * The FileSystemDirectoryReader interface's **`readEntries()`** method retrieves the directory entries within the directory being read and delivers them in an array to a provided callback function. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryReader/readEntries) + */ + readEntries(successCallback: FileSystemEntriesCallback, errorCallback?: ErrorCallback): void; +} + +declare var FileSystemDirectoryReader: { + prototype: FileSystemDirectoryReader; + new(): FileSystemDirectoryReader; +}; + +/** + * The **`FileSystemEntry`** interface of the File and Directory Entries API represents a single entry in a file system. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemEntry) + */ +interface FileSystemEntry { + /** + * The read-only **`filesystem`** property of the FileSystemEntry interface contains a resides. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemEntry/filesystem) + */ + readonly filesystem: FileSystem; + /** + * The read-only **`fullPath`** property of the FileSystemEntry interface returns a string specifying the full, absolute path from the file system's root to the file represented by the entry. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemEntry/fullPath) + */ + readonly fullPath: string; + /** + * The read-only **`isDirectory`** property of the FileSystemEntry interface is `true` if the entry represents a directory (meaning it's a FileSystemDirectoryEntry) and `false` if it's not. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemEntry/isDirectory) + */ + readonly isDirectory: boolean; + /** + * The read-only **`isFile`** property of the FileSystemEntry interface is `true` if the entry represents a file (meaning it's a FileSystemFileEntry) and `false` if it's not. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemEntry/isFile) + */ + readonly isFile: boolean; + /** + * The read-only **`name`** property of the FileSystemEntry interface returns a string specifying the entry's name; this is the entry within its parent directory (the last component of the path as indicated by the FileSystemEntry.fullPath property). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemEntry/name) + */ + readonly name: string; + /** + * The FileSystemEntry interface's method **`getParent()`** obtains a ```js-nolint getParent(successCallback, errorCallback) getParent(successCallback) ``` - `successCallback` - : A function which is called when the parent directory entry has been retrieved. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemEntry/getParent) + */ + getParent(successCallback?: FileSystemEntryCallback, errorCallback?: ErrorCallback): void; +} + +declare var FileSystemEntry: { + prototype: FileSystemEntry; + new(): FileSystemEntry; +}; + +/** + * The **`FileSystemFileEntry`** interface of the File and Directory Entries API represents a file in a file system. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemFileEntry) + */ +interface FileSystemFileEntry extends FileSystemEntry { + /** + * The FileSystemFileEntry interface's method **`file()`** returns a the directory entry. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemFileEntry/file) + */ + file(successCallback: FileCallback, errorCallback?: ErrorCallback): void; +} + +declare var FileSystemFileEntry: { + prototype: FileSystemFileEntry; + new(): FileSystemFileEntry; +}; + +/** + * The **`FileSystemFileHandle`** interface of the File System API represents a handle to a file system entry. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemFileHandle) + */ +interface FileSystemFileHandle extends FileSystemHandle { + readonly kind: "file"; + /** + * The **`createWritable()`** method of the FileSystemFileHandle interface creates a FileSystemWritableFileStream that can be used to write to a file. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemFileHandle/createWritable) + */ + createWritable(options?: FileSystemCreateWritableOptions): Promise; + /** + * The **`getFile()`** method of the If the file on disk changes or is removed after this method is called, the returned ```js-nolint getFile() ``` None. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemFileHandle/getFile) + */ + getFile(): Promise; +} + +declare var FileSystemFileHandle: { + prototype: FileSystemFileHandle; + new(): FileSystemFileHandle; +}; + +/** + * The **`FileSystemHandle`** interface of the File System API is an object which represents a file or directory entry. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemHandle) + */ +interface FileSystemHandle { + /** + * The **`kind`** read-only property of the `'file'` if the associated entry is a file or `'directory'`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemHandle/kind) + */ + readonly kind: FileSystemHandleKind; + /** + * The **`name`** read-only property of the handle. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemHandle/name) + */ + readonly name: string; + /** + * The **`isSameEntry()`** method of the ```js-nolint isSameEntry(fileSystemHandle) ``` - FileSystemHandle - : The `FileSystemHandle` to match against the handle on which the method is invoked. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemHandle/isSameEntry) + */ + isSameEntry(other: FileSystemHandle): Promise; +} + +declare var FileSystemHandle: { + prototype: FileSystemHandle; + new(): FileSystemHandle; +}; + +/** + * The **`FileSystemWritableFileStream`** interface of the File System API is a WritableStream object with additional convenience methods, which operates on a single file on disk. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemWritableFileStream) + */ +interface FileSystemWritableFileStream extends WritableStream { + /** + * The **`seek()`** method of the FileSystemWritableFileStream interface updates the current file cursor offset to the position (in bytes) specified when calling the method. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemWritableFileStream/seek) + */ + seek(position: number): Promise; + /** + * The **`truncate()`** method of the FileSystemWritableFileStream interface resizes the file associated with the stream to the specified size in bytes. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemWritableFileStream/truncate) + */ + truncate(size: number): Promise; + /** + * The **`write()`** method of the FileSystemWritableFileStream interface writes content into the file the method is called on, at the current file cursor offset. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemWritableFileStream/write) + */ + write(data: FileSystemWriteChunkType): Promise; +} + +declare var FileSystemWritableFileStream: { + prototype: FileSystemWritableFileStream; + new(): FileSystemWritableFileStream; +}; + +/** + * The **`FocusEvent`** interface represents focus-related events, including Element/focus_event, Element/blur_event, Element/focusin_event, and Element/focusout_event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FocusEvent) + */ +interface FocusEvent extends UIEvent { + /** + * The **`relatedTarget`** read-only property of the FocusEvent interface is the secondary target, depending on the type of event:
Event name target relatedTarget
Element/blur_event The EventTarget losing focus The EventTarget receiving focus (if any).
Element/focus_event The EventTarget receiving focus The EventTarget losing focus (if any)
Element/focusin_event The EventTarget receiving focus The EventTarget losing focus (if any)
Element/focusout_event The EventTarget losing focus The EventTarget receiving focus (if any)
Note that many elements can't have focus, which is a common reason for `relatedTarget` to be `null`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FocusEvent/relatedTarget) + */ + readonly relatedTarget: EventTarget | null; +} + +declare var FocusEvent: { + prototype: FocusEvent; + new(type: string, eventInitDict?: FocusEventInit): FocusEvent; +}; + +/** + * The **`FontFace`** interface of the CSS Font Loading API represents a single usable font face. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace) + */ +interface FontFace { + /** + * The **`ascentOverride`** property of the FontFace interface returns and sets the ascent metric for the font, the height above the baseline that CSS uses to lay out line boxes in an inline formatting context. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/ascentOverride) + */ + ascentOverride: string; + /** + * The **`descentOverride`** property of the FontFace interface returns and sets the value of the @font-face/descent-override descriptor. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/descentOverride) + */ + descentOverride: string; + /** + * The **`display`** property of the FontFace interface determines how a font face is displayed based on whether and when it is downloaded and ready to use. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/display) + */ + display: FontDisplay; + /** + * The **`FontFace.family`** property allows the author to get or set the font family of a FontFace object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/family) + */ + family: string; + /** + * The **`featureSettings`** property of the FontFace interface retrieves or sets infrequently used font features that are not available from a font's variant properties. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/featureSettings) + */ + featureSettings: string; + /** + * The **`lineGapOverride`** property of the FontFace interface returns and sets the value of the @font-face/line-gap-override descriptor. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/lineGapOverride) + */ + lineGapOverride: string; + /** + * The **`loaded`** read-only property of the FontFace interface returns a Promise that resolves with the current `FontFace` object when the font specified in the object's constructor is done loading or rejects with a `SyntaxError`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/loaded) + */ + readonly loaded: Promise; + /** + * The **`status`** read-only property of the FontFace interface returns an enumerated value indicating the status of the font, one of `'unloaded'`, `'loading'`, `'loaded'`, or `'error'`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/status) + */ + readonly status: FontFaceLoadStatus; + /** + * The **`stretch`** property of the FontFace interface retrieves or sets how the font stretches. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/stretch) + */ + stretch: string; + /** + * The **`style`** property of the FontFace interface retrieves or sets the font's style. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/style) + */ + style: string; + /** + * The **`unicodeRange`** property of the FontFace interface retrieves or sets the range of unicode code points encompassing the font. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/unicodeRange) + */ + unicodeRange: string; + /** + * The **`weight`** property of the FontFace interface retrieves or sets the weight of the font. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/weight) + */ + weight: string; + /** + * The **`load()`** method of the FontFace interface requests and loads a font whose `source` was specified as a URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/load) + */ + load(): Promise; +} + +declare var FontFace: { + prototype: FontFace; + new(family: string, source: string | BufferSource, descriptors?: FontFaceDescriptors): FontFace; +}; + +interface FontFaceSetEventMap { + "loading": FontFaceSetLoadEvent; + "loadingdone": FontFaceSetLoadEvent; + "loadingerror": FontFaceSetLoadEvent; +} + +/** + * The **`FontFaceSet`** interface of the CSS Font Loading API manages the loading of font-faces and querying of their download status. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet) + */ +interface FontFaceSet extends EventTarget { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/loading_event) */ + onloading: ((this: FontFaceSet, ev: FontFaceSetLoadEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/loadingdone_event) */ + onloadingdone: ((this: FontFaceSet, ev: FontFaceSetLoadEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/loadingerror_event) */ + onloadingerror: ((this: FontFaceSet, ev: FontFaceSetLoadEvent) => any) | null; + /** + * The `ready` read-only property of the FontFaceSet interface returns a Promise that resolves to the given FontFaceSet. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/ready) + */ + readonly ready: Promise; + /** + * The **`status`** read-only property of the FontFaceSet interface returns the loading state of the fonts in the set. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/status) + */ + readonly status: FontFaceSetLoadStatus; + /** + * The `check()` method of the FontFaceSet returns `true` if you can render some text using the given font specification without attempting to use any fonts in this `FontFaceSet` that are not yet fully loaded. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/check) + */ + check(font: string, text?: string): boolean; + /** + * The `load()` method of the FontFaceSet forces all the fonts given in parameters to be loaded. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/load) + */ + load(font: string, text?: string): Promise; + forEach(callbackfn: (value: FontFace, key: FontFace, parent: FontFaceSet) => void, thisArg?: any): void; + addEventListener(type: K, listener: (this: FontFaceSet, ev: FontFaceSetEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: FontFaceSet, ev: FontFaceSetEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var FontFaceSet: { + prototype: FontFaceSet; + new(): FontFaceSet; +}; + +/** + * The **`FontFaceSetLoadEvent`** interface of the CSS Font Loading API represents events fired at a FontFaceSet after it starts loading font faces. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSetLoadEvent) + */ +interface FontFaceSetLoadEvent extends Event { + /** + * The **`fontfaces`** read-only property of the An array of FontFace instance. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSetLoadEvent/fontfaces) + */ + readonly fontfaces: ReadonlyArray; +} + +declare var FontFaceSetLoadEvent: { + prototype: FontFaceSetLoadEvent; + new(type: string, eventInitDict?: FontFaceSetLoadEventInit): FontFaceSetLoadEvent; +}; + +interface FontFaceSource { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/fonts) */ + readonly fonts: FontFaceSet; +} + +/** + * The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the Window/fetch, XMLHttpRequest.send() or navigator.sendBeacon() methods. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData) + */ +interface FormData { + /** + * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) + */ + append(name: string, value: string | Blob): void; + append(name: string, value: string): void; + append(name: string, blobValue: Blob, filename?: string): void; + /** + * The **`delete()`** method of the FormData interface deletes a key and its value(s) from a `FormData` object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete) + */ + delete(name: string): void; + /** + * The **`get()`** method of the FormData interface returns the first value associated with a given key from within a `FormData` object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get) + */ + get(name: string): FormDataEntryValue | null; + /** + * The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a `FormData` object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll) + */ + getAll(name: string): FormDataEntryValue[]; + /** + * The **`has()`** method of the FormData interface returns whether a `FormData` object contains a certain key. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has) + */ + has(name: string): boolean; + /** + * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) + */ + set(name: string, value: string | Blob): void; + set(name: string, value: string): void; + set(name: string, blobValue: Blob, filename?: string): void; + forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void; +} + +declare var FormData: { + prototype: FormData; + new(form?: HTMLFormElement, submitter?: HTMLElement | null): FormData; +}; + +/** + * The **`FormDataEvent`** interface represents a `formdata` event — such an event is fired on an HTMLFormElement object after the entry list representing the form's data is constructed. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormDataEvent) + */ +interface FormDataEvent extends Event { + /** + * The `formData` read-only property of the FormDataEvent interface contains the FormData object representing the data contained in the form when the event was fired. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormDataEvent/formData) + */ + readonly formData: FormData; +} + +declare var FormDataEvent: { + prototype: FormDataEvent; + new(type: string, eventInitDict: FormDataEventInit): FormDataEvent; +}; + +/** + * The **`FragmentDirective`** interface is an object exposed to allow code to check whether or not a browser supports text fragments. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FragmentDirective) + */ +interface FragmentDirective { +} + +declare var FragmentDirective: { + prototype: FragmentDirective; + new(): FragmentDirective; +}; + +/** + * The **`GPUError`** interface of the WebGPU API is the base interface for errors surfaced by GPUDevice.popErrorScope and the GPUDevice.uncapturederror_event event. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUError) + */ +interface GPUError { + /** + * The **`message`** read-only property of the A string. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUError/message) + */ + readonly message: string; +} + +/** + * The `GainNode` interface represents a change in volume. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GainNode) + */ +interface GainNode extends AudioNode { + /** + * The `gain` property of the GainNode interface is an a-rate AudioParam representing the amount of gain to apply. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GainNode/gain) + */ + readonly gain: AudioParam; +} + +declare var GainNode: { + prototype: GainNode; + new(context: BaseAudioContext, options?: GainOptions): GainNode; +}; + +/** + * The **`Gamepad`** interface of the Gamepad API defines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Gamepad) + */ +interface Gamepad { + /** + * The **`Gamepad.axes`** property of the Gamepad interface returns an array representing the controls with axes present on the device (e.g., analog thumb sticks). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Gamepad/axes) + */ + readonly axes: ReadonlyArray; + /** + * The **`buttons`** property of the Gamepad interface returns an array of GamepadButton objects representing the buttons present on the device. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Gamepad/buttons) + */ + readonly buttons: ReadonlyArray; + /** + * The **`Gamepad.connected`** property of the still connected to the system. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Gamepad/connected) + */ + readonly connected: boolean; + /** + * The **`Gamepad.id`** property of the Gamepad interface returns a string containing some information about the controller. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Gamepad/id) + */ + readonly id: string; + /** + * The **`Gamepad.index`** property of the Gamepad interface returns an integer that is auto-incremented to be unique for each device currently connected to the system. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Gamepad/index) + */ + readonly index: number; + /** + * The **`Gamepad.mapping`** property of the remapped the controls on the device to a known layout. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Gamepad/mapping) + */ + readonly mapping: GamepadMappingType; + /** + * The **`Gamepad.timestamp`** property of the representing the last time the data for this gamepad was updated. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Gamepad/timestamp) + */ + readonly timestamp: DOMHighResTimeStamp; + /** + * The **`vibrationActuator`** read-only property of the Gamepad interface returns a GamepadHapticActuator object, which represents haptic feedback hardware available on the controller. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Gamepad/vibrationActuator) + */ + readonly vibrationActuator: GamepadHapticActuator; +} + +declare var Gamepad: { + prototype: Gamepad; + new(): Gamepad; +}; + +/** + * The **`GamepadButton`** interface defines an individual button of a gamepad or other controller, allowing access to the current state of different types of buttons available on the control device. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadButton) + */ +interface GamepadButton { + /** + * The **`GamepadButton.pressed`** property of the the button is currently pressed (`true`) or unpressed (`false`). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadButton/pressed) + */ + readonly pressed: boolean; + /** + * The **`touched`** property of the a button capable of detecting touch is currently touched (`true`) or not touched (`false`). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadButton/touched) + */ + readonly touched: boolean; + /** + * The **`GamepadButton.value`** property of the current state of analog buttons on many modern gamepads, such as the triggers. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadButton/value) + */ + readonly value: number; +} + +declare var GamepadButton: { + prototype: GamepadButton; + new(): GamepadButton; +}; + +/** + * The GamepadEvent interface of the Gamepad API contains references to gamepads connected to the system, which is what the gamepad events Window.gamepadconnected_event and Window.gamepaddisconnected_event are fired in response to. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadEvent) + */ +interface GamepadEvent extends Event { + /** + * The **`GamepadEvent.gamepad`** property of the **GamepadEvent interface** returns a Gamepad object, providing access to the associated gamepad data for fired A Gamepad object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadEvent/gamepad) + */ + readonly gamepad: Gamepad; +} + +declare var GamepadEvent: { + prototype: GamepadEvent; + new(type: string, eventInitDict: GamepadEventInit): GamepadEvent; +}; + +/** + * The **`GamepadHapticActuator`** interface of the Gamepad API represents hardware in the controller designed to provide haptic feedback to the user (if available), most commonly vibration hardware. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadHapticActuator) + */ +interface GamepadHapticActuator { + /** + * The **`playEffect()`** method of the GamepadHapticActuator interface causes the hardware to play a specific vibration effect. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadHapticActuator/playEffect) + */ + playEffect(type: GamepadHapticEffectType, params?: GamepadEffectParameters): Promise; + /** + * The **`reset()`** method of the GamepadHapticActuator interface stops the hardware from playing an active vibration effect. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadHapticActuator/reset) + */ + reset(): Promise; +} + +declare var GamepadHapticActuator: { + prototype: GamepadHapticActuator; + new(): GamepadHapticActuator; +}; + +interface GenericTransformStream { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream/readable) */ + readonly readable: ReadableStream; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream/writable) */ + readonly writable: WritableStream; +} + +/** + * The **`Geolocation`** interface represents an object able to obtain the position of the device programmatically. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Geolocation) + */ +interface Geolocation { + /** + * The **`clearWatch()`** method of the Geolocation interface is used to unregister location/error monitoring handlers previously installed using Geolocation.watchPosition(). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Geolocation/clearWatch) + */ + clearWatch(watchId: number): void; + /** + * The **`getCurrentPosition()`** method of the Geolocation interface is used to get the current position of the device. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Geolocation/getCurrentPosition) + */ + getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback | null, options?: PositionOptions): void; + /** + * The **`watchPosition()`** method of the Geolocation interface is used to register a handler function that will be called automatically each time the position of the device changes. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Geolocation/watchPosition) + */ + watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback | null, options?: PositionOptions): number; +} + +declare var Geolocation: { + prototype: Geolocation; + new(): Geolocation; +}; + +/** + * The **`GeolocationCoordinates`** interface represents the position and altitude of the device on Earth, as well as the accuracy with which these properties are calculated. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates) + */ +interface GeolocationCoordinates { + /** + * The **`accuracy`** read-only property of the GeolocationCoordinates interface is a strictly positive `double` representing the accuracy, with a 95% confidence level, of the GeolocationCoordinates.latitude and GeolocationCoordinates.longitude properties expressed in meters. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/accuracy) + */ + readonly accuracy: number; + /** + * The **`altitude`** read-only property of the GeolocationCoordinates interface is a `double` representing the altitude of the position in meters above the WGS84 ellipsoid (which defines the nominal sea level surface). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/altitude) + */ + readonly altitude: number | null; + /** + * The **`altitudeAccuracy`** read-only property of the GeolocationCoordinates interface is a strictly positive `double` representing the accuracy, with a 95% confidence level, of the `altitude` expressed in meters. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/altitudeAccuracy) + */ + readonly altitudeAccuracy: number | null; + /** + * The **`heading`** read-only property of the GeolocationCoordinates interface is a `double` representing the direction in which the device is traveling. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/heading) + */ + readonly heading: number | null; + /** + * The **`latitude`** read-only property of the GeolocationCoordinates interface is a `double` representing the latitude of the position in decimal degrees. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/latitude) + */ + readonly latitude: number; + /** + * The **`longitude`** read-only property of the GeolocationCoordinates interface is a number which represents the longitude of a geographical position, specified in decimal degrees. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/longitude) + */ + readonly longitude: number; + /** + * The **`speed`** read-only property of the GeolocationCoordinates interface is a `double` representing the velocity of the device in meters per second. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/speed) + */ + readonly speed: number | null; + /** + * The **`toJSON()`** method of the GeolocationCoordinates interface is a Serialization; it returns a JSON representation of the GeolocationCoordinates object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/toJSON) + */ + toJSON(): any; +} + +declare var GeolocationCoordinates: { + prototype: GeolocationCoordinates; + new(): GeolocationCoordinates; +}; + +/** + * The **`GeolocationPosition`** interface represents the position of the concerned device at a given time. + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationPosition) + */ +interface GeolocationPosition { + /** + * The **`coords`** read-only property of the GeolocationPosition interface returns a GeolocationCoordinates object representing a geographic position. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationPosition/coords) + */ + readonly coords: GeolocationCoordinates; + /** + * The **`timestamp`** read-only property of the GeolocationPosition interface represents the date and time that the position was acquired by the device. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationPosition/timestamp) + */ + readonly timestamp: EpochTimeStamp; + /** + * The **`toJSON()`** method of the GeolocationPosition interface is a Serialization; it returns a JSON representation of the GeolocationPosition object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationPosition/toJSON) + */ + toJSON(): any; +} + +declare var GeolocationPosition: { + prototype: GeolocationPosition; + new(): GeolocationPosition; +}; + +/** + * The **`GeolocationPositionError`** interface represents the reason of an error occurring when using the geolocating device. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationPositionError) + */ +interface GeolocationPositionError { + /** + * The **`code`** read-only property of the GeolocationPositionError interface is an `unsigned short` representing the error code. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationPositionError/code) + */ + readonly code: number; + /** + * The **`message`** read-only property of the GeolocationPositionError interface returns a human-readable string describing the details of the error. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationPositionError/message) + */ + readonly message: string; + readonly PERMISSION_DENIED: 1; + readonly POSITION_UNAVAILABLE: 2; + readonly TIMEOUT: 3; +} + +declare var GeolocationPositionError: { + prototype: GeolocationPositionError; + new(): GeolocationPositionError; + readonly PERMISSION_DENIED: 1; + readonly POSITION_UNAVAILABLE: 2; + readonly TIMEOUT: 3; +}; + +interface GlobalEventHandlersEventMap { + "abort": UIEvent; + "animationcancel": AnimationEvent; + "animationend": AnimationEvent; + "animationiteration": AnimationEvent; + "animationstart": AnimationEvent; + "auxclick": PointerEvent; + "beforeinput": InputEvent; + "beforematch": Event; + "beforetoggle": ToggleEvent; + "blur": FocusEvent; + "cancel": Event; + "canplay": Event; + "canplaythrough": Event; + "change": Event; + "click": PointerEvent; + "close": Event; + "compositionend": CompositionEvent; + "compositionstart": CompositionEvent; + "compositionupdate": CompositionEvent; + "contextlost": Event; + "contextmenu": PointerEvent; + "contextrestored": Event; + "copy": ClipboardEvent; + "cuechange": Event; + "cut": ClipboardEvent; + "dblclick": MouseEvent; + "drag": DragEvent; + "dragend": DragEvent; + "dragenter": DragEvent; + "dragleave": DragEvent; + "dragover": DragEvent; + "dragstart": DragEvent; + "drop": DragEvent; + "durationchange": Event; + "emptied": Event; + "ended": Event; + "error": ErrorEvent; + "focus": FocusEvent; + "focusin": FocusEvent; + "focusout": FocusEvent; + "formdata": FormDataEvent; + "gotpointercapture": PointerEvent; + "input": Event; + "invalid": Event; + "keydown": KeyboardEvent; + "keypress": KeyboardEvent; + "keyup": KeyboardEvent; + "load": Event; + "loadeddata": Event; + "loadedmetadata": Event; + "loadstart": Event; + "lostpointercapture": PointerEvent; + "mousedown": MouseEvent; + "mouseenter": MouseEvent; + "mouseleave": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; + "paste": ClipboardEvent; + "pause": Event; + "play": Event; + "playing": Event; + "pointercancel": PointerEvent; + "pointerdown": PointerEvent; + "pointerenter": PointerEvent; + "pointerleave": PointerEvent; + "pointermove": PointerEvent; + "pointerout": PointerEvent; + "pointerover": PointerEvent; + "pointerrawupdate": Event; + "pointerup": PointerEvent; + "progress": ProgressEvent; + "ratechange": Event; + "reset": Event; + "resize": UIEvent; + "scroll": Event; + "scrollend": Event; + "securitypolicyviolation": SecurityPolicyViolationEvent; + "seeked": Event; + "seeking": Event; + "select": Event; + "selectionchange": Event; + "selectstart": Event; + "slotchange": Event; + "stalled": Event; + "submit": SubmitEvent; + "suspend": Event; + "timeupdate": Event; + "toggle": ToggleEvent; + "touchcancel": TouchEvent; + "touchend": TouchEvent; + "touchmove": TouchEvent; + "touchstart": TouchEvent; + "transitioncancel": TransitionEvent; + "transitionend": TransitionEvent; + "transitionrun": TransitionEvent; + "transitionstart": TransitionEvent; + "volumechange": Event; + "waiting": Event; + "webkitanimationend": Event; + "webkitanimationiteration": Event; + "webkitanimationstart": Event; + "webkittransitionend": Event; + "wheel": WheelEvent; +} + +interface GlobalEventHandlers { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/abort_event) */ + onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/animationcancel_event) */ + onanimationcancel: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/animationend_event) */ + onanimationend: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/animationiteration_event) */ + onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/animationstart_event) */ + onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/auxclick_event) */ + onauxclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/beforeinput_event) */ + onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/beforematch_event) */ + onbeforematch: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/beforetoggle_event) */ + onbeforetoggle: ((this: GlobalEventHandlers, ev: ToggleEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/blur_event) */ + onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLDialogElement/cancel_event) */ + oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/canplay_event) */ + oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/canplaythrough_event) */ + oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/change_event) */ + onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/click_event) */ + onclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLDialogElement/close_event) */ + onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/contextlost_event) */ + oncontextlost: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/contextmenu_event) */ + oncontextmenu: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/contextrestored_event) */ + oncontextrestored: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/copy_event) */ + oncopy: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLTrackElement/cuechange_event) */ + oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/cut_event) */ + oncut: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/dblclick_event) */ + ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/drag_event) */ + ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/dragend_event) */ + ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/dragenter_event) */ + ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/dragleave_event) */ + ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/dragover_event) */ + ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/dragstart_event) */ + ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/drop_event) */ + ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/durationchange_event) */ + ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/emptied_event) */ + onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/ended_event) */ + onended: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/error_event) */ + onerror: OnErrorEventHandler; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/focus_event) */ + onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLFormElement/formdata_event) */ + onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/gotpointercapture_event) */ + ongotpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/input_event) */ + oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/invalid_event) */ + oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/keydown_event) */ + onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null; + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/keypress_event) + */ + onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/keyup_event) */ + onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/load_event) */ + onload: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/loadeddata_event) */ + onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/loadedmetadata_event) */ + onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/loadstart_event) */ + onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/lostpointercapture_event) */ + onlostpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/mousedown_event) */ + onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/mouseenter_event) */ + onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/mouseleave_event) */ + onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/mousemove_event) */ + onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/mouseout_event) */ + onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/mouseover_event) */ + onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/mouseup_event) */ + onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/paste_event) */ + onpaste: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/pause_event) */ + onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/play_event) */ + onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/playing_event) */ + onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/pointercancel_event) */ + onpointercancel: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/pointerdown_event) */ + onpointerdown: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/pointerenter_event) */ + onpointerenter: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/pointerleave_event) */ + onpointerleave: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/pointermove_event) */ + onpointermove: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/pointerout_event) */ + onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/pointerover_event) */ + onpointerover: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/pointerrawupdate_event) + */ + onpointerrawupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/pointerup_event) */ + onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/progress_event) */ + onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/ratechange_event) */ + onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLFormElement/reset_event) */ + onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLVideoElement/resize_event) */ + onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/scroll_event) */ + onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/scrollend_event) */ + onscrollend: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/securitypolicyviolation_event) */ + onsecuritypolicyviolation: ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/seeked_event) */ + onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/seeking_event) */ + onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/select_event) */ + onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/selectionchange_event) */ + onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/selectstart_event) */ + onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLSlotElement/slotchange_event) */ + onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/stalled_event) */ + onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLFormElement/submit_event) */ + onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/suspend_event) */ + onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/timeupdate_event) */ + ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/toggle_event) */ + ontoggle: ((this: GlobalEventHandlers, ev: ToggleEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/touchcancel_event) */ + ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/touchend_event) */ + ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/touchmove_event) */ + ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/touchstart_event) */ + ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/transitioncancel_event) */ + ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/transitionend_event) */ + ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/transitionrun_event) */ + ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/transitionstart_event) */ + ontransitionstart: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/volumechange_event) */ + onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/waiting_event) */ + onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * @deprecated This is a legacy alias of `onanimationend`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/animationend_event) + */ + onwebkitanimationend: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * @deprecated This is a legacy alias of `onanimationiteration`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/animationiteration_event) + */ + onwebkitanimationiteration: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * @deprecated This is a legacy alias of `onanimationstart`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/animationstart_event) + */ + onwebkitanimationstart: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * @deprecated This is a legacy alias of `ontransitionend`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/transitionend_event) + */ + onwebkittransitionend: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/wheel_event) */ + onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null; + addEventListener(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +/** + * The **`HTMLAllCollection`** interface represents a collection of _all_ of the document's elements, accessible by index (like an array) and by the element's `id`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAllCollection) + */ +interface HTMLAllCollection { + /** + * The **`HTMLAllCollection.length`** property returns the number of items in this HTMLAllCollection. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAllCollection/length) + */ + readonly length: number; + /** + * The **`item()`** method of the HTMLAllCollection interface returns the element located at the specified offset into the collection, or the element with the specified value for its `id` or `name` attribute. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAllCollection/item) + */ + item(nameOrIndex?: string): HTMLCollection | Element | null; + /** + * The **`namedItem()`** method of the HTMLAllCollection interface returns the first Element in the collection whose `id` or `name` attribute matches the specified name, or `null` if no element matches. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAllCollection/namedItem) + */ + namedItem(name: string): HTMLCollection | Element | null; + [index: number]: Element; +} + +declare var HTMLAllCollection: { + prototype: HTMLAllCollection; + new(): HTMLAllCollection; +}; + +/** + * The **`HTMLAnchorElement`** interface represents hyperlink elements and provides special properties and methods (beyond those of the regular HTMLElement object interface that they inherit from) for manipulating the layout and presentation of such elements. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement) + */ +interface HTMLAnchorElement extends HTMLElement, HTMLHyperlinkElementUtils { + /** @deprecated */ + charset: string; + /** @deprecated */ + coords: string; + /** + * The **`HTMLAnchorElement.download`** property is a string indicating that the linked resource is intended to be downloaded rather than displayed in the browser. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/download) + */ + download: string; + /** + * The **`hreflang`** property of the HTMLAnchorElement interface is a string that is the language of the linked resource. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/hreflang) + */ + hreflang: string; + /** @deprecated */ + name: string; + /** + * The **`ping`** property of the HTMLAnchorElement interface is a space-separated list of URLs. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/ping) + */ + ping: string; + /** + * The **`HTMLAnchorElement.referrerPolicy`** property reflect the HTML `referrerpolicy` attribute of the A string; one of the following: - `no-referrer` - : The Referer header will be omitted entirely. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/referrerPolicy) + */ + referrerPolicy: string; + /** + * The **`HTMLAnchorElement.rel`** property reflects the `rel` attribute. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/rel) + */ + rel: string; + /** + * The **`HTMLAnchorElement.relList`** read-only property reflects the `rel` attribute. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/relList) + */ + get relList(): DOMTokenList; + set relList(value: string); + /** @deprecated */ + rev: string; + /** @deprecated */ + shape: string; + /** + * The **`target`** property of the HTMLAnchorElement interface is a string that indicates where to display the linked resource. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/target) + */ + target: string; + /** + * The **`text`** property of the HTMLAnchorElement represents the text inside the element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/text) + */ + text: string; + /** + * The **`type`** property of the HTMLAnchorElement interface is a string that indicates the MIME type of the linked resource. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/type) + */ + type: string; + addEventListener(type: K, listener: (this: HTMLAnchorElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: HTMLAnchorElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var HTMLAnchorElement: { + prototype: HTMLAnchorElement; + new(): HTMLAnchorElement; +}; + +/** + * The **`HTMLAreaElement`** interface provides special properties and methods (beyond those of the regular object HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of area elements. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement) + */ +interface HTMLAreaElement extends HTMLElement, HTMLHyperlinkElementUtils { + /** + * The **`alt`** property of the HTMLAreaElement interface specifies the text of the hyperlink, defining the textual label for an image map's link. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/alt) + */ + alt: string; + /** + * The **`coords`** property of the HTMLAreaElement interface specifies the coordinates of the element's shape as a list of floating-point numbers. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/coords) + */ + coords: string; + /** + * The **`download`** property of the HTMLAreaElement interface is a string indicating that the linked resource is intended to be downloaded rather than displayed in the browser. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/download) + */ + download: string; + /** @deprecated */ + noHref: boolean; + /** + * The **`ping`** property of the HTMLAreaElement interface is a space-separated list of URLs. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/ping) + */ + ping: string; + /** + * The **`HTMLAreaElement.referrerPolicy`** property reflect the HTML `referrerpolicy` attribute of the resource. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/referrerPolicy) + */ + referrerPolicy: string; + /** + * The **`HTMLAreaElement.rel`** property reflects the `rel` attribute. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/rel) + */ + rel: string; + /** + * The **`HTMLAreaElement.relList`** read-only property reflects the `rel` attribute. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/relList) + */ + get relList(): DOMTokenList; + set relList(value: string); + /** + * The **`shape`** property of the HTMLAreaElement interface specifies the shape of an image map area. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/shape) + */ + shape: string; + /** + * The **`target`** property of the HTMLAreaElement interface is a string that indicates where to display the linked resource. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/target) + */ + target: string; + addEventListener(type: K, listener: (this: HTMLAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: HTMLAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var HTMLAreaElement: { + prototype: HTMLAreaElement; + new(): HTMLAreaElement; +}; + +/** + * The **`HTMLAudioElement`** interface provides access to the properties of audio elements, as well as methods to manipulate them. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAudioElement) + */ +interface HTMLAudioElement extends HTMLMediaElement { + addEventListener(type: K, listener: (this: HTMLAudioElement, ev: HTMLMediaElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: HTMLAudioElement, ev: HTMLMediaElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var HTMLAudioElement: { + prototype: HTMLAudioElement; + new(): HTMLAudioElement; +}; + +/** + * The **`HTMLBRElement`** interface represents an HTML line break element (br). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLBRElement) + */ +interface HTMLBRElement extends HTMLElement { + /** @deprecated */ + clear: string; + addEventListener(type: K, listener: (this: HTMLBRElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: HTMLBRElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var HTMLBRElement: { + prototype: HTMLBRElement; + new(): HTMLBRElement; +}; + +/** + * The **`HTMLBaseElement`** interface contains the base URI for a document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLBaseElement) + */ +interface HTMLBaseElement extends HTMLElement { + /** + * The **`href`** property of the HTMLBaseElement interface contains a string that is the URL to use as the base for relative URLs. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLBaseElement/href) + */ + href: string; + /** + * The `target` property of the HTMLBaseElement interface is a string that represents the default target tab to show the resulting output for hyperlinks and form elements. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLBaseElement/target) + */ + target: string; + addEventListener(type: K, listener: (this: HTMLBaseElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: HTMLBaseElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var HTMLBaseElement: { + prototype: HTMLBaseElement; + new(): HTMLBaseElement; +}; + +interface HTMLBodyElementEventMap extends HTMLElementEventMap, WindowEventHandlersEventMap { +} + +/** + * The **`HTMLBodyElement`** interface provides special properties (beyond those inherited from the regular HTMLElement interface) for manipulating body elements. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLBodyElement) + */ +interface HTMLBodyElement extends HTMLElement, WindowEventHandlers { + /** @deprecated */ + aLink: string; + /** @deprecated */ + background: string; + /** @deprecated */ + bgColor: string; + /** @deprecated */ + link: string; + /** @deprecated */ + text: string; + /** @deprecated */ + vLink: string; + addEventListener(type: K, listener: (this: HTMLBodyElement, ev: HTMLBodyElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: HTMLBodyElement, ev: HTMLBodyElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var HTMLBodyElement: { + prototype: HTMLBodyElement; + new(): HTMLBodyElement; +}; + +/** + * The **`HTMLButtonElement`** interface provides properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating button elements. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLButtonElement) + */ +interface HTMLButtonElement extends HTMLElement, PopoverInvokerElement { + /** + * The **`HTMLButtonElement.disabled`** property indicates whether the control is disabled, meaning that it does not accept any clicks. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLButtonElement/disabled) + */ + disabled: boolean; + /** + * The **`form`** read-only property of the HTMLButtonElement interface returns an HTMLFormElement object that owns this button, or `null` if this button is not owned by any form. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLButtonElement/form) + */ + readonly form: HTMLFormElement | null; + /** + * The **`formAction`** property of the HTMLButtonElement interface is the URL of the program that is executed on the server when the form that owns this control is submitted. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLButtonElement/formAction) + */ + formAction: string; + /** + * The **`formEnctype`** property of the HTMLButtonElement interface is the MIME_type of the content sent to the server when the form is submitted. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLButtonElement/formEnctype) + */ + formEnctype: string; + /** + * The **`formMethod`** property of the HTMLButtonElement interface is the HTTP method used to submit the form if the button element is the control that submits the form. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLButtonElement/formMethod) + */ + formMethod: string; + /** + * The **`formNoValidate`** property of the HTMLButtonElement interface is a boolean value indicating if the form will bypass constraint validation when submitted via the button. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLButtonElement/formNoValidate) + */ + formNoValidate: boolean; + /** + * The **`formTarget`** property of the HTMLButtonElement interface is the tab, window, or iframe where the response of the submitted form is to be displayed. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLButtonElement/formTarget) + */ + formTarget: string; + /** + * The **`HTMLButtonElement.labels`** read-only property returns a A NodeList containing the `