chore(napi): provide a more precise type for source_type (#521)

This commit is contained in:
阿良仔 2023-07-06 10:52:41 +08:00 committed by GitHub
parent 6428139b76
commit be13f980bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -9,7 +9,7 @@
* <https://github.com/babel/babel/blob/main/packages/babel-parser/typings/babel-parser.d.ts>
*/
export interface ParserOptions {
sourceType?: string
sourceType?: 'script' | 'module' | 'unambiguous' | undefined
sourceFilename?: string
}
export interface ParseResult {

View file

@ -15,7 +15,8 @@ use oxc_span::SourceType;
#[napi(object)]
#[derive(Default)]
pub struct ParserOptions {
pub source_type: Option<String>, // "script" | "module" | "unambiguous";
#[napi(ts_type = "'script' | 'module' | 'unambiguous' | undefined")]
pub source_type: Option<String>,
pub source_filename: Option<String>,
}