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

Sample appears to have compile errors on deploy #3

Open
leetworx opened this issue Oct 20, 2019 · 1 comment
Open

Sample appears to have compile errors on deploy #3

leetworx opened this issue Oct 20, 2019 · 1 comment

Comments

@leetworx
Copy link

Hi there,
I believe I've captured the sample accurately and I'm trying to run it within my existing firebase project before I go and try to create my own functions (new to functions/typescript) - unfortunately, I run into the following message on deploy:

src/index.ts:16:18 - error TS2532: Object is possibly 'undefined'.

16         body: `${puppy.name} is ready for adoption`,
                    ~~~~~

src/index.ts:34:12 - error TS2532: Object is possibly 'undefined'.

34       .doc(order.seller)
              ~~~~~

src/index.ts:43:29 - error TS2532: Object is possibly 'undefined'.

43         body: `you sold a ${order.product} for ${order.total}`,
                               ~~~~~

src/index.ts:43:50 - error TS2532: Object is possibly 'undefined'.

43         body: `you sold a ${order.product} for ${order.total}`,
@leetworx
Copy link
Author

FWIW, I think this might just be due to versioning of dependencies/toolchain etc...
I was able to work around it by installing typescript beta:

npm install typescript@beta

And replace object.field references with object?.field so as to satisfy the check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant