import * as ts from 'typescript'; import * as base from './base'; import { TypeDisplayOptions } from './base'; import { Transpiler } from './main'; /** * Prefix to add to a variable name that leaves the JS name referenced * unchanged. */ export declare const DART_RESERVED_NAME_PREFIX = "JS$"; /** * Returns whether or not the given identifier is valid for the type of object it refers to. Certain * reserved keywords cannot ever be used as identifiers. Other keywords, the built-in identifiers, * cannot be used as class or type names, but can be used elsewhere. */ export declare function isValidIdentifier(identifier: ts.DeclarationName | ts.PropertyName): boolean; export declare function identifierCanBeRenamed(identifier: ts.DeclarationName | ts.PropertyName): boolean; /** * Fix TypeScript identifier names that are not valid Dart names by adding JS$ to the start of the * identifier name. */ export declare function fixupIdentifierName(node: ts.DeclarationName | ts.PropertyName): string; export declare class DartLibrary { private fileName; constructor(fileName: string); /** * @returns {boolean} whether the name was added. */ addName(name: string): boolean; private usedNames; } export declare class NameRewriter { private fc; private dartTypes; private libraries; constructor(fc: FacadeConverter); private computeName; lookupName(node: ts.NamedDeclaration, context: ts.Node): string; } export declare class FacadeConverter extends base.TranspilerBase { private generateHTML?; tc: ts.TypeChecker; static DART_RESERVED_WORDS: Set; static DART_BUILT_IN_IDENTIFIERS: Set; private candidateTypes; private typingsRootRegex; private genericMethodDeclDepth; private nameRewriter; emitPromisesAsFutures: boolean; constructor(transpiler: Transpiler, typingsRoot?: string, generateHTML?: boolean); private extractPropertyNames; setTypeChecker(tc: ts.TypeChecker): void; pushTypeParameterNames(n: ts.FunctionLikeDeclaration): void; popTypeParameterNames(n: ts.FunctionLikeDeclaration): void; resolvePropertyTypes(tn: ts.TypeNode): Map; /** * The Dart analyzer has a syntax extension that uses comments to emulate * generic methods in Dart. We work around this and keep track of which type * names in the current scope need to be emitted in comments. * * TODO(jacobr): Remove this once all Dart implementations support generic * methods. */ private isGenericMethodTypeParameterName; generateTypeList(types: ReadonlyArray, options: TypeDisplayOptions, seperator?: string): string; generateDartTypeName(node: ts.TypeNode, options?: TypeDisplayOptions): string; visitTypeName(typeName: ts.EntityName | ts.PropertyName | ts.PropertyAccessExpression): void; getSymbolAtLocation(identifier: ts.EntityName): ts.Symbol; getValueDeclarationOfSymbol(symbol: ts.Symbol, n?: ts.Node): ts.Declaration | undefined; getTypeDeclarationOfSymbol(symbol: ts.Symbol, n?: ts.Node): ts.Declaration | undefined; generateDartName(identifier: ts.EntityName, options: TypeDisplayOptions): string; /** * Resolves TypeReferences to find the declaration of the referenced type that matches the * predicate. * * For example, if the type passed is a reference to X and the predicate passed is * ts.isInterfaceDeclaration, then this function will will return the declaration of interface X, * or undefined if there is no such declaration. */ getDeclarationOfReferencedType(type: ts.TypeReferenceNode, predicate: (declaration: ts.Declaration) => boolean): ts.Declaration; maybeAddTypeArguments(name: string, options: TypeDisplayOptions): string; /** * Returns a custom Dart type name or null if the type isn't a custom Dart type. */ lookupCustomDartTypeName(identifier: ts.EntityName, options?: TypeDisplayOptions): { name?: string; comment?: string; keep?: boolean; }; /** * Looks up an identifier that is used as the name of a value (variable or function). Uses the * name rewriter to fix naming conflicts. * * Returns the original name if it doesn't cause any conflicts, otherwise returns a renamed * identifier. */ lookupDartValueName(identifier: ts.Identifier, options?: TypeDisplayOptions): { name?: string; comment?: string; keep?: boolean; }; /** * This method works around the lack of Dart support for union types * generating a valid Dart type that satisfies all the types passed in. */ toSimpleDartType(types: Array): ts.TypeNode; findCommonType(type: ts.TypeNode, common: ts.TypeNode): ts.TypeNode; toTypeNode(type: ts.Type): ts.TypeNode; createEntityName(symbol: ts.Symbol): ts.EntityName; safeGetBaseTypes(type: ts.InterfaceType): ts.BaseType[]; checkTypeSubtypeOf(source: ts.Type, target: ts.Type): boolean; commonSupertype(nodeA: ts.TypeNode, nodeB: ts.TypeNode): ts.TypeNode; getCommonSupertype(a: ts.Type, b: ts.Type): ts.Type; private getLibFileAndName; }