Skip to content

Commit

Permalink
Remove explicit null value from JSDOC type definition
Browse files Browse the repository at this point in the history
This led to the error message:
Error: Type '[number, null]' is not assignable to type 'Function | number[] | string[] | [min: number, max: number] | undefined'.
  Type '[number, null]' is not assignable to type 'Function | number[] | string[] | [min: number, max: number]'.
    Type '[number, null]' is not assignable to type '[min: number, max: number]'.
      Type at position 1 in source is not compatible with type at position 1 in target.
        Type 'null' is not assignable to type 'number'. (js)
  • Loading branch information
rgieseke committed Jul 17, 2023
1 parent 06e7e60 commit c100ae5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/content/guide/03-layercake-props.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Same as [xScale](/guide#xscale) but for the z scale. The default is `d3.scaleLin

Same as [xScale](/guide#xscale) but for the r scale. The default is [`d3.scaleSqrt()`](https://github.com/d3/d3-scale#scalesqrt).

### xDomain `Array:[min: ?Number|null, max: ?Number|null]|String[]|Number[]|Function`
### xDomain `Array:[min: ?Number, max: ?Number]|String[]|Number[]|Function`

Set a min or max on the x scale. If you want to inherit the value from the data's extent, set that value to `null`.

Expand Down Expand Up @@ -193,15 +193,15 @@ If you set a [`scaleBand`](https://github.com/d3/d3-scale#scaleband), [`scalePoi
>
```

### yDomain `Array:[min: ?Number|null, max: ?Number|null]|String[]|Number[]|Function`
### yDomain `Array:[min: ?Number, max: ?Number]|String[]|Number[]|Function`

Same as [xDomain](/guide#xdomain) but for the y scale.

### zDomain `Array:[min: ?Number|null, max: ?Number|null]|String[]|Number[]|Function`
### zDomain `Array:[min: ?Number, max: ?Number]|String[]|Number[]|Function`

Same as [xDomain](/guide#xdomain) but for the z scale.

### rDomain `Array:[min: ?Number|null, max: ?Number|null]|String[]|Number[]|Function`
### rDomain `Array:[min: ?Number, max: ?Number]|String[]|Number[]|Function`

Same as [xDomain](/guide#xdomain) but for the r scale.

Expand Down
8 changes: 4 additions & 4 deletions src/lib/LayerCake.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@
/** @type {Array|Object} [data=[]] If `data` is not a flat array of objects and you want to use any of the scales, set a flat version of the data via the `flatData` prop. */
export let data = [];
/** @type {[min: ?Number|null, max: ?Number|null]|String[]|Number[]|Function} [xDomain] Set a min or max. For linear scales, if you want to inherit the value from the data's extent, set that value to `null`. This value can also be an array because sometimes your scales are [piecewise](https://github.com/d3/d3-scale#continuous_domain) or are a list of discrete values such as in [ordinal scales](https://github.com/d3/d3-scale#ordinal-scales), useful for color series. Set it to a function that receives the computed domain and lets you return a modified domain, useful for sorting values. */
/** @type {[min: ?Number, max: ?Number]|String[]|Number[]|Function} [xDomain] Set a min or max. For linear scales, if you want to inherit the value from the data's extent, set that value to `null`. This value can also be an array because sometimes your scales are [piecewise](https://github.com/d3/d3-scale#continuous_domain) or are a list of discrete values such as in [ordinal scales](https://github.com/d3/d3-scale#ordinal-scales), useful for color series. Set it to a function that receives the computed domain and lets you return a modified domain, useful for sorting values. */
export let xDomain = undefined;
/** @type {[min: ?Number|null, max: ?Number|null]|String[]|Number[]|Function} [yDomain] Set a min or max. For linear scales, if you want to inherit the value from the data's extent, set that value to `null`. Set it to a function that receives the computed domain and lets you return a modified domain, useful for sorting values. */
/** @type {[min: ?Number, max: ?Number]|String[]|Number[]|Function} [yDomain] Set a min or max. For linear scales, if you want to inherit the value from the data's extent, set that value to `null`. Set it to a function that receives the computed domain and lets you return a modified domain, useful for sorting values. */
export let yDomain = undefined;
/** @type {[min: ?Number|null, max: ?Number|null]|String[]|Number[]|Function} [zDomain] Set a min or max. For linear scales, if you want to inherit the value from the data's extent, set that value to `null`. This value can also be an array because sometimes your scales are [piecewise](https://github.com/d3/d3-scale#continuous_domain) or are a list of discrete values such as in [ordinal scales](https://github.com/d3/d3-scale#ordinal-scales), useful for color series. Set it to a function that receives the computed domain and lets you return a modified domain, useful for sorting values. */
/** @type {[min: ?Number, max: ?Number]|String[]|Number[]|Function} [zDomain] Set a min or max. For linear scales, if you want to inherit the value from the data's extent, set that value to `null`. This value can also be an array because sometimes your scales are [piecewise](https://github.com/d3/d3-scale#continuous_domain) or are a list of discrete values such as in [ordinal scales](https://github.com/d3/d3-scale#ordinal-scales), useful for color series. Set it to a function that receives the computed domain and lets you return a modified domain, useful for sorting values. */
export let zDomain = undefined;
/** @type {[min: ?Number|null, max: ?Number|null]|String[]|Number[]|Function} [rDomain] Set a min or max. For linear scales, if you want to inherit the value from the data's extent, set that value to `null`. This value can also be an array because sometimes your scales are [piecewise](https://github.com/d3/d3-scale#continuous_domain) or are a list of discrete values such as in [ordinal scales](https://github.com/d3/d3-scale#ordinal-scales), useful for color series. Set it to a function that receives the computed domain and lets you return a modified domain, useful for sorting values. */
/** @type {[min: ?Number, max: ?Number]|String[]|Number[]|Function} [rDomain] Set a min or max. For linear scales, if you want to inherit the value from the data's extent, set that value to `null`. This value can also be an array because sometimes your scales are [piecewise](https://github.com/d3/d3-scale#continuous_domain) or are a list of discrete values such as in [ordinal scales](https://github.com/d3/d3-scale#ordinal-scales), useful for color series. Set it to a function that receives the computed domain and lets you return a modified domain, useful for sorting values. */
export let rDomain = undefined;
/** @type {Boolean|Number} [xNice=false] Applies D3's [scale.nice()](https://github.com/d3/d3-scale#continuous_nice) to the x domain. */
export let xNice = false;
Expand Down

0 comments on commit c100ae5

Please sign in to comment.