mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Mark [] and {} in the data option with a more specific type
Signed-off-by: timongh <46739861+timongh@users.noreply.github.com>
This commit is contained in:
parent
f0d24bd652
commit
accae5d047
@ -64,8 +64,8 @@ export default Vue.extend({
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
medalList: [],
|
||||
titleList: [],
|
||||
medalList: [] as Medal[],
|
||||
titleList: [] as Title[],
|
||||
medalOpen: false,
|
||||
titleOpen: false,
|
||||
grayEffect: true,
|
||||
|
||||
@ -49,7 +49,7 @@ export default Vue.extend({
|
||||
return {
|
||||
initItems,
|
||||
items: getItems(),
|
||||
styles: [],
|
||||
styles: [] as string[],
|
||||
height: CustomNavbarItem.navbarOptions.height,
|
||||
}
|
||||
},
|
||||
|
||||
@ -36,7 +36,7 @@ export default Vue.extend({
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
folders: [],
|
||||
folders: [] as FavoritesFolder[],
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
|
||||
@ -163,8 +163,8 @@ const ThisComponent = Vue.extend({
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
cards: [],
|
||||
filteredCards: [],
|
||||
cards: [] as FavoritesItemInfo[],
|
||||
filteredCards: [] as FavoritesItemInfo[],
|
||||
page: 1,
|
||||
hasMorePage: true,
|
||||
searchPage: 1,
|
||||
|
||||
@ -29,20 +29,20 @@ export default Vue.extend({
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
rawItems: [],
|
||||
rawItems: [] as unknown[],
|
||||
hasMorePage: true,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
cards(): LiveFeedItem[] {
|
||||
const parseLiveCard = (card: any) => ({
|
||||
const parseLiveCard = (card: unknown) => ({
|
||||
id: card.roomid,
|
||||
title: card.title,
|
||||
upFaceUrl: card.face,
|
||||
upName: card.uname,
|
||||
url: card.link,
|
||||
})
|
||||
return (this.rawItems as any[]).map(parseLiveCard)
|
||||
return this.rawItems.map(parseLiveCard)
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
|
||||
@ -27,13 +27,13 @@ export const nextPageMixin = <MappedItem extends { id: string }, RawItem>(
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
cards: [],
|
||||
cards: [] as MappedItem[],
|
||||
hasMorePage: true,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
sortedCards(): MappedItem[] {
|
||||
return ([...this.cards] as MappedItem[]).sort(descendingStringSort(it => it.id))
|
||||
return [...this.cards].sort(descendingStringSort(it => it.id))
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
|
||||
@ -138,8 +138,8 @@ const ThisComponent = Vue.extend({
|
||||
types,
|
||||
search: '',
|
||||
viewTime: 0,
|
||||
cards: [],
|
||||
groups: [],
|
||||
cards: [] as HistoryItem[],
|
||||
groups: [] as { name: string; items: HistoryItem[] }[],
|
||||
loading: true,
|
||||
hasMorePage: true,
|
||||
paused: false,
|
||||
|
||||
@ -95,7 +95,7 @@ export default Vue.extend({
|
||||
return {
|
||||
loading: true,
|
||||
hasMorePage: true,
|
||||
cards: [],
|
||||
cards: [] as any[],
|
||||
page: 1,
|
||||
}
|
||||
},
|
||||
@ -116,7 +116,7 @@ export default Vue.extend({
|
||||
}
|
||||
const cards = lodash
|
||||
.uniqBy(
|
||||
(this.cards as any[]).concat(
|
||||
this.cards.concat(
|
||||
(lodash.get(json, 'data.list') as any[]).map(item => ({
|
||||
title: item.title,
|
||||
coverUrl: item.square_cover.replace('http:', 'https:'),
|
||||
|
||||
@ -173,8 +173,8 @@ export default Vue.extend({
|
||||
mixins: [popperMixin],
|
||||
data() {
|
||||
return {
|
||||
userInfo: {},
|
||||
stat: {},
|
||||
userInfo: {} as any,
|
||||
stat: {} as any,
|
||||
isLogin: Boolean(getUID()),
|
||||
privileges: {
|
||||
bCoin: {
|
||||
|
||||
@ -88,8 +88,8 @@ const ThisComponent = Vue.extend({
|
||||
return {
|
||||
watchlaterList,
|
||||
loading: true,
|
||||
cards: [],
|
||||
filteredCards: [],
|
||||
cards: [] as WatchlaterCard[],
|
||||
filteredCards: [] as WatchlaterCard[],
|
||||
search: '',
|
||||
redirect: redirect.enabled && redirect.options.navbar,
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { VButton, VIcon, DpiImage } from '@/ui'
|
||||
import { getBlackboards } from './api'
|
||||
import { Blackboard, getBlackboards } from './api'
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
@ -63,7 +63,7 @@ export default Vue.extend({
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
blackboards: [],
|
||||
blackboards: [] as Blackboard[],
|
||||
timer: 0,
|
||||
}
|
||||
},
|
||||
|
||||
@ -84,7 +84,7 @@ export default Vue.extend({
|
||||
return {
|
||||
tabs,
|
||||
selectedTab: tabs[0],
|
||||
videos: [],
|
||||
videos: [] as VideoCard[],
|
||||
loading: true,
|
||||
}
|
||||
},
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import type { VideoCard } from '@/components/feeds/video-card'
|
||||
import { VButton, VIcon } from '@/ui'
|
||||
import VideoList from '../../VideoList.vue'
|
||||
import { freshHomeOptions } from '../../types'
|
||||
@ -35,7 +36,7 @@ export default Vue.extend({
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
videos: [],
|
||||
videos: [] as VideoCard[],
|
||||
loading: true,
|
||||
}
|
||||
},
|
||||
|
||||
@ -22,7 +22,7 @@ export default Vue.extend({
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
cards: [],
|
||||
cards: [] as VideoCard[],
|
||||
error: false,
|
||||
}
|
||||
},
|
||||
|
||||
@ -23,7 +23,7 @@ export default Vue.extend({
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
cards: [],
|
||||
cards: [] as VideoCard[],
|
||||
error: false,
|
||||
}
|
||||
},
|
||||
|
||||
@ -18,7 +18,7 @@ export const requestMixin = (
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
items: [],
|
||||
items: [] as unknown[],
|
||||
loading: true,
|
||||
error: false,
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ export default Vue.extend({
|
||||
return {
|
||||
busy: false,
|
||||
autoUpdateComponents: autoUpdateOptions.urls.components,
|
||||
sessions: [],
|
||||
sessions: [] as string[],
|
||||
isConnected: false,
|
||||
}
|
||||
},
|
||||
|
||||
@ -173,11 +173,11 @@ export default Vue.extend({
|
||||
multiple: false,
|
||||
},
|
||||
assets,
|
||||
qualities: [],
|
||||
qualities: [] as VideoQuality[],
|
||||
selectedQuality: undefined,
|
||||
inputs: [],
|
||||
inputs: [] as DownloadVideoInput[],
|
||||
selectedInput: undefined,
|
||||
apis: [],
|
||||
apis: [] as DownloadVideoApi[],
|
||||
selectedApi: undefined,
|
||||
outputs,
|
||||
selectedOutput: outputs.find(it => it.name === lastOutput) || outputs[0],
|
||||
|
||||
@ -72,7 +72,7 @@ export default Vue.extend({
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
episodeItems: [],
|
||||
episodeItems: [] as EpisodeItem[],
|
||||
maxCheckedItems: 32,
|
||||
lastCheckedEpisodeIndex: -1,
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ export default Vue.extend({
|
||||
tipText: '',
|
||||
tipShowing: false,
|
||||
tipHandle: 0,
|
||||
lists: [],
|
||||
lists: [] as { title: string; id: number }[],
|
||||
selectedFavorite: '<未选择>',
|
||||
listShowing: false,
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ export default Vue.extend({
|
||||
data() {
|
||||
return {
|
||||
isRecording: true,
|
||||
danmakus: [],
|
||||
danmakus: [] as LiveDanmaku[],
|
||||
opened: false,
|
||||
collapsed: false,
|
||||
loading: true,
|
||||
|
||||
@ -125,10 +125,11 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { DpiImage, VIcon } from '@/ui'
|
||||
import type { PropType } from 'vue'
|
||||
import { toggleWatchlater, watchlaterList } from '@/components/video/watchlater'
|
||||
import { getUID } from '@/core/utils'
|
||||
import { watchlaterList, toggleWatchlater } from '@/components/video/watchlater'
|
||||
import { Cooperation } from './video-card'
|
||||
import { DpiImage, VIcon } from '@/ui'
|
||||
import type { VideoCard as VideoCardData, Cooperation, Topic } from './video-card'
|
||||
|
||||
/*
|
||||
============
|
||||
@ -143,7 +144,7 @@ export default Vue.extend({
|
||||
},
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
type: Object as PropType<VideoCardData>,
|
||||
required: true,
|
||||
},
|
||||
orientation: {
|
||||
@ -169,10 +170,10 @@ export default Vue.extend({
|
||||
coins: '',
|
||||
favorites: '',
|
||||
dynamic: '',
|
||||
topics: [],
|
||||
topics: [] as Topic[],
|
||||
upID: 0,
|
||||
epID: 0,
|
||||
cooperation: [],
|
||||
cooperation: [] as Cooperation[],
|
||||
pubTime: 0,
|
||||
pubTimeText: '',
|
||||
...lodash.omit(this.data, 'watchlater'),
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
export interface Topic {
|
||||
id: number
|
||||
name: string
|
||||
}
|
||||
export interface Cooperation {
|
||||
id: number
|
||||
name: string
|
||||
@ -26,10 +30,7 @@ export interface VideoCard {
|
||||
favorites?: string
|
||||
timestamp?: number
|
||||
time?: Date
|
||||
topics?: {
|
||||
id: number
|
||||
name: string
|
||||
}[]
|
||||
topics?: Topic[]
|
||||
type?: string
|
||||
points?: number
|
||||
watchlater?: boolean
|
||||
|
||||
@ -48,7 +48,7 @@ export default Vue.extend({
|
||||
result: '',
|
||||
working: false,
|
||||
translateProviders,
|
||||
activeTranslator: {},
|
||||
activeTranslator: {} as MachineTranslateProvider,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
@ -139,7 +139,10 @@ const ThisComponent = Vue.extend({
|
||||
data() {
|
||||
return {
|
||||
recommended,
|
||||
actions: [],
|
||||
actions: [] as ({
|
||||
key: string
|
||||
provider: LaunchBarActionProvider
|
||||
} & LaunchBarAction)[],
|
||||
keyword: '',
|
||||
noActions: false,
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ export default Vue.extend({
|
||||
components,
|
||||
renderedComponents: components.filter(c => !c.hidden),
|
||||
selectedComponent: null,
|
||||
selectedComponents: [],
|
||||
selectedComponents: [] as ComponentMetadata[],
|
||||
componentDetailOpen: false,
|
||||
collapsed: false,
|
||||
peek: false,
|
||||
@ -112,8 +112,7 @@ export default Vue.extend({
|
||||
},
|
||||
computed: {
|
||||
isComponentSelected(): (name: string) => boolean {
|
||||
return (name: string) =>
|
||||
this.selectedComponents.some((c: ComponentMetadata) => c.name === name)
|
||||
return (name: string) => this.selectedComponents.some(c => c.name === name)
|
||||
},
|
||||
tags(): (ComponentTag & { count: number })[] {
|
||||
const renderedComponents = this.renderedComponents as ComponentMetadata[]
|
||||
@ -184,7 +183,7 @@ export default Vue.extend({
|
||||
this.selectedComponents = list.slice(startIdx, endIdx + 1)
|
||||
return
|
||||
}
|
||||
const selectedList = this.selectedComponents as ComponentMetadata[]
|
||||
const selectedList = this.selectedComponents
|
||||
const selectedComponent = selectedList.find(c => c.name === component.name)
|
||||
if (selectedComponent) {
|
||||
deleteValue(selectedList, c => c.name === selectedComponent.name)
|
||||
|
||||
@ -127,7 +127,7 @@ export default Vue.extend({
|
||||
batchAddShow: false,
|
||||
batchUrl: '',
|
||||
excludeBuiltIn: true,
|
||||
debouncedList: [],
|
||||
debouncedList: [] as unknown[]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
@ -43,7 +43,7 @@ export default Vue.extend({
|
||||
data() {
|
||||
return {
|
||||
removeConfirm: false,
|
||||
settings: {},
|
||||
settings: {} as { enabled: boolean },
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
@ -137,10 +137,10 @@ const ThisComponent = Vue.extend({
|
||||
searchKeyword: '',
|
||||
popupOpen: false,
|
||||
loading: false,
|
||||
list: [],
|
||||
list: [] as DocSourceItem[],
|
||||
itemFilter: ItemFilter.All,
|
||||
itemFilterOptions,
|
||||
filteredList: [],
|
||||
filteredList: [] as DocSourceItem[],
|
||||
// packList: [],
|
||||
fuse: null,
|
||||
registryBranches,
|
||||
|
||||
@ -50,7 +50,7 @@ export default Vue.extend({
|
||||
data() {
|
||||
return {
|
||||
open: false,
|
||||
closeListeners: [],
|
||||
closeListeners: [] as (() => void)[],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@ -5,13 +5,15 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import type { Toast } from '@/core/toast/index'
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
ToastCard: () => import('./ToastCard.vue').then(m => m.default),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
cards: [],
|
||||
cards: [] as Toast[],
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user