From 35f281f337ab3f083638233e4cbdf0eb47b5b364 Mon Sep 17 00:00:00 2001 From: Ewan Harris Date: Thu, 6 Jun 2019 14:32:14 +0100 Subject: [PATCH] docs(typescript): update sdk version in typescript definition header (#10822) * docs(typescript): update sdk version in typescript definition header * ensure generated typescript def file passing linting * docs(typescript): mark as non-npm package Done by DefinitelyTyped maintainer in https://github.com/DefinitelyTyped/DefinitelyTyped/commit/608c146d8982a2ff7307f0a3bdddd6d55cb1a63e#diff-948841420dd57be7be5d9d21fe002f4c so we should keep this --- apidoc/Titanium/UI/ShortcutItem.yml | 6 +++--- apidoc/Titanium/UI/WebView.yml | 4 ++-- apidoc/lib/typescript_generator.js | 9 +++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/apidoc/Titanium/UI/ShortcutItem.yml b/apidoc/Titanium/UI/ShortcutItem.yml index 932cc439bb0..d2aa4145b80 100644 --- a/apidoc/Titanium/UI/ShortcutItem.yml +++ b/apidoc/Titanium/UI/ShortcutItem.yml @@ -21,7 +21,7 @@ methods: platforms: [android] - name: pin - description: Pin shortcut to launcher. + summary: Pin shortcut to launcher. platforms: [android] osver: {android: {min: "8.0"}} @@ -34,13 +34,13 @@ properties: availability: creation - name: title - description: Title of the shortcut. + summary: Title of the shortcut. type: String platforms: [android] availability: creation - name: description - description: Description of the shortcut. + summary: Description of the shortcut. type: String platforms: [android] availability: creation diff --git a/apidoc/Titanium/UI/WebView.yml b/apidoc/Titanium/UI/WebView.yml index 0109b0a798d..b92fd6a346c 100644 --- a/apidoc/Titanium/UI/WebView.yml +++ b/apidoc/Titanium/UI/WebView.yml @@ -297,7 +297,7 @@ methods: parameters: - name: propertyList summary: List of properties for listen. - type: Array + type: Array - name: stopListeningToProperties summary: Remove native properties from observing. @@ -306,7 +306,7 @@ methods: parameters: - name: propertyList summary: List of properties to remove. - type: Array + type: Array - name: takeSnapshot summary: Takes a snapshot of the view's visible viewport. diff --git a/apidoc/lib/typescript_generator.js b/apidoc/lib/typescript_generator.js index a50dab80d49..e56c27d0e6c 100644 --- a/apidoc/lib/typescript_generator.js +++ b/apidoc/lib/typescript_generator.js @@ -306,16 +306,17 @@ class GlobalTemplateWriter { /** * Writes the type definition header required by DefinitelyTyped. * - * @todo Automatically update the Titanium version string. */ writeHeader() { - this.output += '// Type definitions for Titanium 7.1\n'; + const { version } = require('../../package.json'); + const versionSplit = version.split('.'); + const majorMinor = `${versionSplit[0]}.${versionSplit[1]}`; + this.output += `// Type definitions for non-npm package Titanium ${majorMinor}\n`; this.output += '// Project: https://github.com/appcelerator/titanium_mobile\n'; this.output += '// Definitions by: Axway Appcelerator \n'; this.output += '// Jan Vennemann \n'; this.output += '// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped\n'; this.output += '// TypeScript Version: 2.6\n'; - this.output += '\n'; } /** @@ -380,7 +381,7 @@ class GlobalTemplateWriter { if (interfaceNode.methods.length > 0) { interfaceNode.methods.forEach(methodNode => this.writeMethodNode(methodNode, nestingLevel + 1)); } - this.output += `${this.indent(nestingLevel)}}\n\n`; + this.output += `${this.indent(nestingLevel)}}\n`; } /**