Skip to content

Commit

Permalink
fix(docgen): ts definition for Ti.Android.R
Browse files Browse the repository at this point in the history
fix #29
  • Loading branch information
drauggres committed Feb 20, 2020
1 parent e00f175 commit 1de1cf5
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions packages/titanium-docgen/generators/typescript_generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ class DocsParser {
'proxy',
'view'
];
return validSubtypes.includes(typeInfo.__subtype) && !forcedInterfaces.includes(typeInfo.name);
return validSubtypes.includes(typeInfo.__subtype) && !forcedInterfaces.includes(typeInfo.name)
&& !(typeInfo.createable === false && isConstantsOnlyProxy(typeInfo));
}

/**
Expand Down Expand Up @@ -882,14 +883,14 @@ class MemberNode {

this.methods = [];

methods.sort(sortByName).forEach(methodDoc => {
const filterFunc = this.filterMethods.bind(this);

methods.filter(filterFunc).sort(sortByName).forEach(methodDoc => {
if (this.fullyQualifiedName === 'Titanium.Proxy' && /LifecycleContainer$/.test(methodDoc.name)) {
methodDoc.optional = true;
}
const isEventMethod = eventsMethods.includes(methodDoc.name);
if (!isEventMethod && methodDoc.__inherits && methodDoc.__inherits !== this.fullyQualifiedName && !this.membersAreStatic) {
return;
}

if (this.proxyEventMap && isEventMethod) {
const parameters = [ {
name: 'name',
Expand Down Expand Up @@ -946,6 +947,11 @@ class MemberNode {
});
}

filterMethods(methodDoc) {
const isEventMethod = eventsMethods.includes(methodDoc.name);
return !(!isEventMethod && methodDoc.__inherits && methodDoc.__inherits !== this.fullyQualifiedName && !this.membersAreStatic);
}

parseEvents(events) {
if (!events || !events.length) {
return;
Expand Down Expand Up @@ -1078,10 +1084,16 @@ class NamespaceNode extends MemberNode {
filterProperties(propertyDoc) {
// If we have interface/class for this namespace, then we need here only upper cased constants
let onlyUpperCased = true;
let excluded = propertyDoc.__hide;
if (this.relatedNode) {
onlyUpperCased = propertyDoc.name.toUpperCase() === propertyDoc.name;
}
return onlyUpperCased && super.filterProperties(propertyDoc);
return onlyUpperCased && !excluded && super.filterProperties(propertyDoc);
}

filterMethods(methodDoc) {
let excluded = methodDoc.__hide;
return !excluded && super.filterMethods(methodDoc);
}

addNamespace(namespaceNode) {
Expand Down

0 comments on commit 1de1cf5

Please sign in to comment.