Skip to content

putout(source, options) - show more options in readme #116

@milahu

Description

@milahu

example: transform tsx to tsx

import putout from "putout"

const source = `
const hello: string = 'world';
const hi = 'there';
console.log(hello);
`;

const res = putout(source, {
    isTS: true,
    isJSX: true,
    //isFlow: true,
    //parser: 'babel',
    //sourceFileName: 'input.tsx',
    //sourceMapName: 'input.tsx.map',
    processors: [
        //'typescript', // @putout/processor-typescript type checking for typescript files
    ],
    plugins: [
        //'typescript', // @putout/plugin-typescript transform TypeScript code. Enabled by default for ts and tsx files.
        'remove-unused-variables',
    ],
});

console.log(res.code);

not perfect, because it should return typescript
had to disable the typescript plugin, which was removing the : string

example result

const hello: string = 'world';
console.log(hello);

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions