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

167
Vistas
Issue with importing entire file such as parameters.js

I am recently having to deal with the following issue:

TS2339: Property 'activityTime' does not exist on type 'typeof import...'

In our project we commonly import our parameters.js as the following:

import * as params from 'parameters'

But parameters.js are kept locally and does not always contain optional configs. So the following code just gets flagged:

if (params.activityTime) {
// do something
}

We have quite a few of these throughout the project and adding @ts-ignore everywhere just gets messy.

I had thought about doing something like const p: any = params; in every place where params are imported, but that creates additional const in most of the files so I ended up discard that approach.

Without altering our parameters.js, is there a way to cast params as any?

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

0

You can declare the variable, so that TypeScript knows its type:

import * as params from './parameters';

declare const params: {
  activityTime?: number;
};
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