-
-
Notifications
You must be signed in to change notification settings - Fork 3
types: support xastscript used as JSX in typescript #7
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** @jsx x */ | ||
import x = require('xastscript') | ||
Comment on lines
+1
to
+2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two notes:
vs
and I'd like to avoid splitting the typing just for a header. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’d just drop support for TypeScript < 4. New users will probably already use the latest TypeScript, and users upgrading hastscript are likely to upgrade TypeScript to the latest version in the same change. I know I didn’t encounter any issues when upgrading TypeScript any of my projects. |
||
|
||
const xmlns = 'http://www.sitemaps.org/schemas/sitemap/0.9' | ||
const xmlNumberAttribute = 100 | ||
|
||
const t0 = <urlset /> // $ExpectType Element | ||
const t1 = <urlset xmlns={xmlns} /> // $ExpectType Element | ||
const t2 = <urlset xmlNumberAttribute={xmlNumberAttribute} /> // $ExpectType Element | ||
const t3 = <urlset>string</urlset> // $ExpectType Element | ||
// $ExpectType Element | ||
const t4 = ( | ||
<urlset> | ||
<text /> | ||
</urlset> | ||
) | ||
// $ExpectType Element | ||
const t5 = <urlset>text</urlset> | ||
// $ExpectType Element | ||
const t6 = ( | ||
<urlset> | ||
<text /> | ||
<text /> | ||
</urlset> | ||
) | ||
// $ExpectType Element | ||
const t7 = ( | ||
<urlset> | ||
test | ||
<text /> | ||
</urlset> | ||
) | ||
// $ExpectType Element | ||
const t8 = ( | ||
<urlset> | ||
{['a', 'b'].map((value) => ( | ||
<text>{value}</text> | ||
))} | ||
</urlset> | ||
) | ||
const t9 = <urlset xmlns /> // $ExpectError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following tests are is missing:
To fix this, this line should be changed to:
This might interfere with support for fragments though.