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

fix(ts): fix nock @~11.0.0 #819

Merged
merged 3 commits into from Aug 21, 2019
Merged

fix(ts): fix nock @~11.0.0 #819

merged 3 commits into from Aug 21, 2019

Conversation

jkwlui
Copy link
Member

@jkwlui jkwlui commented Aug 21, 2019

Started to see typescript compilation failed overnight:

> @google-cloud/storage@3.1.0 compile /Users/jonathanlui/nodejs-storage
> tsc -p .

system-test/storage.ts:108:1 - error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'typeof import("/Users/jonathanlui/nodejs-storage/node_modules/nock/types/index")' has no compatible call signatures.

108 nock('http://metadata.google.internal')
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There hasn't been releases to @types/nock, typescript or gts. So
this is a temporary fix to unblock releasing while we figure out why.

Update

Turns out starting at nock@11.1.0, they shipped their own typescript definition in the package. The types assumed the downstream library uses esModuleInterop so

import * as nock from 'nock' failed typescript compilation, while
import nock from 'nock' successfully compiled, but failed at runtime.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 21, 2019
@jkwlui jkwlui requested a review from bcoe August 21, 2019 00:57
@codecov
Copy link

codecov bot commented Aug 21, 2019

Codecov Report

Merging #819 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #819   +/-   ##
=======================================
  Coverage   95.05%   95.05%           
=======================================
  Files          10       10           
  Lines        1152     1152           
  Branches      288      288           
=======================================
  Hits         1095     1095           
  Misses         29       29           
  Partials       28       28

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0eb689f...3156850. Read the comment docs.

@jkwlui jkwlui changed the title fix(types): use any types for nock fix(ts): fix nock @~11.0.0 Aug 21, 2019
@jkwlui jkwlui self-assigned this Aug 21, 2019
@jkwlui jkwlui merged commit 48f9b44 into master Aug 21, 2019
@stephenplusplus stephenplusplus deleted the fix-nock-types branch November 26, 2019 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants