Skip to content

Commit

Permalink
style: replace d.ts files with typedef jsdoc wd-258 (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
what1s1ove authored Dec 14, 2023
1 parent abf28cf commit 88f9f07
Show file tree
Hide file tree
Showing 31 changed files with 117 additions and 103 deletions.
2 changes: 1 addition & 1 deletion source/scripts/libs/components/toast/toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
TOAST_SHOW_CLASS_NAME,
} from './libs/constants/constants.js'

/** @typedef {import('~/libs/types/types').ToastMessagePayload} ToastMessagePayload */
/** @typedef {import('~/libs/types/types.js').ToastMessagePayload} ToastMessagePayload */

class Toast {
/** @type {boolean} */
Expand Down
7 changes: 0 additions & 7 deletions source/scripts/libs/types/toast-message-payload.type.d.ts

This file was deleted.

9 changes: 9 additions & 0 deletions source/scripts/libs/types/toast-message-payload.type.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @typedef {{
* cb?: () => void
* duration?: number
* message: string
* }} ToastMessagePayload
*/

export {}
1 change: 0 additions & 1 deletion source/scripts/libs/types/types.d.ts

This file was deleted.

3 changes: 3 additions & 0 deletions source/scripts/libs/types/types.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/** @typedef {import('./toast-message-payload.type.js').ToastMessagePayload} ToastMessagePayload */

export {}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/** @typedef {typeof import('../enums/enums.js').TimelineSkillType} TimelineSkillType */
/** @typedef {typeof import('../enums/enums.js').TimelineType} TimelineType */

/**
* @typedef {{
* date: string
* desc: string
* endDate: string
* link: string
* linkDesc: string
* origin: string
* originDesc: string
* title: string
* skillType: TimelineSkillType[keyof TimelineSkillType]
* type: TimelineType[keyof TimelineType]
* }} TimelineCreatePayload
*/

export {}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/** @typedef {typeof import('../enums/enums.js').TimelineSkillType} TimelineSkillType */
/** @typedef {typeof import('../enums/enums.js').TimelineType} TimelineType */

/**
* @typedef {{
* skillTypes: Record<TimelineSkillType[keyof TimelineSkillType], boolean>
* types: Record<TimelineType[keyof TimelineType], boolean>
* }} TimelineFilter
*/

export {}
17 changes: 0 additions & 17 deletions source/scripts/packages/timeline/libs/types/timeline.type.d.ts

This file was deleted.

20 changes: 20 additions & 0 deletions source/scripts/packages/timeline/libs/types/timeline.type.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/** @typedef {typeof import('../enums/enums.js').TimelineSkillType} TimelineSkillType */
/** @typedef {typeof import('../enums/enums.js').TimelineType} TimelineType */

/**
* @typedef {{
* id: string
* date: string
* desc: string
* endDate: string
* link: string
* linkDesc: string
* origin: string
* originDesc: string
* title: string
* skillType: TimelineSkillType[keyof TimelineSkillType]
* type: TimelineType[keyof TimelineType]
* }} Timeline
*/

export {}
3 changes: 0 additions & 3 deletions source/scripts/packages/timeline/libs/types/types.d.ts

This file was deleted.

5 changes: 5 additions & 0 deletions source/scripts/packages/timeline/libs/types/types.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @typedef {import('./timeline-create-payload.type.js').TimelineCreatePayload} TimelineCreatePayload */
/** @typedef {import('./timeline-filter.type.js').TimelineFilter} TimelineFilter */
/** @typedef {import('./timeline.type.js').Timeline} Timeline */

export {}
6 changes: 3 additions & 3 deletions source/scripts/packages/timeline/timeline-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { HttpMethod } from '~/libs/packages/http/http.js'

import { TimelineApiPath } from './libs/enums/enums.js'

/** @typedef {import('~/libs/packages/http/http').Http} Http */
/** @typedef {import('./libs/types/types').Timeline} Timeline */
/** @typedef {import('./libs/types/types')} TimelineCreatePayload */
/** @typedef {import('~/libs/packages/http/http.js').Http} Http */
/** @typedef {import('./libs/types/types.js').Timeline} Timeline */
/** @typedef {import('./libs/types/types.js').TimelineCreatePayload} TimelineCreatePayload */

class TimelineApi {
/** @type {(typeof ApiPath)[keyof typeof ApiPath]} */
Expand Down
6 changes: 3 additions & 3 deletions source/scripts/packages/timeline/timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { http } from '~/libs/packages/http/http.js'

import { TimelineApi } from './timeline-api.js'

/** @typedef {import('./libs/types/types').Timeline} Timeline */
/** @typedef {import('./libs/types/types').TimelineCreatePayload} TimelineCreatePayload */
/** @typedef {import('./libs/types/types').TimelineFilter} TimelineFilter */
/** @typedef {import('./libs/types/types.js').Timeline} Timeline */
/** @typedef {import('./libs/types/types.js').TimelineCreatePayload} TimelineCreatePayload */
/** @typedef {import('./libs/types/types.js').TimelineFilter} TimelineFilter */

let timelineApi = new TimelineApi({
baseUrl: getServerApiUrl({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {
getPlayerElement,
} from './libs/helpers/helpers.js'

/** @typedef {import('~/libs/types/types').ToastMessagePayload} ToastMessagePayload */
/** @typedef {import('~/pages/main/libs/types/types').SettingButtonPayload} SettingButtonPayload */
/** @typedef {import('~/libs/types/types.js').ToastMessagePayload} ToastMessagePayload */
/** @typedef {import('~/pages/main/libs/types/types.js').SettingsButtonPayload} SettingsButtonPayload */

class EasterEgg {
/** @type {HTMLAudioElement | undefined} */
Expand Down Expand Up @@ -45,14 +45,14 @@ class EasterEgg {
/** @type {(payload: ToastMessagePayload) => void} */
#onNotificationAdd

/** @type {(payload: SettingButtonPayload) => HTMLButtonElement} */
/** @type {(payload: SettingsButtonPayload) => HTMLButtonElement} */
#onSettingButtonAppend

/**
* @param {{
* onNotificationAdd: (payload: ToastMessagePayload) => void
* onSettingButtonAppend: (
* payload: SettingButtonPayload,
* payload: SettingsButtonPayload,
* ) => HTMLButtonElement
* }} constructor
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { getSettingItemElement } from './libs/helpers/helpers.js'

let RESULT_VALUE = /** @type {const} */ (`auto`)

/** @typedef {import('~/pages/main/libs/types/types').SettingButtonPayload} SettingButtonPayload */
/** @typedef {import('~/libs/packages/storage/storage').Storage} Storage */
/** @typedef {import('~/pages/main/libs/types/types.js').SettingsButtonPayload} SettingsButtonPayload */
/** @typedef {import('~/libs/packages/storage/storage.js').Storage} Storage */

class Settings {
/**
Expand Down Expand Up @@ -108,7 +108,7 @@ class Settings {
}

/**
* @param {SettingButtonPayload} settings
* @param {SettingsButtonPayload} settings
* @returns {HTMLButtonElement}
*/
appendNewButton(settings) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @typedef {import('~/packages/timeline/timeline').TimelineCreatePayload} TimelineCreatePayload */
/** @typedef {import('~/packages/timeline/timeline.js').TimelineCreatePayload} TimelineCreatePayload */

/**
* @param {TimelineCreatePayload} timeline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {

import { getTransformedTimeline } from './helpers/helpers.js'

/** @typedef {import('~/packages/timeline/timeline').TimelineApi} TimelineApi */
/** @typedef {import('~/packages/timeline/timeline').TimelineCreatePayload} TimelineCreatePayload */
/** @typedef {import('~/packages/timeline/timeline.js').TimelineApi} TimelineApi */
/** @typedef {import('~/packages/timeline/timeline.js').TimelineCreatePayload} TimelineCreatePayload */

let timelineSkillTypes = Object.values(TimelineSkillType)
let timelineTypes = Object.values(TimelineType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getFormValues, initDebounce } from '~/libs/helpers/helpers.js'

import { DEBOUNCE_DELAY } from './libs/constants/constants.js'

/** @typedef {import('~/packages/timeline/timeline').TimelineFilter} TimelineFilter */
/** @typedef {import('~/packages/timeline/timeline.js').TimelineFilter} TimelineFilter */

class TimelineForm {
/** @type {HTMLFormElement | undefined} */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getFormattedDate, getStringWitCheck } from '~/libs/helpers/helpers.js'

/** @typedef {import('~/packages/timeline/timeline').Timeline} Timeline */
/** @typedef {import('~/packages/timeline/timeline.js').Timeline} Timeline */

/**
* @param {Timeline} timeline
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getTimelineTemplate } from '../get-timeline-template/get-timeline-template.helper.js'

/** @typedef {import('~/packages/timeline/timeline').Timeline} Timeline */
/** @typedef {import('~/packages/timeline/timeline.js').Timeline} Timeline */

/**
* @param {Timeline[]} timelines
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getTimelineTemplates } from './libs/helpers/helpers.js'

/** @typedef {import('~/packages/timeline/timeline').Timeline} Timeline */
/** @typedef {import('~/packages/timeline/timeline.js').Timeline} Timeline */

class TimelineList {
/** @type {HTMLElement | undefined} */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @typedef {import('~/packages/timeline/timeline').Timeline} Timeline */
/** @typedef {import('~/packages/timeline/timeline').TimelineFilter} TimelineFilter */
/** @typedef {import('~/packages/timeline/timeline.js').Timeline} Timeline */
/** @typedef {import('~/packages/timeline/timeline.js').TimelineFilter} TimelineFilter */

/**
* @param {Timeline} timelineItem
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { checkIsTimelineSuit } from '../check-is-timeline-suit/check-is-timeline-suit.helper.js'

/** @typedef {import('~/packages/timeline/timeline').Timeline} Timeline */
/** @typedef {import('~/packages/timeline/timeline').TimelineFilter} TimelineFilter */
/** @typedef {import('~/packages/timeline/timeline.js').Timeline} Timeline */
/** @typedef {import('~/packages/timeline/timeline.js').TimelineFilter} TimelineFilter */

/**
* @param {Timeline[]} timelines
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { checkIsBeforeElement } from '~/libs/helpers/helpers.js'
import { TimelineForm, TimelineList } from './libs/components/components.js'
import { getSuitTimelines } from './libs/helpers/helpers.js'

/** @typedef {import('~/packages/timeline/timeline').Timeline} TTimeline */
/** @typedef {import('~/packages/timeline/timeline').TimelineFilter} TimelineFilter */
/** @typedef {import('~/packages/timeline/timeline').TimelineApi} TimelineApi */
/** @typedef {import('~/packages/timeline/timeline.js').Timeline} TTimeline */
/** @typedef {import('~/packages/timeline/timeline.js').TimelineFilter} TimelineFilter */
/** @typedef {import('~/packages/timeline/timeline.js').TimelineApi} TimelineApi */

class Timeline {
/** @type {(formValues: TimelineFilter) => void} */
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @typedef {typeof import('../enums/enums.js').SettingButtonLabel} SettingButtonLabel */
/** @typedef {typeof import('../enums/enums.js').SettingName} SettingName */

/**
* @typedef {{
* isDefaultChecked: boolean
* label: SettingButtonLabel[keyof SettingButtonLabel]
* name: SettingName[keyof SettingName]
* onClick: (name: SettingName[keyof SettingName], isCheck: boolean) => void
* }} SettingsButtonPayload
*/

export {}
1 change: 0 additions & 1 deletion source/scripts/pages/main/libs/types/types.d.ts

This file was deleted.

3 changes: 3 additions & 0 deletions source/scripts/pages/main/libs/types/types.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/** @typedef {import('./settings-button-payload.type.js').SettingsButtonPayload} SettingsButtonPayload */

export {}
12 changes: 6 additions & 6 deletions source/scripts/pages/main/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import {
TimelineForm,
} from './libs/components/components.js'

/** @typedef {import('~/pages/main/libs/types/types').SettingButtonPayload} SettingButtonPayload */
/** @typedef {import('~/libs/types/types').ToastMessagePayload} ToastMessagePayload */
/** @typedef {import('~/libs/packages/storage/storage').Storage} Storage */
/** @typedef {import('~/packages/timeline/timeline').TimelineApi} TimelineApi */
/** @typedef {import('~/pages/main/libs/types/types.js').SettingsButtonPayload} SettingsButtonPayload */
/** @typedef {import('~/libs/types/types.js').ToastMessagePayload} ToastMessagePayload */
/** @typedef {import('~/libs/packages/storage/storage.js').Storage} Storage */
/** @typedef {import('~/packages/timeline/timeline.js').TimelineApi} TimelineApi */

class Main {
/** @type {EasterEgg} */
Expand All @@ -23,7 +23,7 @@ class Main {
/** @type {(message: ToastMessagePayload) => void} */
#handleNotificationAdd

/** @type {(settings: SettingButtonPayload) => HTMLButtonElement} */
/** @type {(settings: SettingsButtonPayload) => HTMLButtonElement} */
#handleSettingButtonAppend

/** @type {HTMLElement | undefined} */
Expand Down Expand Up @@ -99,7 +99,7 @@ class Main {
}

/**
* @param {SettingButtonPayload} settings
* @param {SettingsButtonPayload} settings
* @returns {HTMLButtonElement}
*/
#appendSettingButtonHandler(settings) {
Expand Down

0 comments on commit 88f9f07

Please sign in to comment.