@fang/typescript
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

fang-typescript

Transpiles your Typescript files and generates declaration files.

npm NPM npm peer dependency version Libraries.io dependency status for latest release Snyk Vulnerabilities for npm package

Summary

About

I created this plugin to compile my Typescript files. This is meant to be an "official" plugin, but feel free to seek for others folks alternatives, there might be some more efficient way or feature full way to compile your .ts files.

Requirements

Having @fang/core installed in version 0.*.

Installation

  • Using NPM: npm install --save-dev @fang/typescript
  • Using Yarn: yarn add --dev @fang/typescript

Examples

1. Compile a Typescript code into regular Javascript

Assuming your Typescript file is located at example/src/index.ts, and you want to generate a Javascript file at example/dist/js/index.js.

For this example, you will need to install @fang/save (NPM: npm install --save-dev @fang/save, Yarn: yarn add --dev @fang/save).

const { run } = require("@fang/core");
const save = require("@fang/save");
const typescript = require("@fang/typescript");

const ts = {
  name: "typescript",
  input: "example/src/index.ts",
  tasks: [
    typescript({
      strict: true,
      alwaysStrict: true,
      target: "ES5",
    }),
    save({
      folder: "example/dist/js",
    }),
  ],
};

const main = async () => await run([ts]);

main();

Known issues

  • There is not way to get your tsconfig.json options. You need to use the options in the task, for the moment.
  • The emitDeclarationOnly: true and declaration: true rules will not be honored, for the moment. This means you can't generate .d.ts files using this plugin.

Package Sidebar

Install

npm i @fang/typescript

Weekly Downloads

0

Version

0.2.0

License

MIT

Unpacked Size

7.41 kB

Total Files

8

Last publish

Collaborators

  • khalyomede