I'm trying out the Angular to develop google extension, but found that I can't reference the chrome
object without generating the
ERROR in E:/ChromeExtensions/.../node_modules/chrome-promise/chrome-promise.d.ts (2160,66): Cannot find namespace 'chrome'.
or
ERROR in E:/ChromeExtensions/.../src/app/chrome-tabs.servi ce.ts (14,7): Cannot find name 'chrome'.
I have added chrome typings npm install --save @types/chrome
but all it gave me was, just typings, but it doesnt resolves build errors.
If that matters:
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
@angular/cli: 1.4.9
node: 6.11.4
os: win32 x64
@angular/animations: 4.4.6
@angular/common: 4.4.6
@angular/compiler: 4.4.6
@angular/core: 4.4.6
@angular/forms: 4.4.6
@angular/http: 4.4.6
@angular/platform-browser: 4.4.6
@angular/platform-browser-dynamic: 4.4.6
@angular/router: 4.4.6
@angular/cli: 1.4.9
@angular/compiler-cli: 4.4.6
@angular/language-service: 4.4.6
typescript: 2.3.4
Visual Studio Code 1.17.2
Any suggestions?
Based on How to use chrome-app.d.ts type in angular-cli 1.0.1 app?
@types/chrome
to package.json/// <reference types="chrome"/>
to the top of my ts fileUpdate for 2019:
There's no need to use /// <reference types="chrome"/>
anymore. npm i @types/chrome
should be enough.
This sometimes happens when you clone a repo that already has a @types
library installed. npm i
doesn't get it done, but if you install the @types
library again, it should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With