Skip to content

Commit afd5297

Browse files
committed
Remove type-fest dependency
1 parent e612b97 commit afd5297

File tree

6 files changed

+14
-16
lines changed

6 files changed

+14
-16
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@
111111
"stylelint-declaration-strict-value": "1.10.11",
112112
"stylelint-value-no-unknown-custom-properties": "6.0.1",
113113
"svgo": "4.0.0",
114-
"type-fest": "4.41.0",
115114
"updates": "16.7.0",
116115
"vite-string-plugin": "1.4.6",
117116
"vitest": "3.2.4",

pnpm-lock.yaml

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

web_src/js/components/RepoContributors.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {chartJsColors} from '../utils/color.ts';
2727
import {sleep} from '../utils.ts';
2828
import 'chartjs-adapter-dayjs-4/dist/chartjs-adapter-dayjs-4.esm';
2929
import {fomanticQuery} from '../modules/fomantic/base.ts';
30-
import type {Entries} from 'type-fest';
3130
import {pathEscapeSegments} from '../utils/url.ts';
3231
3332
const customEventListener: Plugin = {
@@ -57,6 +56,13 @@ Chart.register(
5756
customEventListener,
5857
);
5958
59+
type ContributorsData = {
60+
total: {
61+
weeks: Record<string, any>,
62+
},
63+
[other: string]: Record<string, Record<string, any>>,
64+
}
65+
6066
export default defineComponent({
6167
components: {ChartLine, SvgIcon},
6268
props: {
@@ -128,19 +134,19 @@ export default defineComponent({
128134
} while (response.status === 202);
129135
if (response.ok) {
130136
const data = await response.json();
131-
const {total, ...rest} = data;
137+
const {total, ...rest} = data as ContributorsData;
132138
// below line might be deleted if we are sure go produces map always sorted by keys
133139
total.weeks = Object.fromEntries(Object.entries(total.weeks).sort());
134140
135-
const weekValues = Object.values(total.weeks) as any;
141+
const weekValues = Object.values(total.weeks);
136142
this.xAxisStart = weekValues[0].week;
137143
this.xAxisEnd = firstStartDateAfterDate(new Date());
138144
const startDays = startDaysBetween(this.xAxisStart, this.xAxisEnd);
139145
total.weeks = fillEmptyStartDaysWithZeroes(startDays, total.weeks);
140146
this.xAxisMin = this.xAxisStart;
141147
this.xAxisMax = this.xAxisEnd;
142148
this.contributorsStats = {};
143-
for (const [email, user] of Object.entries(rest) as Entries<Record<string, Record<string, any>>>) {
149+
for (const [email, user] of Object.entries(rest)) {
144150
user.weeks = fillEmptyStartDaysWithZeroes(startDays, user.weeks);
145151
this.contributorsStats[email] = user;
146152
}

web_src/js/modules/observer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {isDocumentFragmentOrElementNode} from '../utils/dom.ts';
2-
import type {Promisable} from 'type-fest';
2+
import type {Promisable} from '../types.ts';
33
import type {InitPerformanceTracer} from './init.ts';
44

55
let globalSelectorObserverInited = false;

web_src/js/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,5 @@ export type FomanticInitFunction = {
6868
}
6969

7070
export type GitRefType = 'branch' | 'tag';
71+
72+
export type Promisable<T> = T | Promise<T>; // stricter than type-fest which uses PromiseLike

web_src/js/utils/dom.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {debounce} from 'throttle-debounce';
2-
import type {Promisable} from 'type-fest';
2+
import type {Promisable} from '../types.ts';
33
import type $ from 'jquery';
44
import {isInFrontendUnitTest} from './testhelper.ts';
55

0 commit comments

Comments
 (0)