YousefED / typescript-json-schema

Generate json-schema from your Typescript sources
BSD 3-Clause "New" or "Revised" License
3.17k stars 323 forks source link

imports with resolution-mode not replaced #582

Open jer-sen opened 11 months ago

jer-sen commented 11 months ago

With my new TS config I have some imports in the output such as:

 "type": "object"
    },
    "import(\"apps/src/fileExportingTypes\",{assert:{\"resolution-mode\":\"import\"}}).MyType": {
      "anyOf": [

Fixing this regex make them disappear:

var REGEX_FILE_NAME_OR_SPACE = /(\bimport\(".*?"(, \{ assert: \{ "resolution-mode": "(import|require)" \} \})?\)|".*?")\.| /g;

FoxxMD commented 9 months ago

Also worked for me. Thanks for that :+1:

puckey commented 1 month ago

I was getting "import(\"/Users/user/path\",{with:{\"resolution-mode\":\"import\"}}).MyType"

This regex fixed things for me: const REGEX_FILE_NAME_OR_SPACE =/(\bimport\(".*?"(, [^)]+)?\)|".*?")\.| /g;