-
Notifications
You must be signed in to change notification settings - Fork 985
Fix wrong import in TypeScript example #800
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
Conversation
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
|
Hey @joostfarla if you upgrade to the latest firebase (i.e. |
|
Thanks @jshcrowthe! After upgrading to v5.0.2, When I use the documented way of importing in TS: I now get an error: Can you give an example of how to use this correctly? |
|
That is a great question! It seems our documentation is wrong there, it should be: import firebase from 'firebase/app';If you'd like to submit a PR for that let's get it merged! |
|
When I try: import firebase from 'firebase/app';I'm getting this warning: [ts] Module '"/.../node_modules/firebase/index"' has no default export. |
|
@jshcrowthe I can confirm what @joostfarla saying - i also get "[ts] Module '"/.../node_modules/firebase/index"' has no default export." using [email protected] and [email protected] and [email protected] The funny part is: Using [email protected] with [email protected] and ionic with [email protected] , it's working |
|
@joostfarla or @paulstelzer can you post your Additionally, it may be better to move this to a separate issue, so if one of you would be willing to do that, that'd be great. |
|
@jshcrowthe very strange - used the tsconfig.json from [email protected] (installed completely new). See github -> https://github.com/paulstelzer/angular6-firebase/ - I put it into ' /src/app/app.component.ts ' (Error: has no default export and so building is not possible) |
|
@jshcrowthe GOT IT :) Your assumption with tsconfig.json was right - [email protected] not using
in their tsconfig.json. If you add this line to your tsconfig.json, everything works fine! |
|
Awesome 👍 I thought that might be the issue. Thanks for taking a second look @paulstelzer |
|
Hmm I don't think we should enforce the use of the When And when ...should behave exactly the same. The latter currently gives a TypeScript error: |
|
@joostfarla I appreciate what you're saying and the fix that will enable that will be included in the next release. That said the two things in ES Module world, are actually completely different. Consider a module like the one below: // Name: foobar
export function foo() {}
export default function bar() {}The syntaxes you referenced above do two different things: import thing from 'foobar';
thing() // References the function `bar` above;import * as thing from 'foobar';
thing.foo() // `thing` references an object containing `foo` and a property called `default` that references `bar`I'd recommend doing the |
|
@jshcrowthe Allright, thanx! |
This PR fixes a wrong import statement in the TypeScript example.
While using this method, I got a console warning:
But it appears this is the only way to be able to work with the full typing definitions of the SDK.
Therefore I was wondering: Is there a way to suppress this?