Permalink
Browse files

tools, bugfix: fix lack of prop generation for internal class. (#432)

  • Loading branch information...
richardo2016 authored and xicilion committed Jun 9, 2018
1 parent 80c04a9 commit 6cb8e61aa9c1b5ca52abe85ec9fee1e9eb0a0695
Showing with 49 additions and 29 deletions.
  1. +49 −29 tools/util/tmpl/type.d.ts.txt
@@ -97,23 +97,43 @@ declare global {
%>
<% if (renderClassParentRef) {%>/// <reference path="<%- extendClassName %>.d.ts" /><%}%>
declare class <%- _fns.uglifyInternalClassName(className) %> <%- extendClassName ? `extends ${_fns.uglifyInternalClassName(extendClassName)}` : '' %> {
<% for(var i=0; i<member_props.length; i++) {
var memberProp = member_props[i]
var propName = memberProp.name
var propType = typeMap[memberProp.type]
propType = _fns.uglifyTypeInDefObjects(propType)
var str = JSON.stringify(memberProp)
%>
/**
* class prop <% str %>
*
* <% var comments = memberProp.comments.split('\n'); for(var idx=0; idx<comments.length; idx++) {var comment = comments[idx].trim().replace('! @', '@') %>
* <%- comment %><% } %>
* <%- memberProp.static ? '@static' : '' %>
* <%- memberProp.readonly ? '@readonly' : '' %>
* @type <%- memberProp.type %>
*/
<%- propName %>: <%- propType %>
<% } /** end of iteration 'member_props' */ %>
<% for(var i=0; i<member_fns.length; i++) {
var fn = member_fns[i]
var isConstructor = fn.name === def.declare.name
var fn_name = isConstructor ? 'constructor' : fn.name
var fn = member_fns[i]
var isConstructor = fn.name === def.declare.name
var fn_name = isConstructor ? 'constructor' : fn.name
%>
/**
* <% var comments = fn.comments.split('\n'); for(var idx=0; idx<comments.length; idx++) {var comment = comments[idx].trim().replace('! @', '@') %>
* <%- comment %><% } %>
* <%- fn.deprecated ? '@deprecated' : '' %>
* <%- fn.async ? '@async' : '' %>
*/<%
var paramList = _fns.params2paramList(fn.params, typeMap)
var returnType = fn.type ? _fns.uglifyTypeInDefObjects(typeMap[fn.type], defObjects) : 'void'
if (isConstructor)
returnType = ''
%>
* <% var comments = fn.comments.split('\n'); for(var idx=0; idx<comments.length; idx++) {var comment = comments[idx].trim().replace('! @', '@') %>
* <%- comment %><% } %>
* <%- fn.deprecated ? '@deprecated' : '' %>
* <%- fn.async ? '@async' : '' %>
*/<%
var paramList = _fns.params2paramList(fn.params, typeMap)
var returnType = fn.type ? _fns.uglifyTypeInDefObjects(typeMap[fn.type], defObjects) : 'void'
if (isConstructor)
returnType = ''
%>
<%- fn.static ? 'static ' : '' %><%- fn_name %>(<%- paramList.join(', ') %>)<%- returnType ? `: ${returnType}` : '' %>;
<% } /** end of iteration 'member_fns' */ %>
} /** endof class */
@@ -133,11 +153,11 @@ declare module "<%- def.declare.name %>" {
var hasDefault = !!constant.default
%>
/**
* <% var comments = constant.comments.split('\n'); for(var idx=0; idx<comments.length; idx++) {var comment = comments[idx].trim().replace('! @', '@') %>
* <%- comment %><% } %>
* <%- constant.deprecated ? '@deprecated' : '' %>
* <%- constant.async ? '@async' : '' %>
*/
* <% var comments = constant.comments.split('\n'); for(var idx=0; idx<comments.length; idx++) {var comment = comments[idx].trim().replace('! @', '@') %>
* <%- comment %><% } %>
* <%- constant.deprecated ? '@deprecated' : '' %>
* <%- constant.async ? '@async' : '' %>
*/
export const <%- constant.name %><%- hasDefault ? ` = ${constant.default.value}` : ''%>;
<% } /** end of iteration 'member_constants' */ %>
@@ -146,11 +166,11 @@ declare module "<%- def.declare.name %>" {
var objectName = internalObj.type || internalObj.name
%>
/**
* <% var comments = internalObj.comments.split('\n'); for(var idx=0; idx<comments.length; idx++) {var comment = comments[idx].trim().replace('! @', '@') %>
* <%- comment %><% } %>
* <%- internalObj.deprecated ? '@deprecated' : '' %>
* <%- internalObj.async ? '@async' : '' %>
*/
* <% var comments = internalObj.comments.split('\n'); for(var idx=0; idx<comments.length; idx++) {var comment = comments[idx].trim().replace('! @', '@') %>
* <%- comment %><% } %>
* <%- internalObj.deprecated ? '@deprecated' : '' %>
* <%- internalObj.async ? '@async' : '' %>
*/
export class <%- objectName %> extends <%- _fns.uglifyInternalClassName(objectName) %> {}
<% } /** end of iteration 'member_objects' */ %>
@@ -159,11 +179,11 @@ declare module "<%- def.declare.name %>" {
var fn = member_fns[i]
%>
/**
* <% var comments = fn.comments.split('\n'); for(var idx=0; idx<comments.length; idx++) {var comment = comments[idx].trim().replace('! @', '@') %>
* <%- comment %><% } %>
* <%- fn.deprecated ? '@deprecated' : '' %>
* <%- fn.async ? '@async' : '' %>
*/<%
* <% var comments = fn.comments.split('\n'); for(var idx=0; idx<comments.length; idx++) {var comment = comments[idx].trim().replace('! @', '@') %>
* <%- comment %><% } %>
* <%- fn.deprecated ? '@deprecated' : '' %>
* <%- fn.async ? '@async' : '' %>
*/<%
var paramList = _fns.params2paramList(fn.params, typeMap)
var returnType = fn.type ? _fns.uglifyTypeInDefObjects(typeMap[fn.type], defObjects) : 'void'

0 comments on commit 6cb8e61

Please sign in to comment.