Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Handling imports of generated types (#148)
* test: failing test case * test: additional test case * feat: new util function to extract import identifiers * feat: more import utils, in their own file * feat: add new helper generating instanceof * feat: adding non-relative import handling of classes * doc: adding documentation * test: adding extend test case * clean: remove moved tests after rebase * test: union case test * fix: remove unused const * feat: allow any module import (relative & non-relative) * test: add test to cover issue #140 * fix: same behavior as #140 with 3rd party imports * feat: make arg optional * fix: update tests after Jest update * fix: typo in tests * feat: enabling refs to extra files in post-generation validation * revert switch to generic fixOptional * fix: remove instanceof handling * clean: remove wrongly commited file * clean: remove unused isRelativeModuleImport * doc: rework * fix: missing makePosixPath after rebase * test: adding failing tests * fix: typo * fix: complex array were not traversed * fix: missing TS helpers in type extractor * test: failing test case * test: additional test case * fix: same behavior as #140 with 3rd party imports * feat: add createImport function * feat: handle input / output mapping as source for generate * feat: add zod import handling from config file * doc: adding documentation for ZOD imports * refacto test * test: adding hybrid import * test: adding new test * fix: using relative to compare paths * fix: multiple fixes after rebase * fix: remove useless imports from output * update documentation * fix: build issues after rebase --------- Co-authored-by: tvillaren <tvillaren@users.noreply.github.com>
- Loading branch information
Showing
15 changed files
with
551 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Used as an import in hero.ts | ||
export interface Person { | ||
realName: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Generated by ts-to-zod | ||
import { z } from "zod"; | ||
|
||
export const personSchema = z.object({ | ||
realName: z.string(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.