-
Notifications
You must be signed in to change notification settings - Fork 0
Type
Anton edited this page Dec 26, 2019
·
30 revisions
A type is created with a simple new Type() call to the constructor, however to assign properties, the fromXML method is used from within Typal.
Type: A representation of a type.
| Name | Type & Description | Initial |
|---|---|---|
| constructor | new () => Type | |
| Constructor method. | ||
| name | string | - |
| The name of the type. | ||
| type | ?string | null |
| The type of the type. | ||
| closureType | ?string | null |
An overriding type for closure to generate externs, e.g., function(string): boolean instead of (s:string) => boolean.
|
||
| description | ?string | null |
| The description of the type. | ||
| noToc | boolean | false |
| Whether the type should not be included in the table of contents (for Documentary). | ||
| spread | boolean | false |
| When generating JSDoc, print all properties of the type, but loose individual property description. | ||
| noExpand | boolean | false |
| Don't print each property description. | ||
| import | boolean | false |
| Whether the type as an import. | ||
| link | ?string | null |
| The link to the documentation page. | ||
| properties | !Array<!(Property | Fn)> | [] |
| The properties of the type. | ||
| namespace | ?string | null |
The type's namespace, e.g., _typal.
|
||
| ns | string | - |
| The namespace or an empty string. | ||
| fullName | string | - |
| The type name with the namespace if it has with one. | ||
| isConstructor | boolean | false |
|
Whether the externs should have the form of /** @constructor */
_ns.Type
/** @boolean */
_ns.Type.prototype.isConstructor |
||
| isInterface | boolean | false |
|
Same as /** @interface */
_ns.Type
/** @boolean */
_ns.Type.prototype.isInterface |
||
| isRecord | boolean | false |
|
Same as /** @record */
_ns.Type
/** @boolean */
_ns.Type.prototype.isRecord |
||
| extends | ?string | null |
Types @constructor, @interface and @record can inherit properties from other types using @extends. Closure Wiki.
|
||
| args | Array<!Arg> | null |
| Constructors and interfaces can have arguments defined in types.xml, which will be parsed and stored in this property. | ||
| examples | !Array<string> | [] |
| Examples that have been read. | ||
| toMarkdown | (allTypes: !Array<!Type>, opts: !ToMarkdownOptions) => { LINE: string, table: (string | { props: !Array<{ prop: !Property, typeName: (string | !_typedefsParser.Type), name: string, de: string, d: string }>, anyHaveDefault: boolean, constr: boolean }), displayInDetails: boolean } | |
|
Converts a type to a markdown string. This function is closely integrated with the Documentary package, however can also be used to get a standard markdown string with properties in a table. allTypes* !Array<!Type>: The array with all types for linking.opts* !ToMarkdownOptions: Options passed by Documentary. If narrow is specified, the table returned as an object for manual printing, otherwise a string is returned. WIP.
|
||