-
Notifications
You must be signed in to change notification settings - Fork 2
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
union and external types #744 #748 #751
Merged
Merged
Conversation
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
* wip * feat: solve handler types using local imports * use defaultValue instead of selected * wip: ready to demo local imports * wip external * wip rewrite using go to definition TS api * dont recreate the project * wip * module resoltion for external modules * try using other methods to get the definition * fix: create project after zipper project change. i.e change from `zipper-changelog` to `feature-flag-example` * wip: parse external types (fully working!) * wip * fix: parsing actions * parseCode -> parseFile * fix: boot info parse * fix: app router parse * fix: schedule modal input parse * fix: make handle add input work * fix: explicit fetch origin to get the external bundle * feat: add support for handler type { foo: ExternalType } * feat: support for interfaces * remove satisfies because jest hates it * fix: unwrap type literal from type declaration * remove console.log * fix: await parseActions * chore: use getZipperDotDevUrl * clean stuff
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Doing another PR since I messed up with the merge order of the older PRs 🤦
Union Types
This PR adds proper support for
literal type
union type
array of union types
External Types
This PR enable us to import types and use they in the handler function, creating UI using those imported types.
Due to the Issue 1 and a bit of Issue 4, this PR only works with external imports types inside zipper.dev.
How?
The parse function now takes a context: the
Project
fromts-morph
With this context, we can navigate around, filling holes with type definition from other files.
This context persist after the parser, we're creating the Project once per project
The major issue is the remote imports, we need them in our context too.
We're adding those remote modules when we can't find the module in the local context, then, we check if the import is an external one, if so, we fetch the bundle using the
/api/editor/ts/bundle/x?=<specifier>
endpoint. [1] [2]With the remote module in our context, we can proceed to use the compiler to get the definition.
[1] Issue: The import specifier is the raw specifier. The bundle/x endpoint returns specifiers with version, which may be different from the original import specifier, due to the rewrite specifier rules. ❓
[2] Possible issue: We're adding external modules to the Project, but we're not removing the unneeded modules. (not planning to fix it rn)
[3] Issue: External types solving only triggers on the second parse execution, after a keystroke on the editor
[4] Issue: We're not parsing
interface A extends B
. We can do this later, improving the parse type (concrete, resolved typescript type, and not type node)