@polymer/gen-typescript-declarations

  • Version 1.6.2
  • Published
  • 298 kB
  • 19 dependencies
  • BSD-3-Clause license

Install

npm i @polymer/gen-typescript-declarations
yarn add @polymer/gen-typescript-declarations
pnpm add @polymer/gen-typescript-declarations

Overview

Generate TypeScript type declarations for Polymer components.

Index

Functions

function generateDeclarations

generateDeclarations: (
rootDir: string,
config: Config
) => Promise<Map<string, string>>;
  • Analyze all files in the given directory using Polymer Analyzer, and return TypeScript declaration document strings in a map keyed by relative path.

Interfaces

interface Config

interface Config {}
  • Configuration for declaration generation.

property addReferences

addReferences?: {
[filepath: string]: string[];
};
  • Additional files to insert as triple-slash reference statements. Given the map a: b[], a will get an additional reference statement for each file path in b. All paths are relative to the analysis root directory.

property autoImport

autoImport?: {
[modulePath: string]: string[];
};
  • A map from an ES module path (relative to the analysis root directory) to an array of identifiers exported by that module. If any of those identifiers are encountered in a generated typings file, an import for that identifier from the specified module will be inserted into the typings file.

property exclude

exclude?: string[];
  • The same as excludeFiles, for backwards compatibility. Will be removed in next major version.

property excludeFiles

excludeFiles?: string[];
  • Skip source files whose paths match any of these glob patterns. If undefined, defaults to excluding "index.html" and directories ending in "test" or "demo".

property excludeIdentifiers

excludeIdentifiers?: string[];
  • Do not emit any declarations for features that have any of these identifiers.

property googModules

googModules?: boolean;
  • If true, outputs declarations in 'goog:' modules instead of using simple ES modules. This is a temporary hack to account for how modules are resolved for TypeScript inside google3. This is probably not at all useful for anyone but the Polymer team.

property hideWarnings

hideWarnings?: boolean;
  • If true, does not log warnings detected when analyzing code, only diagnostics of Error severity.

property removeReferences

removeReferences?: string[];
  • Remove any triple-slash references to these files, specified as paths relative to the analysis root directory.

property renameTypes

renameTypes?: {
[name: string]: string;
};
  • Whenever a type with a name in this map is encountered, replace it with the given name. Note this only applies to named types found in places like function/method parameters and return types. It does not currently rename e.g. entire generated classes.

Package Files (1)

Dependencies (19)

Dev Dependencies (3)

Peer Dependencies (0)

No peer dependencies.

Badge

To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@polymer/gen-typescript-declarations.

  • Markdown
    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@polymer/gen-typescript-declarations)
  • HTML
    <a href="https://www.jsdocs.io/package/@polymer/gen-typescript-declarations"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>