From 5def1a0a4c3c3b38f90dcd003641832cfc971e79 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 25 Nov 2019 15:20:32 -0800 Subject: [PATCH] Fix up public API --- src/compat/factory.ts | 4 ---- src/compiler/factory/nodeFactory.ts | 1 + src/compiler/types.ts | 17 ++++++----------- .../codefixes/annotateWithTypeFromJSDoc.ts | 2 +- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/compat/factory.ts b/src/compat/factory.ts index b2603b98454..8e2c9f09e25 100644 --- a/src/compat/factory.ts +++ b/src/compat/factory.ts @@ -274,8 +274,6 @@ namespace ts { updateEnumMember, updateSourceFile: updateSourceFileNode, createNotEmittedStatement, - createEndOfDeclarationMarker, - createMergeDeclarationMarker, createPartiallyEmittedExpression, updatePartiallyEmittedExpression, createCommaList, @@ -778,8 +776,6 @@ namespace ts { "createEnumMember", "updateEnumMember", "createNotEmittedStatement", - "createEndOfDeclarationMarker", - "createMergeDeclarationMarker", "createPartiallyEmittedExpression", "updatePartiallyEmittedExpression", "createCommaList", diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 4c9bdafd3f6..937457f82f7 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -5306,6 +5306,7 @@ namespace ts { /** * Gets the transform flags to exclude when unioning the transform flags of a subtree. */ + /* @internal */ export function getTransformFlagsSubtreeExclusions(kind: SyntaxKind) { if (kind >= SyntaxKind.FirstTypeNode && kind <= SyntaxKind.LastTypeNode) { return TransformFlags.TypeExcludes; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 68b45a75ec5..6b05b589e6d 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5198,6 +5198,8 @@ namespace ts { deactivate(): Promise; } + export type CompilerPluginHookResult = PromiseLike | T; + /** * Describes the supported shape of the main module for a compiler plugin. */ @@ -5205,19 +5207,19 @@ namespace ts { /** * The `activate` hook is invoked when a plugin is activated for the first time within a `Program`. */ - activate?(context: CompilerPluginContext, args: CompilerPluginActivationArgs): PromiseLike | CompilerPluginActivationResult | void; + activate?(context: CompilerPluginContext, args: CompilerPluginActivationArgs): CompilerPluginHookResult; /** * The `preParse` hook is invoked when a new `Program` is about to be created before any files are parsed. */ - preParse?(context: CompilerPluginContext, args: CompilerPluginPreParseArgs): PromiseLike | CompilerPluginPreParseResult | void; + preParse?(context: CompilerPluginContext, args: CompilerPluginPreParseArgs): CompilerPluginHookResult; /** * The `preEmit` hook is invoked after type check has completed and immediately before emit. */ - preEmit?(context: CompilerPluginContext, args: CompilerPluginPreEmitArgs): PromiseLike | CompilerPluginPreEmitResult | void; + preEmit?(context: CompilerPluginContext, args: CompilerPluginPreEmitArgs): CompilerPluginHookResult; /** * The `deactivate` hook is invoked when a plugin should be deactivated so that it can free up any shared resources. */ - deactivate?(context: CompilerPluginContext): PromiseLike | void; + deactivate?(context: CompilerPluginContext): CompilerPluginHookResult; } export interface CompilerPluginResult { @@ -5244,13 +5246,6 @@ namespace ts { preprocessors?: ReadonlyArray>; } - export interface CompilerPluginPostCreateProgramArgs { - readonly program: AsyncProgram; - } - - export interface CompilerPluginPostCreateProgramResult extends CompilerPluginResult { - } - export interface CompilerPluginPreEmitArgs { /** The current `Program`. */ readonly program: AsyncProgram; diff --git a/src/services/codefixes/annotateWithTypeFromJSDoc.ts b/src/services/codefixes/annotateWithTypeFromJSDoc.ts index a680af23dfb..384955b1f1f 100644 --- a/src/services/codefixes/annotateWithTypeFromJSDoc.ts +++ b/src/services/codefixes/annotateWithTypeFromJSDoc.ts @@ -91,7 +91,7 @@ namespace ts.codefix { case SyntaxKind.TypeReference: return transformJSDocTypeReference(node as TypeReferenceNode); default: - const visited = visitEachChild(node, transformJSDocType, nullTransformationContext); // TODO: GH#18217 + const visited = visitEachChild(node, transformJSDocType, nullTransformationContext); setEmitFlags(visited, EmitFlags.SingleLine); return visited; }