Skip to content

Commit

Permalink
test(fixtures): fix generics-multiple example (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
metonym authored Oct 25, 2024
1 parent 3e38573 commit 3826acb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions tests/__snapshots__/fixtures.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ exports[`fixtures (JSON) "generics-multiple/input.svelte" 1`] = `
},
{
"type": "{ key: DataTableKey<Row>; value: Header; }",
"name": "DataTableHeader<Row=DataTableRow,Header>",
"ts": "interface DataTableHeader<Row=DataTableRow,Header> { key: DataTableKey<Row>; value: Header; }"
"name": "DataTableHeader<Row=DataTableRow,Header=DataTableRow>",
"ts": "interface DataTableHeader<Row=DataTableRow,Header=DataTableRow> { key: DataTableKey<Row>; value: Header; }"
}
],
"generics": [
"Row,Header",
"Row extends DataTableRow = DataTableRow, Header extends DataTableRow"
"Row extends DataTableRow = DataTableRow, Header extends DataTableRow = DataTableRow"
]
}"
`;
Expand Down Expand Up @@ -1301,7 +1301,7 @@ export interface DataTableRow {
export type DataTableKey<Row> = Exclude<keyof Row, "id">;
export interface DataTableHeader<Row = DataTableRow, Header> {
export interface DataTableHeader<Row = DataTableRow, Header = DataTableRow> {
key: DataTableKey<Row>;
value: Header;
}
Expand All @@ -1320,7 +1320,7 @@ export interface GenericsMultipleProps<Row, Header> {
export default class GenericsMultiple<
Row extends DataTableRow = DataTableRow,
Header extends DataTableRow
Header extends DataTableRow = DataTableRow
> extends SvelteComponentTyped<
GenericsMultipleProps<Row, Header>,
Record<string, any>,
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/generics-multiple/input.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
/**
* @typedef {{ id: string | number; [key: string]: any; }} DataTableRow
* @typedef {Exclude<keyof Row, "id">} DataTableKey<Row>
* @typedef {{ key: DataTableKey<Row>; value: Header; }} DataTableHeader<Row=DataTableRow,Header>
* @typedef {{ key: DataTableKey<Row>; value: Header; }} DataTableHeader<Row=DataTableRow,Header=DataTableRow>
* @template {DataTableRow} <Row extends DataTableRow = DataTableRow>
* @generics {Row extends DataTableRow = DataTableRow, Header extends DataTableRow} Row,Header
* @generics {Row extends DataTableRow = DataTableRow, Header extends DataTableRow = DataTableRow} Row,Header
*/
/** @type {ReadonlyArray<DataTableHeader<Row, Header>>} */
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/generics-multiple/output.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface DataTableRow {

export type DataTableKey<Row> = Exclude<keyof Row, "id">;

export interface DataTableHeader<Row = DataTableRow, Header> {
export interface DataTableHeader<Row = DataTableRow, Header = DataTableRow> {
key: DataTableKey<Row>;
value: Header;
}
Expand All @@ -26,7 +26,7 @@ export interface GenericsMultipleProps<Row, Header> {

export default class GenericsMultiple<
Row extends DataTableRow = DataTableRow,
Header extends DataTableRow
Header extends DataTableRow = DataTableRow
> extends SvelteComponentTyped<
GenericsMultipleProps<Row, Header>,
Record<string, any>,
Expand Down
6 changes: 3 additions & 3 deletions tests/fixtures/generics-multiple/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
},
{
"type": "{ key: DataTableKey<Row>; value: Header; }",
"name": "DataTableHeader<Row=DataTableRow,Header>",
"ts": "interface DataTableHeader<Row=DataTableRow,Header> { key: DataTableKey<Row>; value: Header; }"
"name": "DataTableHeader<Row=DataTableRow,Header=DataTableRow>",
"ts": "interface DataTableHeader<Row=DataTableRow,Header=DataTableRow> { key: DataTableKey<Row>; value: Header; }"
}
],
"generics": [
"Row,Header",
"Row extends DataTableRow = DataTableRow, Header extends DataTableRow"
"Row extends DataTableRow = DataTableRow, Header extends DataTableRow = DataTableRow"
]
}

0 comments on commit 3826acb

Please sign in to comment.