fix(doc): Added extends field to interface (#4739)

This commit is contained in:
Luca Casonato 2020-04-14 00:28:49 +02:00 committed by GitHub
parent a9923f3f93
commit c915e4d77d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 14 deletions

View file

@ -4,6 +4,7 @@ use serde::Serialize;
use super::params::ts_fn_param_to_param_def;
use super::parser::DocParser;
use super::ts_type::ts_entity_name_to_name;
use super::ts_type::ts_type_ann_to_def;
use super::ts_type::TsTypeDef;
use super::ts_type_param::maybe_type_param_decl_to_type_param_defs;
@ -49,7 +50,7 @@ pub struct InterfaceCallSignatureDef {
#[derive(Debug, Serialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct InterfaceDef {
// TODO(bartlomieju): extends
pub extends: Vec<String>,
pub methods: Vec<InterfaceMethodDef>,
pub properties: Vec<InterfacePropertyDef>,
pub call_signatures: Vec<InterfaceCallSignatureDef>,
@ -201,7 +202,14 @@ pub fn get_doc_for_ts_interface_decl(
interface_decl.type_params.as_ref(),
);
let extends: Vec<String> = interface_decl
.extends
.iter()
.map(|expr| ts_entity_name_to_name(&expr.expr))
.collect();
let interface_def = InterfaceDef {
extends,
methods,
properties,
call_signatures,