Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TypeScript definition file #176

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7df48d7
try building some typescript files
philschatz May 21, 2017
068e2a7
build more typescript files and provide an example
philschatz May 21, 2017
8a5f1b9
initial routes file
philschatz May 26, 2017
7e43378
standardize on arg names so functions w/ args collapse
philschatz May 29, 2017
a726fbd
making some progress
philschatz May 29, 2017
7255cde
generate a working `index.d.ts` file
philschatz May 30, 2017
8c37428
yield an Issue
philschatz May 30, 2017
a0bcf4b
support the queries that are used in desktop
philschatz May 30, 2017
0d30daa
change UserEmail to be an enum
philschatz May 30, 2017
aa77564
add more precise typing for search and emails
philschatz May 30, 2017
e48d716
generate the base Param types
philschatz May 30, 2017
f21e1ad
add optional callback to method signature
philschatz May 30, 2017
2f77af4
add type for search results
philschatz May 31, 2017
ef0dbb8
include the types file so typescript can find it
philschatz Jun 2, 2017
fa692e3
add more response types
philschatz Jun 4, 2017
b346e26
finally, some useful types for requests and responses
philschatz Jun 5, 2017
4180b4e
:white_check_mark: autogenerate tests (part 1)
philschatz Jun 5, 2017
b441820
add more tests and show suggestions
philschatz Jun 6, 2017
9fb1827
add more response types
philschatz Jun 6, 2017
ddaae06
more types
philschatz Jun 6, 2017
446906e
more types
philschatz Jun 6, 2017
491d72a
more types
philschatz Jun 7, 2017
1a10401
rename types
philschatz Jun 7, 2017
32aae48
rename commit types
philschatz Jun 7, 2017
70c7c6b
:art: curly braces and remove Emojis type
philschatz Jun 7, 2017
f9ec7b1
rebuild type definition file
philschatz Jun 7, 2017
5becc98
clarify when User contains a name field and when it does not
philschatz Jun 8, 2017
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
120 changes: 61 additions & 59 deletions dist/octokat.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Javascript GitHub client for NodeJS or a browser using promises or callbacks",
"main": "index.js",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add types field like "types": "./types/index.d.ts"?

Including declarations in your npm package
https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for catching that oversight. Updated 😄

"scripts": {
"typescript": "node ./types/builder.js",
"lint": "standard *.js src/**.js | snazzy && coffeelint --file ./coffeelint.json src/**/*.coffee",
"build": "npm run-script dist",
"pretest": "npm run-script build",
Expand Down Expand Up @@ -34,6 +35,7 @@
"xmlhttprequest": "~1.8.0"
},
"devDependencies": {
"awesome-typescript-loader": "^3.1.3",
"babel-cli": "^6.18.0",
"babel-core": "^6.16.0",
"babel-loader": "^7.0.0",
Expand All @@ -58,6 +60,7 @@
"remap-istanbul": "^0.9.0",
"snazzy": "^6.0.0",
"standard": "^9.0.0",
"typescript": "^2.3.2",
"webpack": "^2.3.1",
"whatwg-fetch": "^2.0.3"
},
Expand Down Expand Up @@ -85,6 +88,7 @@
"./dist/node/adapters/xhr-node.js": "./dist/node/adapters/xhr-browser.js",
"./dist/node/adapters/base64-node.js": "./dist/node/adapters/base64-browser.js"
},
"types": "./types/index.d.ts",
"tonicExampleFilename": "examples/tonic-example.js",
"license": "MIT"
}
2 changes: 1 addition & 1 deletion src/plugins/hypermedia.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = new class HyperMedia {
_replaceKeyValue (instance, acc, key, value) {
if (/_url$/.test(key)) {
if (/^upload_url$/.test(key)) {
// POST https://<upload_url>/repos/:owner/:repo/releases/:id/assets?name=foo.zip
// POST https://<upload_url>/repos/:owner/:repo/releases/:release_id/assets?name=foo.zip
var defaultFn = function (...args) {
// TODO: Maybe always set isRaw=true when contentType is provided
deprecate('call .upload({name, label}).create(data, contentType)' +
Expand Down
13 changes: 13 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"outDir": "./types/",
"sourceMap": true,
"strictNullChecks": true,
"module": "es6",
"target": "es6",
"allowJs": false
},
"include": [
"./types/"
]
}
Loading