1

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;
    export default value;
}

main.ts

 import {CFactory} from "./local";

const config =  './cacheConfig.json';

const fact = new CFactory();

const cache = fact.getObject();

cache.setConfig = config;
2
  • 2
    Is there somewhere you're pulling in the data? All you've done is assign a filename to a variable. Commented Jul 9, 2018 at 19:41
  • @jhpratt added code Commented Jul 9, 2018 at 19:44

1 Answer 1

-1

import json file in main.ts

import * as data from './json_filename.json';
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.