Skip to content

Commit

Permalink
Revert "feat(method): change to be able to add extends object" (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed Mar 24, 2022
1 parent 304078b commit ab336ec
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
20 changes: 1 addition & 19 deletions src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,7 @@ export function parse(opts: DocsParseOptions) {
});

return (api: string) => {
let apiInterface = interfaces.find((i) => i.name === api) || null;

/**
* Add methods of import(many is used in `extends`)
*/
const allImportObject = interfaces
.filter((i) => apiInterface?.importObject.includes(i.name) && i.name !== api)
.map((i) => i.importObject);

const otherMethod =
interfaces.filter((i) => [...new Set(allImportObject.flat())].includes(i.name)).map((d) => d.methods) || null;

if (apiInterface !== null && otherMethod && otherMethod.length > 0) {
apiInterface.methods = [...new Set(apiInterface?.methods.concat(otherMethod.flat(1)))];
}
const apiInterface = interfaces.find((i) => i.name === api) || null;

const data: DocsData = {
api: apiInterface,
Expand Down Expand Up @@ -170,17 +156,13 @@ function getInterface(typeChecker: ts.TypeChecker, node: ts.InterfaceDeclaration
const symbol = typeChecker.getSymbolAtLocation(node.name);
const docs = symbol ? serializeSymbol(typeChecker, symbol) : null;

// @ts-ignore
const importObject = node.parent?.locals?.keys() || [];

const i: DocsInterface = {
name: interfaceName,
slug: slugify(interfaceName),
docs: docs?.docs || '',
tags: docs?.tags || [],
methods,
properties,
importObject: [...importObject].filter((d: string) => d !== interfaceName),
};

return i;
Expand Down
1 change: 0 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export interface DocsInterface {
tags: DocsTagInfo[];
methods: DocsInterfaceMethod[];
properties: DocsInterfaceProperty[];
importObject: string[];
}

export interface DocsEnum {
Expand Down

0 comments on commit ab336ec

Please sign in to comment.