Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imports with resolution-mode not replaced #582

Open
jer-sen opened this issue Dec 12, 2023 · 2 comments · May be fixed by #595
Open

imports with resolution-mode not replaced #582

jer-sen opened this issue Dec 12, 2023 · 2 comments · May be fixed by #595

Comments

@jer-sen
Copy link

jer-sen commented Dec 12, 2023

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
Copy link

FoxxMD commented Feb 14, 2024

Also worked for me. Thanks for that 👍

FoxxMD added a commit to FoxxMD/multi-scrobbler that referenced this issue Feb 14, 2024
Changing tsconfig resolution caused generation to generate new (bad?) import lines. Replacing with regex from YousefED/typescript-json-schema#582 returned ref/definitions to normal
FoxxMD added a commit to FoxxMD/endlessh-notify that referenced this issue Feb 14, 2024
Using tsconfig NodeNext resolution caused generation to generate bad(?) import lines. Replacing with regex from YousefED/typescript-json-schema#582 returned ref/definitions to normal and enables actually using validation
FoxxMD added a commit to FoxxMD/typescript-json-schema that referenced this issue Apr 3, 2024
FoxxMD added a commit to FoxxMD/multi-scrobbler that referenced this issue Oct 11, 2024
Still missing a bunch of definitions, unfortunately.

YousefED/typescript-json-schema#582
@puckey
Copy link

puckey commented Oct 31, 2024

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants