Skip to content
This repository was archived by the owner on May 22, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ This project using [Google API discovery](https://developers.google.com/discover
## Usage
Run program:
```
npm start
```
npm start --out /path/to/DefinitelyTyped/types/
```

If you don't provide a value for `--out`, the default is a directory named `out` in the working directory.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Google API Typescript typings definitions generator",
"main": "generator.ts",
"scripts": {
"start": "ts-node src/google-api-typings-generator.ts --out D:\\Projects\\GitHub\\DefinitelyTyped\\types",
"start": "ts-node src/google-api-typings-generator.ts",
"tsc": "tsc -p .",
"test": "mocha tests/tests.ts --require ts-node/register"
},
Expand All @@ -24,4 +24,4 @@
"lodash": "^4.17.4",
"request": "^2.81.0"
}
}
}
4 changes: 3 additions & 1 deletion src/google-api-typings-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ interface ITypescriptTextWriter {
}

type TypescriptWriterCallback = (writer: TypescriptTextWriter) => void;
type methodParam = { parameter: string, type: string | TypescriptWriterCallback };

function formatPropertyName(name: string) {
if (name.indexOf(".") >= 0 || name.indexOf("-") >= 0 || name.indexOf("@") >= 0) {
Expand Down Expand Up @@ -256,7 +257,8 @@ class TypescriptTextWriter implements ITypescriptTextWriter {
}
}

public method(name: string, parameters: [{ parameter: string, type: string | TypescriptWriterCallback }], returnType: string, singleLine = false) {

public method(name: string, parameters: methodParam[], returnType: string, singleLine = false) {
this.writer.startIndentedLine(`${name}(`);

_.forEach(parameters, (parameter, index) => {
Expand Down