Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

202
Visualizações
How to use chrome-app.d.ts type in angular-cli 1.0.1 app?

I've installed @types/chrome and add it in tsconfig.app.json

"types": [
  "chrome"
]

But when i use chrome.app in component, it show an error:

Property 'app' does not exist on type 'typeof chrome'

@types/chrome folder contains chrome-app.d.ts is a file which i need, how can I refer to this

Source https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome

about 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Since the creators of this typings definition module have chosen not to include the chrome.app.* definitions in the index.d.ts file of the @types/chrome module but instead separate them out into chrome-app.d.ts, you'll need to explicitly reference it in the file that uses those APIs:

/// <reference types="chrome/chrome-app"/>

Note that this must be at the top of the file, per the documentation for triple-slash directives in TypeScript:

https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html

Also note that it should not be necessary to add a "types": ["chrome"] reference in your tsconfig.json file, as the latest version of the TypeScript compiler should automatically import all typings definition modules found in node_modules/@types. By adding this to your config, you are telling it to only import that one module. For more on this, you can refer to the config docs:

https://www.typescriptlang.org/docs/handbook/tsconfig-json.html

about 4 years ago · Santiago Trujillo Relatório

0

Just an update for Angular CLI nowadays (June 2018) (Angular 6) you can simply do:
npm i @types/chrome
and the error will go away.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda