Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

126
Vistas
How to import a single property named with dot notation from package.json?

SonarQube detects the following code as a mistake ("Wildcard imports should not be used") :

import * as packageJson from '../../../package.json';

We use only a few of properties contained in package.json

For instance, no problem for the version, I can use that :

import { version } from '../../../package.json';

In our package.json , I want to use a property named with dot notation :

...
"project.id": "123456",
...

But the following import gives me a compilation error :

import {['project.id'] as projectId } from '../../../package.json';
error TS1141: String literal expected.

How to get correctly this single project.id property from package.json ? I don't want to rename it.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

One solution you can change project in your package.json as below

"project":  {
   "id": "123456"
 }

and import like

import { project } from '../../project.json';
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda