All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- Generate typings for class constructors.
- Add
@ts-ignore
comment if method contains@suppress {checkTypes}
in jsdoc.
- Fix bad file path handling which broke Windows support.
- Fix bug where if a package name was a prefix of one of its dependencies (e.g.
iron-icons
depends oniron-iconset-svg
), then<reference>
statements to include that dependency's typings would not be emitted (via Polymer/polymer-analyzer#902).
- Functions which definitely never return a value will now be automatically
inferred as returning
void
. - Getters on Polymer elements defined with the legacy Polymer function are now scanned correctly (previously type annotations were missing, and the readonly bit was inverted.
- Mixin functions now include all of the additional mixins they automatically apply. Previously, only the immediately applied mixins were accounted for, but not ones that were applied transitively.
- Elements that are constructable (usually a call to the Polymer function whose result is assigned to some variable) can now have behaviors.
- The
--deleteExisting
command line flag will no longer delete.d.ts
files that are referenced as values in theaddReferences
config option, since such files are typically hand-written.
- Fix missing
glob
dependency.
- Added
excludeIdentifiers
config option. Use this to skip emitting any declarations for some feature by its class name, etc. - Renamed
exclude
config option toexcludeFiles
to disambiguate it fromexcludeIdentifiers
.exclude
still works as before for backwards compatibility, but will be removed in the next major version. - Polymer behavior interfaces now extend any additional behaviors that they apply. This is done with an array of behavior objects as documented at https://www.polymer-project.org/1.0/docs/devguide/behaviors#extending.
- Added
--deleteExisting
command line flag (default false) which recursively deletes all.d.ts
files in the output directory before writing new typings, excludingnode_modules/
andbower_components/
.
- Always parameterize
Promise
. In ClosurePromise
is valid, but in TypeScript this is invalid and must bePromise<any>
instead. - Escape
*\
comment end sequences when formatting comments. These turn up in practice when an HTML comment embeds a JavaScript style block comment, like here: https://github.com/PolymerElements/paper-icon-button/blob/master/paper-icon-button.html#L51 - Hybrid Polymer elements without a LHS assignment now have
Element
appended to their generated interface name, to match the behavior of the Closure Polymer Pass (https://github.com/google/closure-compiler/wiki/Polymer-Pass#element-type-names-for-1xhybrid-call-syntax). For example,interface IronRequest
is nowinterface IronRequestElement
. - Typings are now emitted for all HTML files, even if they contain no script
tags. Added
index.html
to the defaultexclude
set (alongside the existingtest/**
anddemo/**
globs).
- [BREAKING] The
--outDir
flag is now required when using the command line tool. Previously it would print all concatenated typings tostdout
, which doesn't make much sense given that we emit multiple files. - Rewrite triple-slash references to Polymer into the
types/
directory so that they resolve correctly. Polymer is a special case where we put the typings in atypes/
subdirectory in order not to clutter the repo. - Emit a
const FooBehavior: object
for behaviors. This lets TypeScript know that e.g.Polymer.AppLocalizeBehavior
is a valid symbol that could be passed, for example, to thePolymer.mixinBehaviors
function.
- Support parameterized types other than
Array
andObject
, such asFoo<T>
.
- Properties are now emitted as
readonly
when applicable. - Bump Analyzer for latest scanning features (getters/setters, static methods, methods/properties on class prototypes).
- Handle optional and rest parameters in function type expressions.
- Pin Analyzer version for upcoming major refactor.
- Static methods are now supported on classes, elements, and mixins.
- Add
renameTypes
config option, a map of renames to apply to named types that can be configured per-project. - Convert Closure
ITemplateArray
type to TypeScriptTemplateStringsArray
. - Support object index signatures (e.g.
Object<foo, bar>
maps to{[key: foo]: bar}
).
- Convert Closure
Object
to TypeScriptobject
. - Use glob patterns instead of RegExps to exclude files.
- Bump Analyzer version to include
Polymer/polymer-analyzer#791 which makes Polymer
properties possibly
null|undefined
.
void
is not nullable.- Support constructor functions (e.g.
function(new:HTMLElement, string)
). - Support record types (e.g.
@param {{foo: bar}}
). - Include method
@return
descriptions.
- Many fixes. See https://github.com/Polymer/gen-typescript-declarations/issues/23.
- Initial release on NPM.