Skip to content

Commit

Permalink
small type definition fix (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
zerico007 authored Jun 7, 2023
1 parent e580dba commit 4de563a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- `options` - An set of parameters.

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

- When specifying Array or Object as the type, the string passed into the attribute must pass `JSON.parse()` requirements.
- 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`.
Expand All @@ -20,10 +20,7 @@
returned. This class is of type CustomElementConstructor can be directly passed to `customElements.define` as follows:

```js
customElements.define(
"web-greeting",
reactToWebComponent(Greeting),
)
customElements.define("web-greeting", reactToWebComponent(Greeting))
```

Or the class can be defined and used later:
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { R2WCType } from "./transforms"

import transforms from "./transforms"

type PropName<Props> = Extract<keyof Props, "string">
type PropName<Props> = Extract<keyof Props, string>
type PropNames<Props> = Array<PropName<Props>>

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

0 comments on commit 4de563a

Please sign in to comment.