diff --git a/src/compiler/builderState.ts b/src/compiler/builderState.ts index a64a6c13ed1e8..0bc83df00fb01 100644 --- a/src/compiler/builderState.ts +++ b/src/compiler/builderState.ts @@ -593,7 +593,7 @@ namespace ts { } /** - * Return true if the file will invalidate all files because it affectes global scope + * Return true if the file will invalidate all files because it affects global scope */ function isFileAffectingGlobalScope(sourceFile: SourceFile) { return containsGlobalScopeAugmentation(sourceFile) || diff --git a/src/compiler/core.ts b/src/compiler/core.ts index a3be6f976cdc9..2466c996be481 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -729,6 +729,7 @@ namespace ts { /** * Deduplicates an unsorted array. + * @param array An array to be checked. * @param equalityComparer An `EqualityComparer` used to determine if two values are duplicates. * @param comparer An optional `Comparer` used to sort entries before comparison, though the * result will remain in the original order in `array`. @@ -1313,6 +1314,7 @@ namespace ts { * * @param left A map-like whose properties should be compared. * @param right A map-like whose properties should be compared. + * @param equalityComparer A function that compares two values for equality. */ export function equalOwnProperties(left: MapLike | undefined, right: MapLike | undefined, equalityComparer: EqualityComparer = equateValues) { if (left === right) return true; diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index e06b0e6b8b1dc..8cc041e814ec7 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -15,6 +15,9 @@ namespace ts { * @param sourceFilesOrTargetSourceFile * If an array, the full list of source files to emit. * Else, calls `getSourceFilesToEmit` with the (optional) target source file to determine the list of source files to emit. + * @param forceDtsEmit whether to always generate declaration files. + * @param onlyBuildInfo Whether to build only the target file. + * @param includeBuildInfo Whether to include the built files in the result. */ export function forEachEmittedFile( host: EmitHost, action: (emitFileNames: EmitFileNames, sourceFileOrBundle: SourceFile | Bundle | undefined) => T, @@ -1084,7 +1087,7 @@ namespace ts { bundleFileInfo.sources.prologues = prologues; } - // Store helpes + // Store helps const helpers = getHelpersFromBundledSourceFiles(bundle); if (helpers) { if (!bundleFileInfo.sources) bundleFileInfo.sources = {}; @@ -5802,7 +5805,8 @@ namespace ts { * * @param node The node containing the token. * @param token The token to emit. - * @param tokenStartPos The start pos of the token. + * @param writer The operation of EmitTextWriter. + * @param tokenPos The start pos of the token. * @param emitCallback The callback used to emit the token. */ function emitTokenWithSourceMap(node: Node | undefined, token: SyntaxKind, writer: (s: string) => void, tokenPos: number, emitCallback: (token: SyntaxKind, writer: (s: string) => void, tokenStartPos: number) => number) { diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 412fc581085d7..bec9077403014 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -27,7 +27,7 @@ namespace ts { const parenthesizerRules = memoize(() => flags & NodeFactoryFlags.NoParenthesizerRules ? nullParenthesizerRules : createParenthesizerRules(factory)); const converters = memoize(() => flags & NodeFactoryFlags.NoNodeConverters ? nullNodeConverters : createNodeConverters(factory)); - // lazy initializaton of common operator factories + // lazy initialization of common operator factories const getBinaryCreateFunction = memoizeOne((operator: BinaryOperator) => (left: Expression, right: Expression) => createBinaryExpression(left, operator, right)); const getPrefixUnaryCreateFunction = memoizeOne((operator: PrefixUnaryOperator) => (operand: Expression) => createPrefixUnaryExpression(operator, operand)); const getPostfixUnaryCreateFunction = memoizeOne((operator: PostfixUnaryOperator) => (operand: Expression) => createPostfixUnaryExpression(operand, operator)); @@ -2314,7 +2314,7 @@ namespace ts { // @api function createArrayLiteralExpression(elements?: readonly Expression[], multiLine?: boolean) { const node = createBaseExpression(SyntaxKind.ArrayLiteralExpression); - // Ensure we add a trailing comma for something like `[NumericLiteral(1), NumericLiteral(2), OmittedExpresion]` so that + // Ensure we add a trailing comma for something like `[NumericLiteral(1), NumericLiteral(2), OmittedExpression]` so that // we end up with `[1, 2, ,]` instead of `[1, 2, ]` otherwise the `OmittedExpression` will just end up being treated like // a trailing comma. const lastElement = elements && lastOrUndefined(elements); @@ -5744,11 +5744,7 @@ namespace ts { case SyntaxKind.StringLiteral: return false; case SyntaxKind.ArrayLiteralExpression: - const elements = (target as ArrayLiteralExpression).elements; - if (elements.length === 0) { - return false; - } - return true; + return (target as ArrayLiteralExpression).elements.length > 0; case SyntaxKind.ObjectLiteralExpression: return (target as ObjectLiteralExpression).properties.length > 0; default: @@ -5878,7 +5874,7 @@ namespace ts { /** * Gets the internal name of a declaration. This is primarily used for declarations that can be * referred to by name in the body of an ES5 class function body. An internal name will *never* - * be prefixed with an module or namespace export modifier like "exports." when emitted as an + * be prefixed with a module or namespace export modifier like "exports." when emitted as an * expression. An internal name will also *never* be renamed due to a collision with a block * scoped variable. * @@ -5893,7 +5889,7 @@ namespace ts { /** * Gets the local name of a declaration. This is primarily used for declarations that can be * referred to by name in the declaration's immediate scope (classes, enums, namespaces). A - * local name will *never* be prefixed with an module or namespace export modifier like + * local name will *never* be prefixed with a module or namespace export modifier like * "exports." when emitted as an expression. * * @param node The declaration. @@ -5907,7 +5903,7 @@ namespace ts { /** * Gets the export name of a declaration. This is primarily used for declarations that can be * referred to by name in the declaration's immediate scope (classes, enums, namespaces). An - * export name will *always* be prefixed with an module or namespace export modifier like + * export name will *always* be prefixed with a module or namespace export modifier like * `"exports."` when emitted as an expression if the name points to an exported symbol. * * @param node The declaration. @@ -5950,7 +5946,7 @@ namespace ts { /** * Gets the exported name of a declaration for use in expressions. * - * An exported name will *always* be prefixed with an module or namespace export modifier like + * An exported name will *always* be prefixed with a module or namespace export modifier like * "exports." if the name points to an exported symbol. * * @param ns The namespace identifier. @@ -6022,6 +6018,7 @@ namespace ts { * @param target result statements array * @param statementOffset The offset at which to begin the copy. * @param visitor Optional callback used to visit any custom prologue directives. + * @param filter the function that determines whether a statement meets the condition specified */ function copyCustomPrologue(source: readonly Statement[], target: Push, statementOffset: number, visitor?: (node: Node) => VisitResult, filter?: (node: Node) => boolean): number; function copyCustomPrologue(source: readonly Statement[], target: Push, statementOffset: number | undefined, visitor?: (node: Node) => VisitResult, filter?: (node: Node) => boolean): number | undefined; diff --git a/src/compiler/factory/parenthesizerRules.ts b/src/compiler/factory/parenthesizerRules.ts index 1e2cb936582fa..2f85cd017350d 100644 --- a/src/compiler/factory/parenthesizerRules.ts +++ b/src/compiler/factory/parenthesizerRules.ts @@ -59,6 +59,8 @@ namespace ts { * @param operand The operand for the BinaryExpression. * @param isLeftSideOfBinary A value indicating whether the operand is the left side of the * BinaryExpression. + * @param leftOperand The left operand if {@link operand} is the right side of the + * BinaryExpression and {@link isLeftSideOfBinary} is false */ function binaryOperandNeedsParentheses(binaryOperator: SyntaxKind, operand: Expression, isLeftSideOfBinary: boolean, leftOperand: Expression | undefined) { // If the operand has lower precedence, then it needs to be parenthesized to preserve the @@ -91,13 +93,9 @@ namespace ts { case Comparison.LessThan: // If the operand is the right side of a right-associative binary operation // and is a yield expression, then we do not need parentheses. - if (!isLeftSideOfBinary + return !(!isLeftSideOfBinary && binaryOperatorAssociativity === Associativity.Right - && operand.kind === SyntaxKind.YieldExpression) { - return false; - } - - return true; + && operand.kind === SyntaxKind.YieldExpression); case Comparison.GreaterThan: return false; @@ -216,7 +214,8 @@ namespace ts { * @param operand The operand for the BinaryExpression. * @param isLeftSideOfBinary A value indicating whether the operand is the left side of the * BinaryExpression. - */ + * @param leftOperand The left operand if {@link operand} is the right side of the + * BinaryExpression and {@link isLeftSideOfBinary} is false */ function parenthesizeBinaryOperand(binaryOperator: SyntaxKind, operand: Expression, isLeftSideOfBinary: boolean, leftOperand?: Expression) { const skipped = skipPartiallyEmittedExpressions(operand); @@ -324,17 +323,17 @@ namespace ts { return expression as LeftHandSideExpression; } - // TODO(rbuckton): Verifiy whether `setTextRange` is needed. + // TODO(rbuckton): Verify whether `setTextRange` is needed. return setTextRange(factory.createParenthesizedExpression(expression), expression); } function parenthesizeOperandOfPostfixUnary(operand: Expression): LeftHandSideExpression { - // TODO(rbuckton): Verifiy whether `setTextRange` is needed. + // TODO(rbuckton): Verify whether `setTextRange` is needed. return isLeftHandSideExpression(operand) ? operand : setTextRange(factory.createParenthesizedExpression(operand), operand); } function parenthesizeOperandOfPrefixUnary(operand: Expression): UnaryExpression { - // TODO(rbuckton): Verifiy whether `setTextRange` is needed. + // TODO(rbuckton): Verify whether `setTextRange` is needed. return isUnaryExpression(operand) ? operand : setTextRange(factory.createParenthesizedExpression(operand), operand); } @@ -347,7 +346,7 @@ namespace ts { const emittedExpression = skipPartiallyEmittedExpressions(expression); const expressionPrecedence = getExpressionPrecedence(emittedExpression); const commaPrecedence = getOperatorPrecedence(SyntaxKind.BinaryExpression, SyntaxKind.CommaToken); - // TODO(rbuckton): Verifiy whether `setTextRange` is needed. + // TODO(rbuckton): Verify whether `setTextRange` is needed. return expressionPrecedence > commaPrecedence ? expression : setTextRange(factory.createParenthesizedExpression(expression), expression); } @@ -357,7 +356,7 @@ namespace ts { const callee = emittedExpression.expression; const kind = skipPartiallyEmittedExpressions(callee).kind; if (kind === SyntaxKind.FunctionExpression || kind === SyntaxKind.ArrowFunction) { - // TODO(rbuckton): Verifiy whether `setTextRange` is needed. + // TODO(rbuckton): Verify whether `setTextRange` is needed. const updated = factory.updateCallExpression( emittedExpression, setTextRange(factory.createParenthesizedExpression(callee), callee), @@ -370,7 +369,7 @@ namespace ts { const leftmostExpressionKind = getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind; if (leftmostExpressionKind === SyntaxKind.ObjectLiteralExpression || leftmostExpressionKind === SyntaxKind.FunctionExpression) { - // TODO(rbuckton): Verifiy whether `setTextRange` is needed. + // TODO(rbuckton): Verify whether `setTextRange` is needed. return setTextRange(factory.createParenthesizedExpression(expression), expression); } @@ -381,7 +380,7 @@ namespace ts { function parenthesizeConciseBodyOfArrowFunction(body: ConciseBody): ConciseBody; function parenthesizeConciseBodyOfArrowFunction(body: ConciseBody): ConciseBody { if (!isBlock(body) && (isCommaSequence(body) || getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === SyntaxKind.ObjectLiteralExpression)) { - // TODO(rbuckton): Verifiy whether `setTextRange` is needed. + // TODO(rbuckton): Verify whether `setTextRange` is needed. return setTextRange(factory.createParenthesizedExpression(body), body); } diff --git a/src/compiler/factory/utilities.ts b/src/compiler/factory/utilities.ts index 7daa31c522732..b55c4cbe5e840 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -333,6 +333,7 @@ namespace ts { * @param factory {@link NodeFactory} used to create the expanded representation. * @param node The original prefix or postfix unary node. * @param expression The expression to use as the value to increment or decrement + * @param recordTempVariable A callback which reference to `hoistVariableDeclaration` from a `TransformationContext` used to record the temporary variable name. * @param resultVariable A temporary variable in which to store the result. Pass `undefined` if the result is discarded, or if the value of `` is the expected result. */ export function expandPreOrPostfixIncrementOrDecrementExpression(factory: NodeFactory, node: PrefixUnaryExpression | PostfixUnaryExpression, expression: Expression, recordTempVariable: (node: Identifier) => void, resultVariable: Identifier | undefined) { @@ -1161,6 +1162,7 @@ namespace ts { * Creates a state machine that walks a `BinaryExpression` using the heap to reduce call-stack depth on a large tree. * @param onEnter Callback evaluated when entering a `BinaryExpression`. Returns new user-defined state to associate with the node while walking. * @param onLeft Callback evaluated when walking the left side of a `BinaryExpression`. Return a `BinaryExpression` to continue walking, or `void` to advance to the right side. + * @param onOperator Callback evaluated when walking the operator of a `BinaryExpression`. * @param onRight Callback evaluated when walking the right side of a `BinaryExpression`. Return a `BinaryExpression` to continue walking, or `void` to advance to the end of the node. * @param onExit Callback evaluated when exiting a `BinaryExpression`. The result returned will either be folded into the parent's state, or returned from the walker if at the top frame. * @param foldState Callback evaluated when the result from a nested `onExit` should be folded into the state of that node's parent. @@ -1178,6 +1180,7 @@ namespace ts { * Creates a state machine that walks a `BinaryExpression` using the heap to reduce call-stack depth on a large tree. * @param onEnter Callback evaluated when entering a `BinaryExpression`. Returns new user-defined state to associate with the node while walking. * @param onLeft Callback evaluated when walking the left side of a `BinaryExpression`. Return a `BinaryExpression` to continue walking, or `void` to advance to the right side. + * @param onOperator Callback evaluated when walking the operator of a `BinaryExpression`. * @param onRight Callback evaluated when walking the right side of a `BinaryExpression`. Return a `BinaryExpression` to continue walking, or `void` to advance to the end of the node. * @param onExit Callback evaluated when exiting a `BinaryExpression`. The result returned will either be folded into the parent's state, or returned from the walker if at the top frame. * @param foldState Callback evaluated when the result from a nested `onExit` should be folded into the state of that node's parent. diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts index 270bee0048ec8..6c32070f0dafb 100644 --- a/src/compiler/moduleSpecifiers.ts +++ b/src/compiler/moduleSpecifiers.ts @@ -242,7 +242,7 @@ namespace ts.moduleSpecifiers { // Module specifier priority: // 1. "Bare package specifiers" (e.g. "@foo/bar") resulting from a path through node_modules to a package.json's "types" entry // 2. Specifiers generated using "paths" from tsconfig - // 3. Non-relative specfiers resulting from a path through node_modules (e.g. "@foo/bar/path/to/file") + // 3. Non-relative specifiers resulting from a path through node_modules (e.g. "@foo/bar/path/to/file") // 4. Relative paths let nodeModulesSpecifiers: string[] | undefined; let pathsSpecifiers: string[] | undefined; diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index e3aebc849b6a3..b79270fd8d698 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -322,7 +322,7 @@ namespace ts { } // Sometimes tools can see the following line as a source mapping url comment, so we mangle it a bit (the [M]) - const sourceMapCommentRegExp = /^\/\/[@#] source[M]appingURL=(.+)\r?\n?$/; + const sourceMapCommentRegExp = /^\/\/[@#] sourceMappingURL=(.+)\r?\n?$/; const whitespaceOrMapCommentRegExp = /^\s*(\/\/[@#] .*)?$/; diff --git a/src/compiler/symbolWalker.ts b/src/compiler/symbolWalker.ts index 4130d7fc84f9e..bde6f3f00613c 100644 --- a/src/compiler/symbolWalker.ts +++ b/src/compiler/symbolWalker.ts @@ -52,7 +52,7 @@ namespace ts { visitedTypes[type.id] = type; // Reuse visitSymbol to visit the type's symbol, - // but be sure to bail on recuring into the type if accept declines the symbol. + // but be sure to bail on recurring into the type if accept declines the symbol. const shouldBail = visitSymbol(type.symbol); if (shouldBail) return; @@ -187,4 +187,4 @@ namespace ts { } } } -} \ No newline at end of file +} diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 48ac670c8bea3..43a774932a353 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -1521,7 +1521,7 @@ namespace ts { if (platform === "win32" || platform === "win64") { return false; } - // If this file exists under a different case, we must be case-insensitve. + // If this file exists under a different case, we must be case-insensitive. return !fileExists(swapCase(__filename)); } @@ -1541,7 +1541,7 @@ namespace ts { }; function fileChanged(curr: any, prev: any) { - // previous event kind check is to ensure we recongnize the file as previously also missing when it is restored or renamed twice (that is it disappears and reappears) + // previous event kind check is to ensure we recognize the file as previously also missing when it is restored or renamed twice (that is it disappears and reappears) // In such case, prevTime returned is same as prev time of event when file was deleted as per node documentation const isPreviouslyDeleted = +prev.mtime === 0 || eventKind === FileWatcherEventKind.Deleted; if (+curr.mtime === 0) { diff --git a/src/compiler/tracing.ts b/src/compiler/tracing.ts index 4757ac72e1b7b..5ea22eb25bcda 100644 --- a/src/compiler/tracing.ts +++ b/src/compiler/tracing.ts @@ -25,7 +25,7 @@ namespace ts { // eslint-disable-line one-namespace-per-file // The actual constraint is that JSON.stringify be able to serialize it without throwing. interface Args { [key: string]: string | number | boolean | null | undefined | Args | readonly (string | number | boolean | null | undefined | Args)[]; - }; + } /** Starts tracing for the given project. */ export function startTracing(tracingMode: Mode, traceDir: string, configFilePath?: string) { @@ -120,6 +120,9 @@ namespace ts { // eslint-disable-line one-namespace-per-file const eventStack: { phase: Phase, name: string, args?: Args, time: number, separateBeginAndEnd: boolean }[] = []; /** + * @param phase event's phase + * @param name event's name + * @param args the parameter object associated with the event * @param separateBeginAndEnd - used for special cases where we need the trace point even if the event * never terminates (typically for reducing a scenario too big to trace to one that can be completed). * In the future we might implement an exit handler to dump unfinished events which would deprecate diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index 7207d8a60d75b..e1539aae4cf26 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -146,9 +146,10 @@ namespace ts { * * @param resolver The emit resolver provided by the checker. * @param host The emit host object used to interact with the file system. + * @param factory {@link NodeFactory} used to create the expanded representation. * @param options Compiler options to surface in the `TransformationContext`. * @param nodes An array of nodes to transform. - * @param transforms An array of `TransformerFactory` callbacks. + * @param transformers An array of `TransformerFactory` callbacks. * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ export function transformNodes(resolver: EmitResolver | undefined, host: EmitHost | undefined, factory: NodeFactory, options: CompilerOptions, nodes: readonly T[], transformers: readonly TransformerFactory[], allowDtsFiles: boolean): TransformationResult { @@ -282,7 +283,6 @@ namespace ts { * * @param hint A hint as to the intended usage of the node. * @param node The node to emit. - * @param emitCallback The callback used to emit the node or its substitute. */ function substituteNode(hint: EmitHint, node: Node) { Debug.assert(state < TransformationState.Disposed, "Cannot substitute a node after the result is disposed."); diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index 3ac842e8abab5..da614d1979765 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -835,8 +835,8 @@ namespace ts { if (setterName) { // converts `super.x = 1` into `(Reflect.set(_baseTemp, "x", _a = 1, _classTemp), _a)` // converts `super[f()] = 1` into `(Reflect.set(_baseTemp, f(), _a = 1, _classTemp), _a)` - // converts `super.x += 1` into `(Reflect.set(_baseTemp, "x", _a = Reflect.get(_baseTemp, "x", _classtemp) + 1, _classTemp), _a)` - // converts `super[f()] += 1` into `(Reflect.set(_baseTemp, _a = f(), _b = Reflect.get(_baseTemp, _a, _classtemp) + 1, _classTemp), _b)` + // converts `super.x += 1` into `(Reflect.set(_baseTemp, "x", _a = Reflect.get(_baseTemp, "x", _classTemp) + 1, _classTemp), _a)` + // converts `super[f()] += 1` into `(Reflect.set(_baseTemp, _a = f(), _b = Reflect.get(_baseTemp, _a, _classTemp) + 1, _classTemp), _b)` let expression = visitNode(node.right, visitor, isExpression); if (isCompoundAssignment(node.operatorToken.kind)) { diff --git a/src/compiler/transformers/es2017.ts b/src/compiler/transformers/es2017.ts index 50c4fa62c0dcb..f814a05aa4095 100644 --- a/src/compiler/transformers/es2017.ts +++ b/src/compiler/transformers/es2017.ts @@ -597,7 +597,7 @@ namespace ts { * * @param hint A hint as to the intended usage of the node. * @param node The node to emit. - * @param emit A callback used to emit the node in the printer. + * @param emitCallback A callback used to emit the node in the printer. */ function onEmitNode(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void { // If we need to support substitutions for `super` in an async method, diff --git a/src/compiler/transformers/es2018.ts b/src/compiler/transformers/es2018.ts index e3923c79d9fc3..2c1d47de10996 100644 --- a/src/compiler/transformers/es2018.ts +++ b/src/compiler/transformers/es2018.ts @@ -149,6 +149,7 @@ namespace ts { } /** + * @param node The node to emit. * @param expressionResultIsUnused Indicates the result of an expression is unused by the parent node (i.e., the left side of a comma or the * expression of an `ExpressionStatement`). */ @@ -422,6 +423,7 @@ namespace ts { } /** + * @param node The node to emit. * @param expressionResultIsUnused Indicates the result of an expression is unused by the parent node (i.e., the left side of a comma or the * expression of an `ExpressionStatement`). */ @@ -486,6 +488,7 @@ namespace ts { } /** + * @param node The node to emit. * @param expressionResultIsUnused Indicates the result of an expression is unused by the parent node (i.e., the left side of a comma or the * expression of an `ExpressionStatement`). */ diff --git a/src/compiler/tsbuildPublic.ts b/src/compiler/tsbuildPublic.ts index ad9f97f2dd8ab..6adcd362833f0 100644 --- a/src/compiler/tsbuildPublic.ts +++ b/src/compiler/tsbuildPublic.ts @@ -155,7 +155,7 @@ namespace ts { } /** - * Create a function that reports watch status by writing to the system and handles the formating of the diagnostic + * Create a function that reports watch status by writing to the system and handles the formatting of the diagnostic */ export function createBuilderStatusReporter(system: System, pretty?: boolean): DiagnosticReporter { return diagnostic => { @@ -1473,7 +1473,7 @@ namespace ts { } // If the upstream project has only change .d.ts files, and we've built - // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild + // *after* those files, then we're "pseudo up to date" and eligible for a fast rebuild if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) { pseudoUpToDate = true; upstreamChangedProject = ref.path; @@ -1938,7 +1938,7 @@ namespace ts { clearMap(state.allWatchedExtendedConfigFiles, closeFileWatcherOf); clearMap(state.allWatchedWildcardDirectories, watchedWildcardDirectories => clearMap(watchedWildcardDirectories, closeFileWatcherOf)); clearMap(state.allWatchedInputFiles, watchedWildcardDirectories => clearMap(watchedWildcardDirectories, closeFileWatcher)); - clearMap(state.allWatchedPackageJsonFiles, watchedPacageJsonFiles => clearMap(watchedPacageJsonFiles, closeFileWatcher)); + clearMap(state.allWatchedPackageJsonFiles, watchedPackageJsonFiles => clearMap(watchedPackageJsonFiles, closeFileWatcher)); } /** diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 5180c765990bb..fbb206000e307 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -769,7 +769,7 @@ namespace ts { HasAggregatedChildData = 1 << 19, // 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 + // walking the tree if the flags are not set. However, these flags are just an 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. @@ -4133,7 +4133,7 @@ namespace ts { /** Return code used by getEmitOutput function to indicate status of the function */ export enum ExitStatus { // Compiler ran successfully. Either this was a simple do-nothing compilation (for example, - // when -version or -help was provided, or this was a normal compilation, no diagnostics + // when -version or -help was provided), or this was a normal compilation, no diagnostics // were produced, and all outputs were generated successfully. Success = 0, @@ -4280,6 +4280,9 @@ namespace ts { /** * returns unknownSignature in the case of an error. * returns undefined if the node is not valid. + * @param node The original node. + * @param candidatesOutArray an array of signature to be filled in by the function. It is passed by signature help in the language service; + * the function will fill it up with appropriate candidate signatures * @param argumentCount Apparent number of arguments, passed in case of a possibly incomplete call. This should come from an ArgumentListInfo. See `signatureHelp.ts`. */ getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[], argumentCount?: number): Signature | undefined; @@ -6388,7 +6391,7 @@ namespace ts { isFilePath?: boolean; // True if option value is a path or fileName shortName?: string; // A short mnemonic for convenience - for instance, 'h' can be used in place of 'help' description?: DiagnosticMessage; // The message describing what the command line switch does. - defaultValueDescription?: string | number | boolean | DiagnosticMessage; // The message describing what the dafault value is. string type is prepared for fixed chosen like "false" which do not need I18n. + defaultValueDescription?: string | number | boolean | DiagnosticMessage; // The message describing what the default value is. string type is prepared for fixed chosen like "false" which do not need I18n. paramType?: DiagnosticMessage; // The name to be used for a non-boolean option's parameter isTSConfigOnly?: boolean; // True if option can only be specified via tsconfig.json file isCommandLineOnly?: boolean; diff --git a/src/compiler/visitorPublic.ts b/src/compiler/visitorPublic.ts index ef05168148e5a..2eca944c274ef 100644 --- a/src/compiler/visitorPublic.ts +++ b/src/compiler/visitorPublic.ts @@ -345,6 +345,8 @@ namespace ts { * @param node The Node whose children will be visited. * @param visitor The callback used to visit each child. * @param context A lexical environment context for the visitor. + * @param nodesVisitor A wrapper function visits child using the supplied visitor if the child of Node has multiple values. + * @param tokenVisitor The special callback used to visit the token of node. */ export function visitEachChild(node: T | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes, tokenVisitor?: Visitor): T | undefined; /* @internal */ diff --git a/src/compiler/watchPublic.ts b/src/compiler/watchPublic.ts index 095c0f69a1083..042d7095e304b 100644 --- a/src/compiler/watchPublic.ts +++ b/src/compiler/watchPublic.ts @@ -77,12 +77,12 @@ namespace ts { /** * Use to check file presence for source files and - * if resolveModuleNames is not provided (complier is in charge of module resolution) then module files as well + * if resolveModuleNames is not provided (compiler is in charge of module resolution) then module files as well */ fileExists(path: string): boolean; /** * Use to read file text for source files and - * if resolveModuleNames is not provided (complier is in charge of module resolution) then module files as well + * if resolveModuleNames is not provided (compiler is in charge of module resolution) then module files as well */ readFile(path: string, encoding?: string): string | undefined; @@ -159,7 +159,7 @@ namespace ts { /** * Used to generate source file names from the config file and its include, exclude, files rules - * and also to cache the directory stucture + * and also to cache the directory structure */ readDirectory(path: string, extensions?: readonly string[], exclude?: readonly string[], include?: readonly string[], depth?: number): string[]; } diff --git a/src/jsTyping/jsTyping.ts b/src/jsTyping/jsTyping.ts index 141212eca20db..798466afed65e 100644 --- a/src/jsTyping/jsTyping.ts +++ b/src/jsTyping/jsTyping.ts @@ -108,12 +108,14 @@ namespace ts.JsTyping { /** * @param host is the object providing I/O related operations. + * @param log an optional function to output the log * @param fileNames are the file names that belong to the same project * @param projectRootPath is the path to the project root directory - * @param safeListPath is the path used to retrieve the safe list + * @param safeList is the map which can convert file name to library name * @param packageNameToTypingLocation is the map of package names to their cached typing locations and installed versions * @param typeAcquisition is used to customize the typing acquisition process - * @param compilerOptions are used as a source for typing inference + * @param unresolvedImports is the list of unresolved module ids from imports + * @param typesRegistry a map of available typings in npm to maps of TS versions to their latest supported versions */ export function discoverTypings( host: TypingResolutionHost,