Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

387
Views
Error TS2307: no se puede encontrar el módulo '../constants' o sus declaraciones de tipo correspondientes

Actualmente recibo el error al intentar importar. Cualquier ayuda o sugerencia será muy apreciada.

pestañas.tsx | src>navegación>tabs.tsx

 import React from 'react' import { StyleSheet, View, Image, Text } from 'react-native' import {createBottomTabNavigator, BottomTabBar} from "@react-navigation/bottom-tabs" import {icons} from '../constants' const Tab = createBottomTabNavigator()

Estructura

ingrese la descripción de la imagen aquí

tsconfig.json

 { "compilerOptions": { "target": "esnext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "lib": ["es2017"], /* Specify library files to be included in the compilation. */ "allowJs": true, /* Allow javascript files to be compiled. */ "jsx": "react-native", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ "noEmit": true, /* Do not emit outputs. */ "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ "strict": true, /* Enable all strict type-checking options. */ "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ "skipLibCheck": false, /* Skip type checking of declaration files. */ "resolveJsonModule": true /* Allows importing modules with a '.json' extension, which is a common practice in node projects. */ }, "exclude": [ "node_modules", "babel.config.js", "metro.config.js", "jest.config.js" ] }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

El error le dice que no hay nada que import desde la ubicación a la que apunta actualmente.

import -ing from a folder en realidad busca un archivo index.[d.](t|j)s en esa carpeta. Si ese archivo existe y tiene una exportación predeterminada, puede asignar un nombre a la exportación en el ámbito local, en la importación:

 import stuff from '../constants'

Si contiene exportaciones con nombre, puede importarlas usando corchetes:

 import { myExport } from '../constants' //or import { myExport as localName } from '../constants'

Nota: lo anterior implica que su index.ts contiene algo como:

 export const myExport = (/* some expression */) // you can export types, consts, functions, classes, interfaces, etc...

Si desea importar todas las exportaciones con nombre de ese archivo, use * :

 import * from '../constants' // myExport is now usable // or namespaced: import * as local from '../constants' // (and use as local.myExport)

Más ejemplos aquí .
Especificaciones aquí .

Si colocó un archivo llamado icons.ts , con una exportación predeterminada, en la carpeta /constants , su importación debería verse así:

 import icons from '../constants/icons' // or, for a named export import { icons } from '../constants/icons'
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!