feat: implement AST approach for TypeScript parsing#267
Merged
Conversation
a7e2855 to
8a7951c
Compare
8a7951c to
aacceb6
Compare
This file contains hidden or 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
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.
Closes #12
Summary
This changes
sveldto preserve and use TypeScript-authored prop types from.sveltecomponents without requiring JSDoc as the primary source of truth.The parser now keeps raw
lang="ts"source for metadata extraction, indexes local TS declarations/imports, and passes internal writer-only metadata so.d.tsoutput can preserve canonical$props()types while JSON output remains stable.What Changed
<style>block for parsingComponentParser$props()declarationsexport letinterface/typealiases$props().d.tsSnippetimports in emitted declarationsBehavior Notes
Type precedence is now:
anyThis remains AST-only support. Imported or opaque whole-object
$props()types can be preserved in emitted.d.ts, but they are not always expandable into JSON metadata.Before (Svelte 5 TypeScript)
Given:
Output (before)
Output (after)