Skip to Content
开发文档API References@swc/wasm-typescript

@swc/wasm-typescript

安装

¥Installation

npm install @swc/wasm-typescript

用法

¥Usage

import { transform } from '@swc/wasm-typescript'; const tsSourceCode = ` export function add(a: number, b: number) { return a + b; } `; const code = await transform(tsSourceCode, { })

APIs

transform、transformSync

  • 签名:function transform(src: string, options: Options) => Promise<string>

    ¥Signature: function transform(src: string, options: Options) => Promise<string>

  • 签名:function transformSync(src: string, options: Options) => string

    ¥Signature: function transformSync(src: string, options: Options) => string

类型

¥Types

type Options = { // Defaults to 'unknown', which automatically detects the module type. module?: boolean | 'unknown' filename?: string; parser?: TsSyntax }
Last updated on
SWC v1.11 中文网 - 粤ICP备13048890号
Nodejs.cn 旗下网站