-
Notifications
You must be signed in to change notification settings - Fork 781
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(typescript): add support for typescript 4.9 (#3863)
this commit increments typescript to v4.9 for the project, and updates the dependabot configuration to not create a pull request for a version of typescript newer than 4.9. the `@types/node` package for the karma test suite is updated as a part of this commit, as the currently installed version has problems being parsed by v4.9. this is fixed in the type declarations themselves, hence the upgrade. the remainder of the changes in this pr are for fixing type errors where there is no overlap between two types being compared. this occurs in two scenarios: 1. parsing css. in the css parser, there were three cases where an overlap did not occur in a comparison. in reading through the code, i cannot find a scenario where such a value could be returned such that the comparison is valid. as a result, such comparisons are removed. prior to removing these comparisons, an alternative (else block) was written with a logging statement in it. stencil's unit/karma tests were run, as well as the ionic framework's tests with this branch installed. the logging statement was never triggered. that in addition to the rich testing available for css, makes us confident that this change is safe to make. 2. validation of a configuration flag. this occurred for the dev server, hydration config, and service worker config. these fields _should_ be properly set via type checking. if users are providing invalid values, the logic has been updated to be type-safe while setting reasonable default values
- Loading branch information
1 parent
2e4b1fc
commit 542c46a
Showing
14 changed files
with
81 additions
and
38 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
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
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,37 @@ | ||
import * as d from '@stencil/core/declarations'; | ||
|
||
import { validateHydrated } from '../validate-hydrated'; | ||
|
||
describe('validate-hydrated', () => { | ||
describe('validateHydrated', () => { | ||
let inputConfig: d.UnvalidatedConfig; | ||
let inputHydrateFlagConfig: d.HydratedFlag; | ||
|
||
beforeEach(() => { | ||
inputHydrateFlagConfig = {}; | ||
inputConfig = { | ||
hydratedFlag: inputHydrateFlagConfig, | ||
}; | ||
}); | ||
|
||
it.each([null, false])('returns undefined for hydratedFlag=%s', (badValue) => { | ||
// this test explicitly checks for a bad value in the stencil.config file, hence the type assertion | ||
(inputConfig.hydratedFlag as any) = badValue; | ||
const actual = validateHydrated(inputConfig); | ||
expect(actual).toBeUndefined(); | ||
}); | ||
|
||
it.each([[], true])('returns a default value when hydratedFlag=%s', (badValue) => { | ||
// this test explicitly checks for a bad value in the stencil.config file, hence the type assertion | ||
(inputConfig.hydratedFlag as any) = badValue; | ||
const actual = validateHydrated(inputConfig); | ||
expect(actual).toEqual<d.HydratedFlag>({ | ||
hydratedValue: 'inherit', | ||
initialValue: 'hidden', | ||
name: 'hydrated', | ||
property: 'visibility', | ||
selector: 'class', | ||
}); | ||
}); | ||
}); | ||
}); |
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
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
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