0.1.4 • Published 1 year ago

markdown-to-ts v0.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Markdown to typescript, tsx converter

npm Downloads license

Create type,tsx based on the markdown table.

Supported Node.js

Supports versions 10 and above

Install

npm i -g markdown-to-ts

Usage

  1. If there is no xxx.type.md file in the current path, Sample.type.md is created.
md-cli type
  • Sample.type.md
| key      | type                             | description   |
|----------|----------------------------------|---------------|
| basic?   | string                           | Optional type |
| union    | number,string                    | UnionType     |
| union2   | "name","age"                     | UnionType     |
| tuple    | [number,string]                  | TupleType     |
| tuple2   | ["string",1,{}]                  | TupleType     |
| argsFunc | (args:number,args2:string)=>void | function      |
  1. Reads the xxx.type.md file in the current path and creates the xxx.ts file.
md-cli type
  • SampleType.ts
type SampleType = {
    basic?: string; //Optional type
    union: number | string; //UnionType
    union2: 'name' | 'age'; //UnionType
    tuple: [number, string]; //TupleType
    tuple2: ['string', 1, {}]; //TupleType
    argsFunc: (args: number, args2: string) => void; //function
};
export default SampleType;
  1. Reads the xxx.type.md file in the current path and creates the xxx.tsx file.
md-cli component
  • Sample.tsx
type Props = {
    basic?: string; //Optional type
    union: number | string; //UnionType
    union2: 'name' | 'age'; //UnionType
    tuple: [number, string]; //TupleType
    tuple2: ['string', 1, {}]; //TupleType
    argsFunc: (args: number, args2: string) => void; //function
    [key: string]: any;
};

function Sample(props: Props) {
    return <div>Sample Component</div>;
}

export default Sample;
0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago