Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #5613
Closed
Open
Issue created Oct 29, 2018 by Administrator@rootContributor

Typescript does not import JSON and throws Type error

Created by: MattyBalaam

Is this a bug report?

Yes

Did you try recovering your dependencies?

Yes

Which terms did you search for in User Guide?

JSON, import JSON

Environment

System: OS: macOS High Sierra 10.13.6 CPU: x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz Binaries: Node: 10.11.0 - /usr/local/bin/node Yarn: 1.10.1 - /usr/local/bin/yarn npm: 6.4.1 - /usr/local/bin/npm Browsers: Chrome: 70.0.3538.77 Firefox: 63.0 Safari: 12.0 npmPackages: react: Not Found react-dom: Not Found react-scripts: Not Found npmGlobalPackages: create-react-app: Not Found

Steps to Reproduce

  1. add a json file to project
  2. add import json from './test.json'; to another file
  3. start compilation

Expected Behavior

Json file is imported into app and become JS object - which works in a refular .js CRA project.

Actual Behavior

Type error: Cannot compile namespaces when the '--isolatedModules' flag is provided. TS1208

screen shot 2018-10-29 at 10 19 06

Reproducible Demo

https://github.com/MattyBalaam/json-typescript-CRA-bug-report

  1. install dependencies
  2. run start
Assignee
Assign to
Time tracking