bbovenzi commented on PR #26463:
URL: https://github.com/apache/airflow/pull/26463#issuecomment-1252467789
> Anyone have a recommendation for the best way to fix this? Typescript is
not my forte.
>
> ```
> static/js/api/useGridData.test.ts:39:7 - error TS2322: Type '{ runId:
string; executionDate: string; dataIntervalStart: string; dataIntervalEnd:
string; runType: string; startDate: null; endDate: null;
lastSchedulingDecision: null; state: "success"; }' is not assignable to type
'DagRun'.
> Types of property 'runType' are incompatible.
> Type 'string' is not assignable to type '"backfill" | "manual" |
"scheduled" | "dataset_triggered"'.
>
> 39 { state: 'success', ...commonDagRunParams },
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ```
Typescript isn't interpreting the string as the real enum. We can either do
an `as` casting or define `runType` before `commonDagRunParams` like so:
```
const runType: DagRun['runType'] = 'scheduled';
const commonDagRunParams = {
runId: 'runId',
executionDate: '2022-01-01T10:00+00:00',
dataIntervalStart: '2022-01-01T05:00+00:00',
dataIntervalEnd: '2022-01-01T10:00+00:00',
runType,
startDate: null,
endDate: null,
lastSchedulingDecision: null,
};
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]