Create class/component from string

Say i have a file like below on the server eg Github. I want to download the file as string with fetch and then be able to convert it to an object that i could use.

OBS: all import and the interface exist on locally so there wont be any thing missing.

import parser from '../interface/parsers';
import '../interface/extension';

export default class test implements parser {
  public name: string;
  constructor() {
  
    }
  
  }

23 thoughts on “Create class/component from string”