Skip to content

Commit d0d9e35

Browse files
authored
refactor: remove extra typescript dependency (#28220)
1 parent 0b7f6cf commit d0d9e35

File tree

10 files changed

+324
-241
lines changed

10 files changed

+324
-241
lines changed

core/package-lock.json

Lines changed: 311 additions & 227 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
"@stencil/vue-output-target": "^0.8.6",
5454
"@types/jest": "^27.5.2",
5555
"@types/node": "^14.6.0",
56-
"@typescript-eslint/eslint-plugin": "^5.17.0",
57-
"@typescript-eslint/parser": "^5.17.0",
56+
"@typescript-eslint/eslint-plugin": "^6.7.2",
57+
"@typescript-eslint/parser": "^6.7.2",
5858
"clean-css-cli": "^5.6.1",
5959
"domino": "^2.1.6",
6060
"eslint": "^7.32.0",
@@ -69,8 +69,7 @@
6969
"sass": "^1.26.10",
7070
"serve": "^14.0.1",
7171
"stylelint": "^13.13.1",
72-
"stylelint-order": "^4.1.0",
73-
"typescript": "^4.0.5"
72+
"stylelint-order": "^4.1.0"
7473
},
7574
"scripts": {
7675
"build": "npm run clean && npm run build.css && stencil build --es5 --docs-json dist/docs.json",

core/src/components/datetime/utils/helpers.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
/**
2-
* Typescript 4.x does not recognize hourCycle as a valid option.
3-
* See https://github.com/microsoft/TypeScript/issues/34399.
4-
*/
5-
interface DatetimeFormatOptions extends Intl.ResolvedDateTimeFormatOptions {
6-
hourCycle?: 'h11' | 'h12' | 'h23' | 'h24';
7-
}
8-
91
/**
102
* Determines if given year is a
113
* leap year. Returns `true` if year
@@ -32,7 +24,7 @@ export const is24Hour = (locale: string, hourCycle?: 'h23' | 'h12') => {
3224
* option into the locale string. Example: `en-US-u-hc-h23`
3325
*/
3426
const formatted = new Intl.DateTimeFormat(locale, { hour: 'numeric' });
35-
const options = formatted.resolvedOptions() as DatetimeFormatOptions;
27+
const options = formatted.resolvedOptions();
3628
if (options.hourCycle !== undefined) {
3729
return options.hourCycle === 'h23';
3830
}

core/src/components/nav/nav.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,7 @@ export class Nav implements NavOutlet {
901901
: undefined;
902902
const mode = getIonMode(this);
903903
const enteringEl = enteringView.element!;
904+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
904905
const leavingEl = leavingView && leavingView.element!;
905906
const animationOpts: TransitionOptions = {
906907
mode,

core/src/components/router/router.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ export class Router implements ComponentInterface {
312312
const routes = readRoutes(this.el);
313313

314314
const fromChain = findChainForSegments(from, routes);
315+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
315316
const beforeLeaveHook = fromChain && fromChain[fromChain.length - 1].beforeLeave;
316317

317318
const canLeave = beforeLeaveHook ? await beforeLeaveHook() : true;
@@ -320,6 +321,7 @@ export class Router implements ComponentInterface {
320321
}
321322

322323
const toChain = findChainForSegments(to, routes);
324+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
323325
const beforeEnterHook = toChain && toChain[toChain.length - 1].beforeEnter;
324326

325327
return beforeEnterHook ? beforeEnterHook() : true;

core/src/components/router/utils/path.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const chainToSegments = (chain: RouteChain): string[] | null => {
4848
for (const route of chain) {
4949
for (const segment of route.segments) {
5050
if (segment[0] === ':') {
51+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
5152
const param = route.params && route.params[segment.slice(1)];
5253
if (!param) {
5354
return null;

core/src/utils/native/haptic.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ const HapticEngine = {
9696
* if the browser does not support the Vibrate API.
9797
*/
9898
if (capacitor?.getPlatform() === 'web') {
99+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
99100
return typeof navigator !== 'undefined' && navigator.vibrate !== undefined;
100101
}
101102

core/src/utils/overlays.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export const createOverlay = <T extends HTMLIonOverlayElement>(
9595
tagName: string,
9696
opts: object | undefined
9797
): Promise<T> => {
98+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
9899
if (typeof window !== 'undefined' && typeof window.customElements !== 'undefined') {
99100
return window.customElements.whenDefined(tagName).then(() => {
100101
const element = document.createElement(tagName) as HTMLIonOverlayElement;

core/src/utils/transition/ios.transition.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ export const iosTransitionAnimation = (navEl: HTMLElement, opts: TransitionOptio
294294
.fill('both')
295295
.beforeRemoveClass('ion-page-invisible');
296296

297+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
297298
if (leavingEl && navEl !== null && navEl !== undefined) {
298299
const navDecorAnimation = createAnimation();
299300
navDecorAnimation.addElement(navEl);

core/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"dom",
1515
"dom.iterable",
1616
"es2017",
17-
"es2020"
17+
"es2020",
18+
"es2021"
1819
],
1920
"module": "esnext",
2021
"moduleResolution": "node",

0 commit comments

Comments
 (0)