Linked Questions

1 vote
1 answer
905 views

I am trying to read data from config file, but it always returns empty. Do you have any idea what is implemented wrong here? I have added typing.d.ts: declare module "*.json" { const value: any; ...
hussain's user avatar
  • 7,183
0 votes
0 answers
76 views

I have a json file say data.json, [ { "page" : "First" , "subpage" : "FirstA", "title" : [ { "...
goku's user avatar
  • 1
118 votes
13 answers
135k views

I have an ejected create-react-app project. I am getting this error after updating it to webpack 5. It was working fine with webpack v4.41.5 OS: MacOS Catalina 10.15.7 node: v10.23.0 Error: Should ...
Muhammad Kamal's user avatar
67 votes
6 answers
83k views

So the code is simple: calls.json {"SERVER":{ "requests":{ "one":"1" } } } file.ts import json = require('../static/calls.json'); console.log(json.SERVER); the generated javascript is ...
Ken's user avatar
  • 3,156
40 votes
3 answers
54k views

In a nodej project open in VsCode with checkJs enabled, when a json file is required like const myFile = require('./my-file.json') This makes an error [ts] Cannot find module. How is it possible ...
François Romain's user avatar
13 votes
4 answers
20k views

In my Angular project I'm importing JSON files for my own little localization service. I'm using the method suggested here, updating my typings.d.ts to declare module "*.json" { const value: any;...
Thomas's user avatar
  • 4,387
29 votes
3 answers
27k views

How do I define the type for imported json? For example { "things": "foo" } interface Data { things: String, another?: String } import data from './data.json' // Should ...
Ava's user avatar
  • 2,141
8 votes
4 answers
17k views

I have updated my Angular project to version 12.0.5 and Typescript version to 4.3.4 and I am having trouble compiling the project. Currently I get the following error without having made changes to ...
six's user avatar
  • 97
7 votes
4 answers
39k views

How can I read a locally stored JSON file into a variable in typescript? I have a json file of photos that looks like this: [ { "id": 1, "camera": "", ...
Cameron Cheung's user avatar
15 votes
2 answers
12k views

I just created a clean VueJS new project and I can't get loading a JSON file to work. Reproduction / Issue For easy reproduction I've created a Github repo with my issue: https://github.com/devedse/...
Devedse's user avatar
  • 1,871
13 votes
1 answer
23k views

The setting I am referencing is shown in the snippet bellow { "compilerOptions": { "resolveJsonModule": true, } } I don't really understand why TS language engineers would ...
JAYD3V's user avatar
  • 12.5k
5 votes
2 answers
10k views

I have this simple angular project and I'm having trouble importing a local json file that I created. Here's the JSON file: { "id": 1, "firstName": "Uziel", "lastName": "Cabanban", "...
Uzi's user avatar
  • 453
1 vote
4 answers
9k views

I am new in Angular2. I would like to have a single class or a configuration file having all my API endpoints (allowing parameters and such in the different routes) that I could inject in all my ...
547n00n's user avatar
  • 1,546
5 votes
2 answers
7k views

I am learning typescript and currently trying to import simple json file which I store locally in the project bootstrapped with create-react-app. data.json looks like this: { "test": "123", } In ...
Dimitry Ivashchuk's user avatar
5 votes
3 answers
6k views

I am working on a project using Angular 4, NPM, Node.js, and the Angular CLI. I have a rather unusual need to load JSON into an Angular service (using an @Injectable) without an HTTP request, i.e. it ...
StephenRios's user avatar
  • 2,242

15 30 50 per page