Skip to content

Commit 4de563a

Browse files
authored
small type definition fix (#118)
1 parent e580dba commit 4de563a

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

docs/api.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- `options` - An set of parameters.
88

99
- `options.shadow` - Use shadow DOM rather than light DOM.
10-
- `options.props` - Array of camelCasedProps to watch as String values or { [camelCasedProps]: String | Number | Boolean | Function | Object | Array | "ref" }
10+
- `options.props` - Array of camelCasedProps to watch as String values or { [camelCasedProps]: "string" | "number" | "boolean" | "function" | "json" }
1111

1212
- When specifying Array or Object as the type, the string passed into the attribute must pass `JSON.parse()` requirements.
1313
- When specifying Boolean as the type, "true", "1", "yes", "TRUE", and "t" are mapped to `true`. All strings NOT begining with t, T, 1, y, or Y will be `false`.
@@ -20,10 +20,7 @@
2020
returned. This class is of type CustomElementConstructor can be directly passed to `customElements.define` as follows:
2121

2222
```js
23-
customElements.define(
24-
"web-greeting",
25-
reactToWebComponent(Greeting),
26-
)
23+
customElements.define("web-greeting", reactToWebComponent(Greeting))
2724
```
2825

2926
Or the class can be defined and used later:

packages/core/src/core.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { R2WCType } from "./transforms"
22

33
import transforms from "./transforms"
44

5-
type PropName<Props> = Extract<keyof Props, "string">
5+
type PropName<Props> = Extract<keyof Props, string>
66
type PropNames<Props> = Array<PropName<Props>>
77

88
export interface R2WCOptions<Props> {
@@ -30,7 +30,7 @@ const propsSymbol = Symbol.for("r2wc.props")
3030
* @param {ReactComponent}
3131
* @param {Object} options - Optional parameters
3232
* @param {String?} options.shadow - Shadow DOM mode as either open or closed.
33-
* @param {Object|Array?} options.props - Array of camelCasedProps to watch as Strings or { [camelCasedProp]: String | Number | Boolean | Function | Object | Array }
33+
* @param {Object|Array?} options.props - Array of camelCasedProps to watch as Strings or { [camelCasedProp]: "string" | "number" | "boolean" | "function" | "json" }
3434
*/
3535
export default function r2wc<Props, Context>(
3636
ReactComponent: React.ComponentType<Props>,

0 commit comments

Comments
 (0)