Code Monkey home page Code Monkey logo

Comments (10)

brownoxford avatar brownoxford commented on September 14, 2024 1

Hmm, here are my imports for the working capacitor v2 implementation where I got that screenshot:

import { Plugins } from "@capacitor/core";
import "@capacitor-community/firebase-analytics";

const { FirebaseAnalytics } = Plugins;

It looks like your first implementation may not have been working because you were not also importing "@capacitor-community/firebase-analytics" - you need that import because it actually exports all of the definitions for the plugin via export * from './definitions'

import { Plugins } from '@capacitor/core';
const { FirebaseAnalytics } = Plugins;

The new style you show is only for capacitor v3, so I would not use that unless you are upgrading:

# Capacitor V3 only
import { FirebaseAnalytics } from '@capacitor-community/firebase-analytics';

from firebase-analytics.

michalsisak avatar michalsisak commented on September 14, 2024 1

@brownoxford Importing import "@capacitor-community/firebase-analytics"; solved the issue! Thank you. Will close the issue now.

from firebase-analytics.

HeikoKanzler avatar HeikoKanzler commented on September 14, 2024

Same issue here, just started with the plugin and can't get any TypesScript support in VSCode.
Did you find a solution?

from firebase-analytics.

michalsisak avatar michalsisak commented on September 14, 2024

Nothing, this repo seems not being actively maintained.

from firebase-analytics.

HeikoKanzler avatar HeikoKanzler commented on September 14, 2024

Yeah, I think so. The Crashalytics Repo seems also to be outdated. I am fine without code insight, but I am worried about the maintenance of the plugins.

from firebase-analytics.

markxoe avatar markxoe commented on September 14, 2024

Same here, but with many community Plugins

Edit:
I know that generating a Plugin generates Types (definitions.(d.)ts) but VSCode seems to not recognise them as it is implemented with

declare module '@capacitor/core' {
    interface PluginRegistry {
        ...
    }
}

Maybe this is the Problem that VSCode is not able to read those informarions

from firebase-analytics.

gugahoi avatar gugahoi commented on September 14, 2024

It's been a couple of months since the last comment. Has anyone found any kind of progress here? Any custom definitions being used in the wild?

from firebase-analytics.

brownoxford avatar brownoxford commented on September 14, 2024

Screen Shot 2021-03-26 at 1 28 53 PM

This seems to be working since the 0.2.0 release, are you still having this problem?

from firebase-analytics.

michalsisak avatar michalsisak commented on September 14, 2024

I see this repo is starting to come alive. Many thanks @brownoxford for this!

Your comment made me try different builds and different aproaches. I was already on 0.2.0 release, I tried 0.2.1 but still no luck.

Then I tried changing way how the package is imported.

Importing this way worked:

import { FirebaseAnalytics } from '@capacitor-community/firebase-analytics';

The problem occurs when we import package as recommended by Capacitor docs:

A common mistake is to import a plugin directly, then use the plugin API immediately, resulting in the web implementation being used:
By using the plugins from the plugin registry (Plugins object), the native implementation of the plugin is used (if available), with fallback to the web version.

import { Plugins, Capacitor } from '@capacitor/core';
const { FirebaseAnalytics } = Plugins;

Not sure as to how manage getting code insight with this approach.

from firebase-analytics.

brownoxford avatar brownoxford commented on September 14, 2024

@michalsisak did the updated import fix the issue for you?

from firebase-analytics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.