1.2.4 • Published 5 years ago

typewiz-angular v1.2.4

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

typewiz-angular

An Angular Schematic that automatically adds types to TypeScript code using TypeWiz

Build Status Coverage Status

Installation

Run the following command in your project's folder:

ng add typewiz-angular

Usage

Start your project normally, by running ng serve. You should see a new collected-types.json file, which will contain all the new types discovered by TypeWiz. To update your source code with these types, run the following command:

npm run typewiz:apply-types

For more information, check out the blog post.

Example

Given the following input file:

export class AppComponent {
    title = this.greet('World');

    greet(who) {
        return `Hello, ${who}`;
    }
}

After running the app with ng serve, opening it in the browser, and then applying the discovered types by running npm run typewiz:apply-types, your class will be updated as follows:

export class AppComponent {
  title = this.greet('World');

  greet(who: string) {
      return `Hello, ${who}`;
  }
}

Note the addition of the : string type for the who of the greet method.

License

Copyright (C) 2018, Uri Shaked and contributors. Distributed under the terms of the MIT license.