-
Notifications
You must be signed in to change notification settings - Fork 145
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
Adding Typescript support #232
Conversation
Codecov Report
@@ Coverage Diff @@
## master #232 +/- ##
======================================
Coverage 100% 100%
======================================
Files 13 12 -1
Lines 1846 1740 -106
======================================
- Hits 1846 1740 -106
Continue to review full report at Codecov.
|
Wow, this is a big PR 🤣 Usually when we do a TypeScript transition, we're very careful to take a minimum number of steps. I have those pretty well laid out here: The issue with any library that uses GAPIC is that we're using generated JavaScript code. How are you getting around that out of curiosity? |
58bbcc1
to
3e7812e
Compare
3e7812e
to
1490a8f
Compare
The PR was rather large since it contained a bunch of reformatting done by I want to convert the client one file at a time and am leaving JS support on for now. |
"src/*{/*,/**/*}.js", | ||
"src/*/v*/*.js", | ||
"test/**/*.js" | ||
"build/src/*{/*,/**/*}.js", |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -8,14 +8,11 @@ | |||
"node": ">=4.0.0" | |||
}, | |||
"repository": "googleapis/nodejs-firestore", | |||
"main": "./src/index.js", | |||
"main": "./build/src/index.js", | |||
"types": "./types/firestore.d.ts", |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
package.json
Outdated
"test": "npm run cover" | ||
"system-test": "mocha build/system-test/*.js --timeout 600000", | ||
"conformance": "mocha build/conformance/*.js --no-timeouts", | ||
"test-no-cover": "mocha build/test/*.js --no-timeouts", |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/path.ts
Outdated
: Array.prototype.slice.call(arguments, 2); | ||
|
||
constructor( | ||
private readonly projectId: string, private readonly databaseId: string, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/path.ts
Outdated
construct(segments) { | ||
return new ResourcePath(this._projectId, this._databaseId, segments); | ||
construct(segments: string[]): ResourcePath { | ||
return new ResourcePath(this.projectId, this.databaseId, ...segments); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
other._projectId !== '{{projectId}}' | ||
) { | ||
if (this._projectId < other._projectId) { | ||
if (this.projectId !== '{{projectId}}' && |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/path.ts
Outdated
segments = is.array(segments) | ||
? segments | ||
: Array.prototype.slice.call(arguments); | ||
segments = segments.length === 1 && is.array(segments[0]) ? |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed comments.
"src/*{/*,/**/*}.js", | ||
"src/*/v*/*.js", | ||
"test/**/*.js" | ||
"build/src/*{/*,/**/*}.js", |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -8,14 +8,11 @@ | |||
"node": ">=4.0.0" | |||
}, | |||
"repository": "googleapis/nodejs-firestore", | |||
"main": "./src/index.js", | |||
"main": "./build/src/index.js", | |||
"types": "./types/firestore.d.ts", |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
package.json
Outdated
"test": "npm run cover" | ||
"system-test": "mocha build/system-test/*.js --timeout 600000", | ||
"conformance": "mocha build/conformance/*.js --no-timeouts", | ||
"test-no-cover": "mocha build/test/*.js --no-timeouts", |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/path.ts
Outdated
construct(segments) { | ||
return new ResourcePath(this._projectId, this._databaseId, segments); | ||
construct(segments: string[]): ResourcePath { | ||
return new ResourcePath(this.projectId, this.databaseId, ...segments); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
other._projectId !== '{{projectId}}' | ||
) { | ||
if (this._projectId < other._projectId) { | ||
if (this.projectId !== '{{projectId}}' && |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/path.ts
Outdated
segments = is.array(segments) | ||
? segments | ||
: Array.prototype.slice.call(arguments); | ||
segments = segments.length === 1 && is.array(segments[0]) ? |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
tsconfig.json
Outdated
"rootDir": ".", | ||
"outDir": "build", | ||
"target": "es6", | ||
"noImplicitAny": false |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
tsconfig.json
Outdated
"moduleResolution": "node", | ||
"outDir": "dist/es6", | ||
"rootDir": "./", | ||
"declaration": false, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM w/ nits
.prettierrc
Outdated
@@ -5,4 +5,4 @@ semi: true | |||
singleQuote: true | |||
tabWidth: 2 | |||
trailingComma: es5 | |||
useTabs: false | |||
useTabs: false |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -8,14 +8,11 @@ | |||
"node": ">=4.0.0" | |||
}, | |||
"repository": "googleapis/nodejs-firestore", | |||
"main": "./src/index.js", | |||
"main": "./build/src/index.js", | |||
"types": "./types/firestore.d.ts", |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Adding Typescript support to Firestore.
Note:
path.js
to TS for now (as a proof of concept)gts fix
since it re-formats almost everything (which is why as of now all tests are failing)The tests are also spewing errors about Google Default Credentials not working. I am not sure if this is new in this PR, but it doesn't (yet) cause problems. It might make sense to fix that in a follow up.