All Projects → BowlerHatLLC → dts2as

BowlerHatLLC / dts2as

Licence: Apache-2.0 license
Convert TypeScript definitions (d.ts files) into ActionScript classes and interfaces for use as external libraries with Apache FlexJS

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to dts2as

Aleph.js
The Full-stack Framework in Deno.
Stars: ✭ 3,448 (+9218.92%)
Mutual labels:  swc
carbon-components-svelte
Svelte implementation of the Carbon Design System
Stars: ✭ 1,615 (+4264.86%)
Mutual labels:  typescript-definitions
Type Fest
A collection of essential TypeScript types
Stars: ✭ 6,623 (+17800%)
Mutual labels:  typescript-definitions
kahi-ui
Straight-forward Svelte UI for the Web
Stars: ✭ 169 (+356.76%)
Mutual labels:  typescript-definitions
TypeScript-Library-Checklist
Your pre-launch checklist.
Stars: ✭ 19 (-48.65%)
Mutual labels:  typescript-definitions
sveld
Generate TypeScript definitions for your Svelte components
Stars: ✭ 281 (+659.46%)
Mutual labels:  typescript-definitions
swc-loader
Webpack plugin for swc
Stars: ✭ 245 (+562.16%)
Mutual labels:  swc
google-api-typings-generator
Updated and fixed version of TypeScript typings for Google APIs generator
Stars: ✭ 42 (+13.51%)
Mutual labels:  typescript-definitions
dts-jest
A preprocessor for Jest to snapshot test TypeScript declaration (.d.ts) files
Stars: ✭ 102 (+175.68%)
Mutual labels:  typescript-definitions
svelte-intersection-observer
Detect if an element is in the viewport using the Intersection Observer API
Stars: ✭ 151 (+308.11%)
Mutual labels:  typescript-definitions
mxgraph-road-to-DefinitelyTyped
Community effort followup to provide mxgraph TypeScript type definitions / typings via DefinitelyTyped
Stars: ✭ 23 (-37.84%)
Mutual labels:  typescript-definitions
svelte-typeahead
Accessible, fuzzy search typeahead component
Stars: ✭ 141 (+281.08%)
Mutual labels:  typescript-definitions
types
TypeScript Type Definitions same as DefinitelyTyped.
Stars: ✭ 31 (-16.22%)
Mutual labels:  typescript-definitions
orkid-node
Reliable and modern Redis Streams based task queue for Node.js 🤖
Stars: ✭ 61 (+64.86%)
Mutual labels:  typescript-definitions
Definitelytyped
The repository for high quality TypeScript type definitions.
Stars: ✭ 37,066 (+100078.38%)
Mutual labels:  typescript-definitions
Swc
swc is a super-fast compiler written in rust; producing widely-supported javascript from modern standards and typescript.
Stars: ✭ 18,627 (+50243.24%)
Mutual labels:  swc
webgpu-seed
🔺🌱 An example on how to render a hello triangle with WebGPU.
Stars: ✭ 178 (+381.08%)
Mutual labels:  typescript-definitions
cli
CLI for swc
Stars: ✭ 87 (+135.14%)
Mutual labels:  swc
rc
Structured system configuration (I moved from NixOS to GuixSD)
Stars: ✭ 97 (+162.16%)
Mutual labels:  swc
ember-typings
Typescript type definitions for ember.js
Stars: ✭ 13 (-64.86%)
Mutual labels:  typescript-definitions

dts2as

Note: This project is no longer under active development. Use at your own risk.

A command line utility that converts TypeScript definitions (d.ts files) to ActionScript classes and interfaces and generates a SWC file. Use these SWCs with Apache FlexJS for strict compile-time type checking, as if the JavaScript library were written in ActionScript. You can add the SWCs to IDEs, like Visual Studio Code, Flash Builder, or IntelliJ IDEA, and you'll get helpful code suggestions as you type.

Installation

Requires Node.js.

npm install -g dts2as

Usage

dts2as hello.d.ts
dts2as file1.d.ts file2.d.ts
dts2as --outSWC hello.swc hello.d.ts
dts2as --outDir ./as3-files file.d.ts
dts2as --exclude com.example.SomeType file.d.ts

The following arguments are available:

  • -outSWC FILE

    Generate a compiled SWC file. Requires either FLEX_HOME environment variable or --flexHome option.

  • -outDir DIRECTORY

    Generate ActionScript files in a specific output directory. Defaults to ./dts2as_generated.

  • --flexHome DIRECTORY

    Specify the directory where Apache FlexJS is located. Defaults to FLEX_HOME environment variable, if available.

  • --moduleMetadata

    Adds [JSModule] metadata to CommonJS modules. If a module is used in code, Apache FlexJS will automatically require it.

  • -e SYMBOL or --exclude SYMBOL

    Specify the fully-qualified name of a symbol to exclude when emitting ActionScript.

  • -i SYMBOL or --include SYMBOL

    Specify the fully-qualified name of a symbol to include when emitting ActionScript. Excludes all other symbols.

  • -t VERSION or --target VERSION

    Specify ECMAScript target version for the TypeScript standard library: 'ES3', 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'Latest' (default)

  • -v or --version

    Print the version of dts2as.

Using the SWC with Apache FlexJS

To use the generated SWC file with Apache FlexJS, you need to append it to the external library path.

If you're using the FlexJS framework components, you can compile with mxmlc:

mxmlc --external-library-path+=generated.swc src/MyProject.mxml

For pure ActionScript projects that target native JavaScript APIs, like the HTML DOM, you can compile with asjsc:

asjsc --external-library-path+=generated.swc src/MyProject.as

For more details, please check out the following tutorial:

Introduction to dts2as: Using TypeScript definitions with ActionScript

Troubleshooting

TypeScript definition files support a surprisingly large subset of the TypeScript language. Sometimes, dts2as won't know how to parse some of the more advanced syntax (although it's certainly getting better at it over time!). When dts2as runs into problems, it may not be able to compile a SWC file for you. You have a few options when dts2as fails:

  • Use the --exclude option to remove some symbols that you know you won't need, or use the --include option to include only the symbols that you definitely need.

  • Modify the original d.ts file to simplify the TypeScript syntax or to remove some symbols that you don't need.

  • Use the --outDir option instead of the --outSWC option to generate only ActionScript files. Then, modify the ActionScript files and compile them into a SWC yourself.


Special thanks to the following sponsors for their generous support:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].