-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade Chart.js to version 3.9.1 (#2548)
* Upgrade chart.js to v. 3.9.1 * Add type guard before accessing config.type * Create helper type guard function * Apply the type guard function where needed * Bump charts.js version in nested package.json * Remove skipLibCheck from tsconfig
- Loading branch information
1 parent
c02a88f
commit 7511877
Showing
10 changed files
with
54 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
libs/designsystem/src/lib/helpers/chart-config-has-type.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ChartConfiguration, ChartConfigurationCustomTypesPerDataset } from 'chart.js'; | ||
|
||
/* | ||
Type guard is needed as of chart.js@3.8.1. The config type has been updated to a union type, | ||
and the newly added type 'ChartConfigurationCustomTypesPerDataset' does not contain the 'type' property. | ||
Typescript will throw an error, when trying to access a property that doesn't exist on all union types, | ||
unless a type guard is used. | ||
*/ | ||
|
||
export const chartConfigHasType = ( | ||
config: ChartConfiguration | ChartConfigurationCustomTypesPerDataset | ||
): config is ChartConfiguration => { | ||
return 'type' in config; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters