Ionic Capacitor Admob simple example fails with type?

Viewed 123

I am trying to integrate the Capacitor Admob by the example

https://ionicframework.com/docs/native/admob

but

import { Admob } from '@ionic-native/admob';

...

constructor(private admob: Admob)

fails with

[ng]     ERROR in src/app/map/map.page.ts:81:30 - error TS2749: 'Admob' refers to a value, but is being used as a type here.
[ng]     
[ng]     81               private admob: Admob,

? Why should the example break?

2 Answers

I have run into this "gotcha" as well. You need to import import { Admob } from '@ionic-native/admob/ngx'; as this is the portion that indicates to import the angular specific version.

According to the docs, "Capacitor Not compatible."

This may be of use?

Capacitor AdMob

Related