1.0.11 • Published 3 years ago

js-to-typescript v1.0.11

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

js-to-typescript will help you to transform Javscript code to Typescript.

Installation

NPM:

npm install js-to-typescript

Import

js-to-typescript is designed to be imported using default import:

import compiler from 'js-to-typescript';

CommonJs

const compiler = require('js-to-typescript');

Usage

js-to-typescript has only default export which takes Javascript code as string end returns Typescript code

import compiler from 'js-to-typescript';

compiler('let a = [1, 2, 3]')
// output: let a : number[] = [1, 2, 3]

compiler('let a = { b : 5 }') 
// output:
//  Interface aInterface {
//      b : number 
//  }
//
//  let a: aInterface = { b : 5 };

CLI

To use CLI tool install package globally

npm intall -g js-to-typescript

After you can run command from any directory

compilejs (fileName OR folderName)

Compiling file

compilejs index.js

Compiling files is folder

compilejs scripts

Contribute

js-to-typescript isn't near perfect. You can help project to advance with:

  1. Finding Bugs
  2. Suggesting features
  3. Collaborate
1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago