diff options
author | Luca Casonato <lucacasonato@yahoo.com> | 2020-04-14 00:07:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-14 00:07:06 +0200 |
commit | a9923f3f93f8786388d84313666f0fc11113830f (patch) | |
tree | 4743a3986f8570a21f4ba6477f9ee956b448b07e /cli/doc/params.rs | |
parent | 2585b72c9bdd5ca36b6b43cf5b5609419081c7a8 (diff) |
fix(doc): expose optionality in function params and class members (#4738)
Diffstat (limited to 'cli/doc/params.rs')
-rw-r--r-- | cli/doc/params.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cli/doc/params.rs b/cli/doc/params.rs index 04fd7f898..0869c1969 100644 --- a/cli/doc/params.rs +++ b/cli/doc/params.rs @@ -13,6 +13,7 @@ pub fn ident_to_param_def(ident: &swc_ecma_ast::Ident) -> ParamDef { ParamDef { name: ident.sym.to_string(), kind: ParamKind::Identifier, + optional: ident.optional, ts_type, } } @@ -27,6 +28,7 @@ fn rest_pat_to_param_def(rest_pat: &swc_ecma_ast::RestPat) -> ParamDef { ParamDef { name, kind: ParamKind::Rest, + optional: false, ts_type, } } @@ -40,6 +42,7 @@ fn object_pat_to_param_def(object_pat: &swc_ecma_ast::ObjectPat) -> ParamDef { ParamDef { name: "".to_string(), kind: ParamKind::Object, + optional: object_pat.optional, ts_type, } } @@ -50,6 +53,7 @@ fn array_pat_to_param_def(array_pat: &swc_ecma_ast::ArrayPat) -> ParamDef { ParamDef { name: "".to_string(), kind: ParamKind::Array, + optional: array_pat.optional, ts_type, } } |