Migrate additional Node/Symbol/etc. methods from services to compiler

This commit is contained in:
Ron Buckton
2024-04-05 20:16:20 -04:00
parent 6caf908605
commit 77ac7533f9
4 changed files with 196 additions and 282 deletions

View File

@@ -13,13 +13,13 @@ import {
IntersectionType,
isThisTypeParameter,
JSDocSignature,
JSDocTagInfo,
LineAndCharacter,
LiteralType,
Node,
NumberLiteralType,
ObjectFlags,
ObjectType,
ServicesForwardRefArray,
Signature,
SignatureDeclaration,
SignatureFlags,
@@ -27,6 +27,7 @@ import {
SourceMapSource,
StringLiteralType,
Symbol,
SymbolDisplayPart,
SymbolFlags,
SymbolLinks,
symbolName,
@@ -97,20 +98,20 @@ export class SymbolObject implements Symbol {
return this.declarations;
}
getDocumentationComment(_checker: TypeChecker | undefined): ServicesForwardRefArray<"SymbolDisplayPart"> {
throw new TypeError("Not supported");
getDocumentationComment(_checker: TypeChecker | undefined): SymbolDisplayPart[] {
throw new TypeError("Not implemented.");
}
getContextualDocumentationComment(_context: Node | undefined, _checker: TypeChecker | undefined): ServicesForwardRefArray<"SymbolDisplayPart"> {
throw new TypeError("Not supported");
getContextualDocumentationComment(_context: Node | undefined, _checker: TypeChecker | undefined): SymbolDisplayPart[] {
throw new TypeError("Not implemented.");
}
getJsDocTags(_checker?: TypeChecker): ServicesForwardRefArray<"JSDocTagInfo"> {
throw new TypeError("Not supported");
getJsDocTags(_checker?: TypeChecker): JSDocTagInfo[] {
throw new TypeError("Not implemented.");
}
getContextualJsDocTags(_context: Node | undefined, _checker: TypeChecker | undefined): ServicesForwardRefArray<"JSDocTagInfo"> {
throw new TypeError("Not supported");
getContextualJsDocTags(_context: Node | undefined, _checker: TypeChecker | undefined): JSDocTagInfo[] {
throw new TypeError("Not implemented.");
}
}
@@ -308,11 +309,11 @@ export class SignatureObject implements Signature {
return type;
}
getDocumentationComment(): ServicesForwardRefArray<"SymbolDisplayPart"> {
getDocumentationComment(): SymbolDisplayPart[] {
throw new TypeError("Not implemented");
}
getJsDocTags(): ServicesForwardRefArray<"JSDocTagInfo"> {
getJsDocTags(): JSDocTagInfo[] {
throw new TypeError("Not implemented");
}
}

View File

@@ -934,6 +934,31 @@ export interface Node extends ReadonlyTextRange {
// `locals` and `nextContainer` have been moved to `LocalsContainer`
// `flowNode` has been moved to `FlowContainer`
// see: https://github.com/microsoft/TypeScript/pull/51682
getSourceFile(): SourceFile;
getChildCount(sourceFile?: SourceFile): number;
getChildAt(index: number, sourceFile?: SourceFile): Node;
getChildren(sourceFile?: SourceFile): readonly Node[];
/** @internal */
getChildren(sourceFile?: SourceFileLike): readonly Node[]; // eslint-disable-line @typescript-eslint/unified-signatures
getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number;
/** @internal */
getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number; // eslint-disable-line @typescript-eslint/unified-signatures
getFullStart(): number;
getEnd(): number;
getWidth(sourceFile?: SourceFileLike): number;
getFullWidth(): number;
getLeadingTriviaWidth(sourceFile?: SourceFile): number;
getFullText(sourceFile?: SourceFile): string;
getText(sourceFile?: SourceFile): string;
getFirstToken(sourceFile?: SourceFile): Node | undefined;
/** @internal */
getFirstToken(sourceFile?: SourceFileLike): Node | undefined; // eslint-disable-line @typescript-eslint/unified-signatures
getLastToken(sourceFile?: SourceFile): Node | undefined;
/** @internal */
getLastToken(sourceFile?: SourceFileLike): Node | undefined; // eslint-disable-line @typescript-eslint/unified-signatures
// See ts.forEachChild for documentation.
forEachChild<T>(cbNode: (node: Node) => T | undefined, cbNodeArray?: (nodes: NodeArray<Node>) => T | undefined): T | undefined;
}
export interface JSDocContainer extends Node {
@@ -1677,6 +1702,7 @@ export interface Identifier extends PrimaryExpression, Declaration, JSDocContain
* Text of identifier, but if the identifier begins with two underscores, this will begin with three.
*/
readonly escapedText: __String;
readonly text: string;
}
// Transient identifier node (marked by id === -1)
@@ -1770,6 +1796,7 @@ export interface PrivateIdentifier extends PrimaryExpression {
// escaping not strictly necessary
// avoids gotchas in transforms and utils
readonly escapedText: __String;
readonly text: string;
}
/** @internal */
@@ -4212,6 +4239,7 @@ export interface SourceFileLike {
lineMap?: readonly number[];
/** @internal */
getPositionOfLineAndCharacter?(line: number, character: number, allowEdits?: true): number;
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
}
/** @internal */
@@ -4371,6 +4399,18 @@ export interface SourceFile extends Declaration, LocalsContainer {
/** @internal */ endFlowNode?: FlowNode;
/** @internal */ jsDocParsingMode?: JSDocParsingMode;
/** @internal */ scriptSnapshot: IScriptSnapshot | undefined;
/** @internal */ nameTable: Map<__String, number> | undefined;
/** @internal */ sourceMapper?: DocumentPositionMapper;
/** @internal */ getNamedDeclarations(): Map<string, readonly Declaration[]>;
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
getLineEndOfPosition(pos: number): number;
getLineStarts(): readonly number[];
getPositionOfLineAndCharacter(line: number, character: number): number;
update(newText: string, textChangeRange: TextChangeRange): SourceFile;
}
/**
@@ -5791,6 +5831,45 @@ export const enum SymbolFlags {
LateBindingContainer = Class | Interface | TypeLiteral | ObjectLiteral | Function,
}
export interface SymbolDisplayPart {
/**
* Text of an item describing the symbol.
*/
text: string;
/**
* The symbol's kind (such as 'className' or 'parameterName' or plain 'text').
*/
kind: string;
}
export interface DocumentSpan {
textSpan: TextSpan;
fileName: string;
/**
* If the span represents a location that was remapped (e.g. via a .d.ts.map file),
* then the original filename and span will be specified here
*/
originalTextSpan?: TextSpan;
originalFileName?: string;
/**
* If DocumentSpan.textSpan is the span for name of the declaration,
* then this is the span for relevant declaration
*/
contextSpan?: TextSpan;
originalContextSpan?: TextSpan;
}
export interface JSDocLinkDisplayPart extends SymbolDisplayPart {
target: DocumentSpan;
}
export interface JSDocTagInfo {
name: string;
text?: SymbolDisplayPart[];
}
/** @internal */
export type SymbolId = number;
@@ -5812,6 +5891,18 @@ export interface Symbol {
/** @internal */ lastAssignmentPos?: number; // Source position of last node that assigns value to symbol
/** @internal */ isReplaceableByMethod?: boolean; // Can this Javascript class property be replaced by a method symbol?
/** @internal */ assignmentDeclarationMembers?: Map<number, Declaration>; // detected late-bound assignment declarations associated with the symbol
readonly name: string;
getFlags(): SymbolFlags;
getEscapedName(): __String;
getName(): string;
getDeclarations(): Declaration[] | undefined;
getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; // implemented in services, not supported in tsc.
/** @internal */
getContextualDocumentationComment(context: Node | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[]; // implemented in services, not supported in tsc.
getJsDocTags(checker?: TypeChecker): JSDocTagInfo[]; // implemented in services, not supported in tsc.
/** @internal */
getContextualJsDocTags(context: Node | undefined, checker: TypeChecker | undefined): JSDocTagInfo[]; // implemented in services, not supported in tsc.
}
// dprint-ignore
@@ -6190,6 +6281,32 @@ export interface Type {
immediateBaseConstraint?: Type; // Immediate base constraint cache
/** @internal */
widened?: Type; // Cached widened form of the type
getFlags(): TypeFlags;
getSymbol(): Symbol | undefined;
getProperties(): Symbol[];
getProperty(propertyName: string): Symbol | undefined;
getApparentProperties(): Symbol[];
getCallSignatures(): readonly Signature[];
getConstructSignatures(): readonly Signature[];
getStringIndexType(): Type | undefined;
getNumberIndexType(): Type | undefined;
getBaseTypes(): BaseType[] | undefined;
getNonNullableType(): Type;
/** @internal */ getNonOptionalType(): Type;
/** @internal */ isNullableType(): boolean;
getConstraint(): Type | undefined;
getDefault(): Type | undefined;
isUnion(): this is UnionType;
isIntersection(): this is IntersectionType;
isUnionOrIntersection(): this is UnionOrIntersectionType;
isLiteral(): this is LiteralType;
isStringLiteral(): this is StringLiteralType;
isNumberLiteral(): this is NumberLiteralType;
isTypeParameter(): this is TypeParameter;
isClassOrInterface(): this is InterfaceType;
isClass(): this is InterfaceType;
isIndexType(): this is IndexType;
}
/** @internal */
@@ -6391,6 +6508,8 @@ export interface TypeReference extends ObjectType {
literalType?: TypeReference; // Clone of type with ObjectFlags.ArrayLiteral set
/** @internal */
cachedEquivalentBaseType?: Type; // Only set on references to class or interfaces with a single base type and no augmentations
readonly typeArguments?: readonly Type[];
}
export interface DeferredTypeReference extends TypeReference {
@@ -6796,6 +6915,14 @@ export interface Signature {
instantiations?: Map<string, Signature>; // Generic signature instantiation cache
/** @internal */
implementationSignatureCache?: Signature; // Copy of the signature with fresh type parameters to use in checking the body of a potentially self-referential generic function (deferred)
getDeclaration(): JSDocSignature | SignatureDeclaration;
getTypeParameters(): readonly TypeParameter[] | undefined;
getParameters(): readonly Symbol[];
getTypeParameterAtPosition(pos: number): Type;
getReturnType(): Type;
getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; // implemented in services, not supported in tsc.
getJsDocTags(): JSDocTagInfo[]; // implemented in services, not supported in tsc.
}
export const enum IndexKind {
@@ -7994,6 +8121,7 @@ export interface SourceMapSource {
text: string;
/** @internal */ lineMap: readonly number[];
skipTrivia?: (pos: number) => number;
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
}
/** @internal */
@@ -10141,30 +10269,3 @@ export interface EvaluationResolver {
evaluateEntityNameExpression(expr: EntityNameExpression, location: Declaration | undefined): EvaluatorResult;
evaluateElementAccessExpression(expr: ElementAccessExpression, location: Declaration | undefined): EvaluatorResult;
}
/**
* Resolves to a type only when the 'services' project is loaded. Otherwise, results in `never`.
* @internal
*/
export type ServicesOnlyType<T, Fallback = never> = ServicesForwardRefs extends { __services: true; } ? T : Fallback;
/**
* Resolves a forward-reference to a type declared in the 'services' project.
* If 'services' is not present, results in `never`.
* @internal
*/
export type ServicesForwardRef<K extends string> = ServicesForwardRefs extends { [P in K]: infer T; } ? T : never;
/**
* Resolves a forward-reference to an array of a type declared in the 'services' project.
* If 'services' is not present, results in `never`.
* @internal
*/
export type ServicesForwardRefArray<K extends string> = ServicesOnlyType<ServicesForwardRef<K>[]>;
/**
* A registry of forward references declared in the 'services' project.
* @internal
*/
export interface ServicesForwardRefs {
}

View File

@@ -265,9 +265,8 @@ import * as classifier2020 from "./classifier2020";
/** The version of the language service API */
export const servicesVersion = "0.8";
// TODO: Move SymbolInternals to compiler
// Patch Symbol for use with services.
interface SymbolInternals {
// Extra fields added by services are stored in a WeakMap
interface SymbolExtraFields {
// Undefined is used to indicate the value has not been computed. If, after computing, the
// symbol has no doc comment, then the empty array will be returned.
documentationComment?: SymbolDisplayPart[];
@@ -280,88 +279,96 @@ interface SymbolInternals {
contextualSetAccessorTags?: JSDocTagInfo[];
}
ObjectConstructors.SymbolObject.prototype.getDocumentationComment = function (this: (Symbol | TransientSymbol) & SymbolInternals, checker: TypeChecker | undefined): SymbolDisplayPart[] {
if (!this.documentationComment) {
this.documentationComment = emptyArray; // Set temporarily to avoid an infinite loop finding inherited docs
const symbolExtraFields = new WeakMap<Symbol, SymbolExtraFields>();
function ensureSymbolExtraFields(symbol: Symbol) {
let extra = symbolExtraFields.get(symbol);
if (!extra) symbolExtraFields.set(symbol, extra = {});
return extra;
}
ObjectConstructors.SymbolObject.prototype.getDocumentationComment = function (this: Symbol | TransientSymbol, checker: TypeChecker | undefined): SymbolDisplayPart[] {
const extra = ensureSymbolExtraFields(this);
if (!extra.documentationComment) {
extra.documentationComment = emptyArray; // Set temporarily to avoid an infinite loop finding inherited docs
if (!this.declarations && isTransientSymbol(this) && this.links.target && isTransientSymbol(this.links.target) && this.links.target.links.tupleLabelDeclaration) {
const labelDecl = this.links.target.links.tupleLabelDeclaration;
this.documentationComment = getDocumentationComment([labelDecl], checker);
extra.documentationComment = getDocumentationComment([labelDecl], checker);
}
else {
this.documentationComment = getDocumentationComment(this.declarations, checker);
extra.documentationComment = getDocumentationComment(this.declarations, checker);
}
}
return this.documentationComment;
return extra.documentationComment;
};
ObjectConstructors.SymbolObject.prototype.getContextualDocumentationComment = function (this: Symbol & SymbolInternals, context: Node | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[] {
ObjectConstructors.SymbolObject.prototype.getContextualDocumentationComment = function (this: Symbol, context: Node | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[] {
if (context) {
const extra = ensureSymbolExtraFields(this);
if (isGetAccessor(context)) {
if (!this.contextualGetAccessorDocumentationComment) {
this.contextualGetAccessorDocumentationComment = getDocumentationComment(filter(this.declarations, isGetAccessor), checker);
}
if (length(this.contextualGetAccessorDocumentationComment)) {
return this.contextualGetAccessorDocumentationComment;
extra.contextualGetAccessorDocumentationComment ??= getDocumentationComment(filter(this.declarations, isGetAccessor), checker);
if (length(extra.contextualGetAccessorDocumentationComment)) {
return extra.contextualGetAccessorDocumentationComment;
}
}
if (isSetAccessor(context)) {
if (!this.contextualSetAccessorDocumentationComment) {
this.contextualSetAccessorDocumentationComment = getDocumentationComment(filter(this.declarations, isSetAccessor), checker);
}
if (length(this.contextualSetAccessorDocumentationComment)) {
return this.contextualSetAccessorDocumentationComment;
else if (isSetAccessor(context)) {
extra.contextualSetAccessorDocumentationComment ??= getDocumentationComment(filter(this.declarations, isSetAccessor), checker);
if (length(extra.contextualSetAccessorDocumentationComment)) {
return extra.contextualSetAccessorDocumentationComment;
}
}
}
return this.getDocumentationComment(checker);
};
ObjectConstructors.SymbolObject.prototype.getJsDocTags = function (this: Symbol & SymbolInternals, checker?: TypeChecker): JSDocTagInfo[] {
if (this.tags === undefined) {
this.tags = getJsDocTagsOfDeclarations(this.declarations, checker);
}
return this.tags;
ObjectConstructors.SymbolObject.prototype.getJsDocTags = function (this: Symbol, checker?: TypeChecker): JSDocTagInfo[] {
const extra = ensureSymbolExtraFields(this);
return extra.tags ??= getJsDocTagsOfDeclarations(this.declarations, checker);
};
ObjectConstructors.SymbolObject.prototype.getContextualJsDocTags = function (this: Symbol & SymbolInternals, context: Node | undefined, checker: TypeChecker | undefined): JSDocTagInfo[] {
ObjectConstructors.SymbolObject.prototype.getContextualJsDocTags = function (this: Symbol, context: Node | undefined, checker: TypeChecker | undefined): JSDocTagInfo[] {
if (context) {
const extra = ensureSymbolExtraFields(this);
if (isGetAccessor(context)) {
if (!this.contextualGetAccessorTags) {
this.contextualGetAccessorTags = getJsDocTagsOfDeclarations(filter(this.declarations, isGetAccessor), checker);
}
if (length(this.contextualGetAccessorTags)) {
return this.contextualGetAccessorTags;
extra.contextualGetAccessorTags ??= getJsDocTagsOfDeclarations(filter(this.declarations, isGetAccessor), checker);
if (length(extra.contextualGetAccessorTags)) {
return extra.contextualGetAccessorTags;
}
}
if (isSetAccessor(context)) {
if (!this.contextualSetAccessorTags) {
this.contextualSetAccessorTags = getJsDocTagsOfDeclarations(filter(this.declarations, isSetAccessor), checker);
}
if (length(this.contextualSetAccessorTags)) {
return this.contextualSetAccessorTags;
else if (isSetAccessor(context)) {
extra.contextualSetAccessorTags ??= getJsDocTagsOfDeclarations(filter(this.declarations, isSetAccessor), checker);
if (length(extra.contextualSetAccessorTags)) {
return extra.contextualSetAccessorTags;
}
}
}
return this.getJsDocTags(checker);
};
// TODO: Move SignatureInternals to compiler
interface SignatureInternals {
interface SignatureExtraFields {
// Undefined is used to indicate the value has not been computed. If, after computing, the
// symbol has no doc comment, then the empty array will be returned.
documentationComment?: SymbolDisplayPart[];
jsDocTags?: JSDocTagInfo[]; // same
}
ObjectConstructors.SignatureObject.prototype.getDocumentationComment = function (this: Signature & SignatureInternals): SymbolDisplayPart[] {
return this.documentationComment || (this.documentationComment = getDocumentationComment(singleElementArray(this.declaration), this.checker));
const signatureExtraFields = new WeakMap<Signature, SignatureExtraFields>();
function ensureSignatureExtraFields(signature: Signature) {
let extra = signatureExtraFields.get(signature);
if (!extra) signatureExtraFields.set(signature, extra = {});
return extra;
}
ObjectConstructors.SignatureObject.prototype.getDocumentationComment = function (this: Signature): SymbolDisplayPart[] {
const extra = ensureSignatureExtraFields(this);
return extra.documentationComment ??= getDocumentationComment(singleElementArray(this.declaration), this.checker);
};
ObjectConstructors.SignatureObject.prototype.getJsDocTags = function (this: Signature & SignatureInternals): JSDocTagInfo[] {
return this.jsDocTags || (this.jsDocTags = getJsDocTagsOfDeclarations(singleElementArray(this.declaration), this.checker));
ObjectConstructors.SignatureObject.prototype.getJsDocTags = function (this: Signature): JSDocTagInfo[] {
const extra = ensureSignatureExtraFields(this);
return extra.jsDocTags ??= getJsDocTagsOfDeclarations(singleElementArray(this.declaration), this.checker);
};
/**

View File

@@ -7,6 +7,7 @@ import {
DiagnosticWithLocation,
DocumentHighlights,
DocumentPositionMapper,
DocumentSpan,
EmitOutput,
ExportInfoMap,
ExportMapInfoKey,
@@ -16,6 +17,7 @@ import {
HasInvalidatedResolutions,
IScriptSnapshot,
JSDocParsingMode,
JSDocTagInfo,
LineAndCharacter,
MinimalResolutionCacheHost,
ModuleResolutionCache,
@@ -36,6 +38,7 @@ import {
SourceMapper,
StringLiteralLike,
Symbol,
SymbolDisplayPart,
SymlinkCache,
TextChangeRange,
textChanges,
@@ -44,165 +47,6 @@ import {
UserPreferences,
} from "./_namespaces/ts";
declare module "../compiler/types" {
/**
* A registry of forward references declared in the 'services' project.
* @internal
*/
export interface ServicesForwardRefs {
__services: true;
SymbolDisplayPart: SymbolDisplayPart;
JSDocTagInfo: JSDocTagInfo;
}
}
declare module "../compiler/types" {
// Module transform: converted from interface augmentation
export interface Node {
getSourceFile(): SourceFile;
getChildCount(sourceFile?: SourceFile): number;
getChildAt(index: number, sourceFile?: SourceFile): Node;
getChildren(sourceFile?: SourceFile): readonly Node[];
/** @internal */
getChildren(sourceFile?: SourceFileLike): readonly Node[]; // eslint-disable-line @typescript-eslint/unified-signatures
getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number;
/** @internal */
getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number; // eslint-disable-line @typescript-eslint/unified-signatures
getFullStart(): number;
getEnd(): number;
getWidth(sourceFile?: SourceFileLike): number;
getFullWidth(): number;
getLeadingTriviaWidth(sourceFile?: SourceFile): number;
getFullText(sourceFile?: SourceFile): string;
getText(sourceFile?: SourceFile): string;
getFirstToken(sourceFile?: SourceFile): Node | undefined;
/** @internal */
getFirstToken(sourceFile?: SourceFileLike): Node | undefined; // eslint-disable-line @typescript-eslint/unified-signatures
getLastToken(sourceFile?: SourceFile): Node | undefined;
/** @internal */
getLastToken(sourceFile?: SourceFileLike): Node | undefined; // eslint-disable-line @typescript-eslint/unified-signatures
// See ts.forEachChild for documentation.
forEachChild<T>(cbNode: (node: Node) => T | undefined, cbNodeArray?: (nodes: NodeArray<Node>) => T | undefined): T | undefined;
}
}
declare module "../compiler/types" {
// Module transform: converted from interface augmentation
export interface Identifier {
readonly text: string;
}
}
declare module "../compiler/types" {
// Module transform: converted from interface augmentation
export interface PrivateIdentifier {
readonly text: string;
}
}
declare module "../compiler/types" {
// Module transform: converted from interface augmentation
export interface Symbol {
readonly name: string;
getFlags(): SymbolFlags;
getEscapedName(): __String;
getName(): string;
getDeclarations(): Declaration[] | undefined;
getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[];
/** @internal */
getContextualDocumentationComment(context: Node | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[];
getJsDocTags(checker?: TypeChecker): JSDocTagInfo[];
/** @internal */
getContextualJsDocTags(context: Node | undefined, checker: TypeChecker | undefined): JSDocTagInfo[];
}
}
declare module "../compiler/types" {
// Module transform: converted from interface augmentation
export interface Type {
getFlags(): TypeFlags;
getSymbol(): Symbol | undefined;
getProperties(): Symbol[];
getProperty(propertyName: string): Symbol | undefined;
getApparentProperties(): Symbol[];
getCallSignatures(): readonly Signature[];
getConstructSignatures(): readonly Signature[];
getStringIndexType(): Type | undefined;
getNumberIndexType(): Type | undefined;
getBaseTypes(): BaseType[] | undefined;
getNonNullableType(): Type;
/** @internal */ getNonOptionalType(): Type;
/** @internal */ isNullableType(): boolean;
getConstraint(): Type | undefined;
getDefault(): Type | undefined;
isUnion(): this is UnionType;
isIntersection(): this is IntersectionType;
isUnionOrIntersection(): this is UnionOrIntersectionType;
isLiteral(): this is LiteralType;
isStringLiteral(): this is StringLiteralType;
isNumberLiteral(): this is NumberLiteralType;
isTypeParameter(): this is TypeParameter;
isClassOrInterface(): this is InterfaceType;
isClass(): this is InterfaceType;
isIndexType(): this is IndexType;
}
}
declare module "../compiler/types" {
// Module transform: converted from interface augmentation
export interface TypeReference {
typeArguments?: readonly Type[];
}
}
declare module "../compiler/types" {
// Module transform: converted from interface augmentation
export interface Signature {
getDeclaration(): JSDocSignature | SignatureDeclaration;
getTypeParameters(): readonly TypeParameter[] | undefined;
getParameters(): readonly Symbol[];
getTypeParameterAtPosition(pos: number): Type;
getReturnType(): Type;
getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[];
getJsDocTags(): JSDocTagInfo[];
}
}
declare module "../compiler/types" {
// Module transform: converted from interface augmentation
export interface SourceFile {
/** @internal */ version: string;
/** @internal */ scriptSnapshot: IScriptSnapshot | undefined;
/** @internal */ nameTable: Map<__String, number> | undefined;
/** @internal */ getNamedDeclarations(): Map<string, readonly Declaration[]>;
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
getLineEndOfPosition(pos: number): number;
getLineStarts(): readonly number[];
getPositionOfLineAndCharacter(line: number, character: number): number;
update(newText: string, textChangeRange: TextChangeRange): SourceFile;
/** @internal */ sourceMapper?: DocumentPositionMapper;
}
}
declare module "../compiler/types" {
// Module transform: converted from interface augmentation
export interface SourceFileLike {
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
}
}
declare module "../compiler/types" {
// Module transform: converted from interface augmentation
export interface SourceMapSource {
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
}
}
export namespace ScriptSnapshot {
class StringScriptSnapshot implements IScriptSnapshot {
constructor(private text: string) {
@@ -1023,25 +867,6 @@ export interface TextInsertion {
caretOffset: number;
}
export interface DocumentSpan {
textSpan: TextSpan;
fileName: string;
/**
* If the span represents a location that was remapped (e.g. via a .d.ts.map file),
* then the original filename and span will be specified here
*/
originalTextSpan?: TextSpan;
originalFileName?: string;
/**
* If DocumentSpan.textSpan is the span for name of the declaration,
* then this is the span for relevant declaration
*/
contextSpan?: TextSpan;
originalContextSpan?: TextSpan;
}
export interface RenameLocation extends DocumentSpan {
readonly prefixText?: string;
readonly suffixText?: string;
@@ -1252,26 +1077,6 @@ export enum SymbolDisplayPartKind {
linkText,
}
export interface SymbolDisplayPart {
/**
* Text of an item describing the symbol.
*/
text: string;
/**
* The symbol's kind (such as 'className' or 'parameterName' or plain 'text').
*/
kind: string;
}
export interface JSDocLinkDisplayPart extends SymbolDisplayPart {
target: DocumentSpan;
}
export interface JSDocTagInfo {
name: string;
text?: SymbolDisplayPart[];
}
export interface QuickInfo {
kind: ScriptElementKind;
kindModifiers: string;