Skip to content

Commit

Permalink
chore: rename d.ts files to t.ts to resolve skipLibCheck issue (#…
Browse files Browse the repository at this point in the history
…892)

* chore: move to t.ts files to address skipLibCheck issue

* chore: rename global file as well

* refactor: update latest code
  • Loading branch information
Lodin committed Nov 4, 2024
1 parent 41849b1 commit ba77154
Show file tree
Hide file tree
Showing 23 changed files with 31 additions and 24 deletions.
2 changes: 1 addition & 1 deletion scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const root = new URL('../', import.meta.url);

const [packageJson, entryPoints] = await Promise.all([
readFile(new URL('package.json', root), 'utf8').then(JSON.parse) as Promise<PackageJson>,
glob('src/**/*.{ts,tsx}', { ignore: ['**/*.d.ts'] }),
glob('src/**/*.{ts,tsx}', { ignore: ['**/*.t.ts'] }),
]);

await build({
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from './router.js';
export type * from './types.js';
export type * from './v1-compat.js';
export type * from './types.t.js';
export type * from './v1-compat.t.js';
export {
processNewChildren,
amend,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/resolver/generateUrls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import { parse, type ParseOptions, type Token, tokensToFunction, type TokensToFunctionOptions } from 'path-to-regexp';
import type { EmptyObject, Writable } from 'type-fest';
import Resolver from './resolver.js';
import type { ChildrenCallback, IndexedParams, Params, Route } from './types.js';
import type { ChildrenCallback, IndexedParams, Params, Route } from './types.t.js';
import { getRoutePath, isString } from './utils.js';

export type UrlParams = Readonly<Record<string, ReadonlyArray<number | string> | number | string>>;
Expand Down
2 changes: 1 addition & 1 deletion src/resolver/matchPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import { type Key, pathToRegexp } from 'path-to-regexp';
import type { Writable } from 'type-fest';
import type { IndexedParams } from '../types.js';
import type { IndexedParams } from '../types.t.js';
import { resolvePath } from './utils.js';

export interface RegExpExecOptArray extends ReadonlyArray<string | undefined> {
Expand Down
2 changes: 1 addition & 1 deletion src/resolver/matchRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import type { Key } from 'path-to-regexp';
import matchPath, { type Match } from './matchPath.js';
import type { IndexedParams, Route } from './types.js';
import type { IndexedParams, Route } from './types.t.js';
import { getRoutePath, unwrapChildren } from './utils.js';

export type MatchWithRoute<T, R extends object, C extends object> = Match &
Expand Down
2 changes: 1 addition & 1 deletion src/resolver/resolveRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import type { ActionResult, MaybePromise, RouteContext } from './types.js';
import type { ActionResult, MaybePromise, RouteContext } from './types.t.js';
import { isFunction } from './utils.js';

/** @internal */
Expand Down
2 changes: 1 addition & 1 deletion src/resolver/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import type { EmptyObject } from 'type-fest';
import matchRoute, { type MatchWithRoute } from './matchRoute.js';
import defaultResolveRoute from './resolveRoute.js';
import type { ActionResult, Route, Match, MaybePromise, ResolveContext, RouteContext } from './types.js';
import type { ActionResult, Route, Match, MaybePromise, ResolveContext, RouteContext } from './types.t.js';
import { getNotFoundError, getRoutePath, isString, NotFoundError, notFoundResult, toArray } from './utils.js';

function isDescendantRoute<T, R extends object, C extends object>(
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/resolver/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ChildrenCallback, Route, RouteContext } from './types.js';
import type { ChildrenCallback, Route, RouteContext } from './types.t.js';

/**
* {@inheritDoc "<internal>".NotFoundError}
Expand Down
2 changes: 1 addition & 1 deletion src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import type {
RouterOptions,
ActionValue,
NextResult,
} from './types.js';
} from './types.t.js';
import {
amend,
copyContextWithoutNext,
Expand Down
2 changes: 1 addition & 1 deletion src/triggers/click.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { NavigationTrigger } from '../types.js';
import type { NavigationTrigger } from '../types.t.js';
import { fireRouterEvent } from '../utils.js';

/* istanbul ignore next: coverage is calculated in Chrome, this code is for IE */
Expand Down
2 changes: 1 addition & 1 deletion src/triggers/navigation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { NavigationTrigger } from '../types.js';
import type { NavigationTrigger } from '../types.t.js';
import CLICK from './click.js';
import POPSTATE from './popstate.js';

Expand Down
2 changes: 1 addition & 1 deletion src/triggers/popstate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { NavigationTrigger } from '../types.js';
import type { NavigationTrigger } from '../types.t.js';
import { fireRouterEvent } from '../utils.js';

function vaadinRouterGlobalPopstateHandler(event: PopStateEvent) {
Expand Down
2 changes: 1 addition & 1 deletion src/types.d.ts → src/types.t.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
PrimitiveParamValue,
Route as _Route,
RouteContext as _RouteContext,
} from './resolver/types.js';
} from './resolver/types.t.js';
import type { Router } from './router.js';

export type { ResolutionError, IndexedParams, Params, ParamValue, PrimitiveParamValue };
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
RouteContext,
RouterLocation,
WebComponentInterface,
} from './types.js';
} from './types.t.js';

/** @internal */
export function ensureRoute<R extends object, C extends object>(route?: Route<R, C>): void {
Expand Down
11 changes: 9 additions & 2 deletions src/v1-compat.d.ts → src/v1-compat.t.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
/* eslint-disable max-classes-per-file */

import type { MaybePromise } from './resolver/types';
import type { RouteContext, Route, ActionResult, ChildrenCallback, WebComponentInterface } from './types';
import type { MaybePromise } from './resolver/types.t.js';
import type {
Commands,
RouteContext,
Route,
ActionResult,
ChildrenCallback,
WebComponentInterface,
} from './types.t.js';

/**
* Action result describing an HTML element to render.
Expand Down
2 changes: 1 addition & 1 deletion test/resolver/generateUrls.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import sinonChai from 'sinon-chai';
import generateUrls, { type StringifyQueryParams } from '../../src/resolver/generateUrls.js';
import Resolver from '../../src/resolver/resolver.js';
import '../setup.js';
import type { Route } from '../../src/resolver/types.js';
import type { Route } from '../../src/resolver/types.t.js';

use(chaiDom);
use(sinonChai);
Expand Down
2 changes: 1 addition & 1 deletion test/resolver/matchRoute.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import chaiDom from 'chai-dom';
import sinonChai from 'sinon-chai';
import matchRoute from '../../src/resolver/matchRoute.js';
import '../setup.js';
import type { Route } from '../../src/resolver/types.js';
import type { Route } from '../../src/resolver/types.t.js';

use(chaiDom);
use(sinonChai);
Expand Down
2 changes: 1 addition & 1 deletion test/resolver/resolver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import sinonChai from 'sinon-chai';
import type { EmptyObject } from 'type-fest';
import Resolver, { ResolutionError } from '../../src/resolver/resolver.js';
import '../setup.js';
import type { Route, RouteContext } from '../../src/resolver/types.js';
import type { Route, RouteContext } from '../../src/resolver/types.t.js';

use(chaiDom);
use(sinonChai);
Expand Down
4 changes: 2 additions & 2 deletions test/router/lifecycle-events.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import sinon from 'sinon';
import { Router, type RouterLocation } from '../../src/index.js';
import Resolver from '../../src/resolver/resolver.js';
import '../setup.js';
import type { MaybePromise } from '../../src/resolver/types.js';
import type { MaybePromise } from '../../src/resolver/types.t.js';
import type {
Commands,
Route,
RouteContext,
VaadinRouterErrorEvent,
VaadinRouterLocationChangedEvent,
WebComponentInterface,
} from '../../src/types.js';
} from '../../src/types.t.js';
import {
checkOutletContents,
cleanup,
Expand Down
2 changes: 1 addition & 1 deletion test/router/parent-layout.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from '@esm-bundle/chai';
import sinon from 'sinon';
import { Router } from '../../src/router.js';
import type { ResolutionError, RouterLocation, WebComponentInterface } from '../../src/types.js';
import type { ResolutionError, RouterLocation, WebComponentInterface } from '../../src/types.t.js';
import '../setup.js';
import {
checkOutletContents,
Expand Down
2 changes: 1 addition & 1 deletion test/router/router.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
RouteChildrenContext,
RouteContext,
WebComponentInterface,
} from '../../src/types.js';
} from '../../src/types.t.js';
import '../setup.js';
import { checkOutletContents, cleanup, onBeforeEnterAction } from './test-utils.js';

Expand Down

0 comments on commit ba77154

Please sign in to comment.