Skip to content

Commit 6b2e7f1

Browse files
docs: #232 document signals typescript support (#265)
1 parent 2d0a4eb commit 6b2e7f1

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

docs/pages/docs.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,8 @@ So taking the above counter example, enable the inferred observability behavior
620620

621621
<!-- prettier-ignore-end -->
622622

623+
#### Signals Support
624+
623625
It is required to setup `Signal` as a global in the browser, and add import maps for the polyfill and WCC's `effect` function in the `<head>` of your HTML page(s):
624626
625627
<!-- prettier-ignore-start -->
@@ -646,7 +648,26 @@ It is required to setup `Signal` as a global in the browser, and add import maps
646648
647649
<!-- prettier-ignore-end -->
648650
649-
Some notes / limitations:
651+
For TypeScript support, you'll need to expose the Signal type-definition globally:
652+
653+
<!-- prettier-ignore-start -->
654+
655+
<wcc-ctc-block variant="snippet" heading="src/globals.d.ts">
656+
657+
```ts
658+
// alias Signal to avoid name conflicts with the global Signal type
659+
import { Signal as SignalInterface } from "signal-polyfill";
660+
661+
declare global {
662+
const Signal: typeof SignalInterface;
663+
}
664+
```
665+
666+
</wcc-ctc-block>
667+
668+
<!-- prettier-ignore-end -->
669+
670+
#### Limitations
650671

651672
- Reactivity is [only supported at one depth of the JSX tree](https://github.com/ProjectEvergreen/wcc/issues/256)
652673
- Please be aware of the above linked discussion and issue filter which is tracking any known bugs / feature requests / open items related to all things WCC + JSX.

0 commit comments

Comments
 (0)