-
Notifications
You must be signed in to change notification settings - Fork 39
Conversation
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.
Very cool. Think we should put anything in the README?
Codecov Report
@@ Coverage Diff @@
## master #475 +/- ##
==========================================
+ Coverage 96.89% 96.96% +0.07%
==========================================
Files 17 18 +1
Lines 869 891 +22
Branches 133 137 +4
==========================================
+ Hits 842 864 +22
Misses 3 3
Partials 24 24
Continue to review full report at Codecov.
|
@rorticus added some blurb on JSX in the README. |
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.
minor nits and suggestions
README.md
Outdated
|
||
In additional to the programatic functions `v` and `w`, widget-core supports the use of the `jsx` syntax known as [`tsx`](https://www.typescriptlang.org/docs/handbook/jsx.html) in TypeScript. | ||
|
||
To start to use `jsx` in your project the widgets need to be named with a `.tsx` extension and some configuration is required in the projects `tsconfig.json`: |
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.
projects -> project's
README.md
Outdated
} | ||
``` | ||
|
||
**Note:** Unfortunately `tsx` is not directly used so needs to be ignored by linters. |
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.
Not directly used with what? This could be clearer
README.md
Outdated
@@ -173,6 +174,51 @@ w('my-widget', properties, children); | |||
The example above that uses a string for the `widgetConstructor `, is taking advantage of the [widget registry](#widget-registry) functionality. | |||
The widget registry allows for the lazy loading of widgets. | |||
|
|||
### tsx | |||
|
|||
In additional to the programatic functions `v` and `w`, widget-core supports the use of the `jsx` syntax known as [`tsx`](https://www.typescriptlang.org/docs/handbook/jsx.html) in TypeScript. |
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.
To be slightly more explicit that this is an alternative approach:
widget-core supports the use -> widget-core optionally supports the use
tests/unit/tsx.ts
Outdated
assert.strictEqual((<any> RegistryWrapper).type, REGISTRY_ITEM); | ||
const registryWrapper = new RegistryWrapper(); | ||
assert.strictEqual(registryWrapper.name, 'tag'); | ||
// These will always be undefined but show the type inference. |
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.
"show the type inference" ... I'd be more explicit, e.g. "show the type inference of ___________"
@dylans comments addressed |
Merging as the CI failures are unrelated functional test failures. |
Type: feature
The following has been addressed in the PR:
Description:
Adds support for using
tsx
syntax to author Dojo 2 widgets within therender
function.Props to @matt-gadd for the
tsx
pragma and function implementation (the important parts!).Resolves #469