Skip to content

Instantly share code, notes, and snippets.

@navix
Created February 11, 2019 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save navix/bc8fc48df1fc825d4e7f67f3c5bec0c1 to your computer and use it in GitHub Desktop.
Save navix/bc8fc48df1fc825d4e7f67f3c5bec0c1 to your computer and use it in GitHub Desktop.
Import JSON into Angular 7 during build

Import JSON into Angular 7 during build

typings.d.ts

declare module '*.json' {
  const value: any;
  export default value;
}

content.ts

import * as contentRaw from './content.json';

// Declare proper types instead `any`
export const content: any = contentRaw;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment