Home

Awesome


Warning

This repository is no longer being maintained and is archived.

For details on how to write interop interfaces using package:js, please visit the package:js pub page or the Dart documentation for JS interop. The Dart team is working on improving JS interop in the future to make writing such interfaces easier. If there is interest in continuing this repository, feel free to contribute by forking.


Generates package:js JavaScript interop facades for arbitrary TypeScript libraries.

Installation

Usage

Basic

dart_js_facade_gen <input d.ts file><br> Dart interop facade file is written to stdout.

Advanced

dart_js_facade_gen --destination=<destination-dir> --base-path=<input d.ts file directory> <input d.ts file> <input d.ts file> ...

Flags

--destination=<destination-dir>: Output generated code to destination-dir.<br> --base-path=<input d.ts file directory>: Specify the directory that contains the input d.ts files.<br> --skip-formatting: Skips running dart-format on the output. This is useful for large files (like dom.d.ts) since the node package version of dart-format is significantly slower than the version in the SDK.<br> --generate-html: Generate facades for dart:html types rather than importing them.<br> --rename-conflicting-types: Rename types to avoid conflicts in cases where a variable and a type have the exact same name, but it is not clear if they are related or not.<br> --explicit-static: Disables default assumption that properties declared on the anonymous types of top level variable declarations are static.<br> --trust-js-types: Emits @anonymous tags on classes that have neither constructors nor static members. This prevents the Dart Dev Compiler from checking whether or not objects are truly instances of those classes. This flag should be used if the input JS/TS library has structural types, or is otherwise claiming that types match in cases where the correct JS prototype is not there for DDC to check against.

Example

dart_js_facade_gen --destination=/usr/foo/tmp/chartjs/lib --base-path=/usr/foo/git/DefinitelyTyped/chartjs /usr/foo/git/DefinitelyTyped/chartjs/chart.d.ts

Gulp tasks

Publish