Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,28 @@ describe('Test Typescript component metadata generation', () => {
expect(propType.value.value[0].name).toBe('string');
expect(propType.value.value[1].name).toBe('shape');
});
test('Union of primitives and arrays of primitives', () => {
const propType = R.path(
propPath('TypeScriptComponent', 'array_primitive_mix').concat(
'type'
),
metadata
);
expect(propType.name).toBe('union');
expect(propType.value.length).toBe(4);
expect(propType.value[0].name).toBe('string');
expect(propType.value[1].name).toBe('number');
expect(propType.value[2].name).toBe('bool');
expect(propType.value[3].name).toBe('arrayOf');

// Verify that the array element type is a union of string, number, and boolean
const arrayElementType = propType.value[3].value;
expect(arrayElementType.name).toBe('union');
expect(arrayElementType.value.length).toBe(3);
expect(arrayElementType.value[0].name).toBe('string');
expect(arrayElementType.value[1].name).toBe('number');
expect(arrayElementType.value[2].name).toBe('bool');
});
test('Obj properties', () => {
const propType = R.path(
propPath('TypeScriptComponent', 'obj').concat('type', 'value'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const TypeScriptComponent = ({
bool_default = true,
null_default = null,
obj_default = { a: 'a', b: 3 },
array_primitive_mix = 1,
...props
}: TypescriptComponentProps) => {
return <div id={id}>{required_string}</div>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ export type TypescriptComponentProps = {
union?: number | string;
union_shape?: {a: string} | string;
array_union_shape?: ({a: string} | string)[];
array_primitive_mix?:
| string
| number
| (string | number | boolean)[]
| boolean;
element?: JSX.Element;
array_elements?: JSX.Element[];

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
All notable changes to `dash` will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/).

## [UNRELEASED]

## Added
- [#3440](https://github.com/plotly/dash/pull/3440) Modernize dcc.Dropdown

## [4.0.0rc0] - 2025-09-11
- [#3398](https://github.com/plotly/dash/pull/3398) Modernize dcc.Input
- [#3414](https://github.com/plotly/dash/pull/3414) Modernize dcc.Slider
Expand Down
Loading