Skip to content

Commit

Permalink
chore: revert unneeded import type changes & lint
Browse files Browse the repository at this point in the history
Yes. Again.
  • Loading branch information
LuanRT committed Jan 26, 2024
1 parent 5204b29 commit c7f4222
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 60 deletions.
2 changes: 1 addition & 1 deletion src/core/Actions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Parser, NavigateAction } from '../parser/index.js';
import { InnertubeError } from '../utils/Utils.js';

import type Session from './Session.js';
import type { Session } from './index.js';

import type {
IBrowseResponse, IGetNotificationsMenuResponse,
Expand Down
4 changes: 2 additions & 2 deletions src/core/Session.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Player from './Player.js';
import OAuth from './OAuth.js';
import Actions from './Actions.js';
import { Log, EventEmitter, HTTPClient } from '../utils/index.js';
import * as Constants from '../utils/Constants.js';
import * as Proto from '../proto/index.js';
import Actions from './Actions.js';
import Player from './Player.js';

import {
generateRandomString, getRandomUserAgent,
Expand Down
3 changes: 1 addition & 2 deletions src/core/clients/Kids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import {

import { BlocklistPickerEndpoint } from '../endpoints/kids/index.js';

import type Session from '../Session.js';
import type { ApiResponse } from '../index.js';
import type { Session, ApiResponse } from '../index.js';

export default class Kids {
#session: Session;
Expand Down
3 changes: 1 addition & 2 deletions src/core/clients/Music.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ import { GetSearchSuggestionsEndpoint } from '../endpoints/music/index.js';

import type { ObservedArray } from '../../parser/helpers.js';
import type { MusicSearchFilters } from '../../types/index.js';
import type Session from '../Session.js';
import type Actions from '../Actions.js';
import type { Actions, Session } from '../index.js';

export default class Music {
#session: Session;
Expand Down
3 changes: 1 addition & 2 deletions src/core/clients/Studio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { InnertubeError, MissingParamError, Platform } from '../../utils/Utils.j
import { CreateVideoEndpoint } from '../endpoints/upload/index.js';

import type { UpdateVideoMetadataOptions, UploadedVideoMetadataOptions } from '../../types/Clients.js';
import type Session from '../Session.js';
import type { ApiResponse } from '../Actions.js';
import type { ApiResponse, Session } from '../index.js';

interface UploadResult {
status: string;
Expand Down
5 changes: 2 additions & 3 deletions src/core/managers/AccountManager.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { Actions, ApiResponse } from '../index.js';

import AccountInfo from '../../parser/youtube/AccountInfo.js';
import Analytics from '../../parser/youtube/Analytics.js';
import Settings from '../../parser/youtube/Settings.js';
Expand All @@ -7,9 +9,6 @@ import * as Proto from '../../proto/index.js';
import { InnertubeError } from '../../utils/Utils.js';
import { Account, BrowseEndpoint, Channel } from '../endpoints/index.js';

import type Actions from '../Actions.js';
import type { ApiResponse } from '../Actions.js';

export default class AccountManager {
#actions: Actions;

Expand Down
3 changes: 1 addition & 2 deletions src/core/managers/InteractionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import { SubscribeEndpoint, UnsubscribeEndpoint } from '../endpoints/subscriptio
import { CreateCommentEndpoint, PerformCommentActionEndpoint } from '../endpoints/comment/index.js';
import { ModifyChannelPreferenceEndpoint } from '../endpoints/notification/index.js';

import type Actions from '../Actions.js';
import type { ApiResponse } from '../Actions.js';
import type { Actions, ApiResponse } from '../index.js';

export default class InteractionManager {
#actions: Actions;
Expand Down
2 changes: 1 addition & 1 deletion src/core/managers/PlaylistManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BrowseEndpoint } from '../endpoints/index.js';
import { CreateEndpoint, DeleteEndpoint } from '../endpoints/playlist/index.js';
import Playlist from '../../parser/youtube/Playlist.js';

import type Actions from '../Actions.js';
import type { Actions } from '../index.js';
import type { Feed } from '../mixins/index.js';
import type { EditPlaylistEndpointOptions } from '../../types/index.js';

Expand Down
3 changes: 1 addition & 2 deletions src/core/mixins/Feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import TwoColumnBrowseResults from '../../parser/classes/TwoColumnBrowseResults.
import TwoColumnSearchResults from '../../parser/classes/TwoColumnSearchResults.js';
import WatchCardCompactVideo from '../../parser/classes/WatchCardCompactVideo.js';

import type { ApiResponse, Actions } from '../index.js';
import type {
Memo, ObservedArray,
SuperParsedResult, YTNode
Expand All @@ -33,8 +34,6 @@ import type MusicQueue from '../../parser/classes/MusicQueue.js';
import type RichGrid from '../../parser/classes/RichGrid.js';
import type SectionList from '../../parser/classes/SectionList.js';
import type { IParsedResponse } from '../../parser/types/index.js';
import type Actions from '../Actions.js';
import type { ApiResponse } from '../Actions.js';

export default class Feed<T extends IParsedResponse = IParsedResponse> {
#page: T;
Expand Down
3 changes: 1 addition & 2 deletions src/core/mixins/FilterableFeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { InnertubeError } from '../../utils/Utils.js';

import type { ObservedArray } from '../../parser/helpers.js';
import type { IParsedResponse } from '../../parser/types/index.js';
import type Actions from '../Actions.js';
import type { ApiResponse } from '../Actions.js';
import type { ApiResponse, Actions } from '../index.js';

export default class FilterableFeed<T extends IParsedResponse> extends Feed<T> {
#chips?: ObservedArray<ChipCloudChip>;
Expand Down
3 changes: 1 addition & 2 deletions src/core/mixins/MediaInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ import { Parser } from '../../parser/index.js';
import { TranscriptInfo } from '../../parser/youtube/index.js';
import ContinuationItem from '../../parser/classes/ContinuationItem.js';

import type { ApiResponse, Actions } from '../index.js';
import type { INextResponse, IPlayerConfig, IPlayerResponse } from '../../parser/index.js';
import type { DownloadOptions, FormatFilter, FormatOptions, URLTransformer } from '../../types/FormatUtils.js';
import type Format from '../../parser/classes/misc/Format.js';
import type { DashOptions } from '../../types/DashOptions.js';
import type Actions from '../Actions.js';
import type { ApiResponse } from '../Actions.js';

export default class MediaInfo {
#page: [IPlayerResponse, INextResponse?];
Expand Down
3 changes: 1 addition & 2 deletions src/core/mixins/TabbedFeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { Feed } from './index.js';
import { InnertubeError } from '../../utils/Utils.js';
import Tab from '../../parser/classes/Tab.js';

import type Actions from '../Actions.js';
import type { ApiResponse } from '../Actions.js';
import type { Actions, ApiResponse } from '../index.js';
import type { ObservedArray } from '../../parser/helpers.js';
import type { IParsedResponse } from '../../parser/types/ParsedResponse.js';

Expand Down
74 changes: 37 additions & 37 deletions src/parser/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Log } from '../utils/index.js';
import Log from '../utils/Log.js';
import { deepCompare, ParsingError } from '../utils/Utils.js';

const isObserved = Symbol('ObservedArray.isObserved');
Expand Down Expand Up @@ -66,7 +66,7 @@ export class Maybe {
#TAG = 'Maybe';
#value;

constructor(value: any) {
constructor (value: any) {
this.#value = value;
}

Expand Down Expand Up @@ -309,12 +309,12 @@ export class Maybe {
}

export interface Constructor<T> {
new(...args: any[]): T;
new (...args: any[]): T;
}

export interface YTNodeConstructor<T extends YTNode = YTNode> {
new(data: any): T;
readonly type: string;
new(data: any): T;
readonly type: string;
}

/**
Expand Down Expand Up @@ -354,38 +354,38 @@ export class SuperParsedResult<T extends YTNode = YTNode> {


export type ObservedArray<T extends YTNode = YTNode> = Array<T> & {
/**
* Returns the first object to match the rule.
*/
get: (rule: object, del_item?: boolean) => T | undefined;
/**
* Returns all objects that match the rule.
*/
getAll: (rule: object, del_items?: boolean) => T[];
/**
* Returns the first object to match the condition.
*/
matchCondition: (condition: (node: T) => boolean) => T | undefined;
/**
* Removes the item at the given index.
*/
remove: (index: number) => T[];
/**
* Get all items of a specific type
*/
filterType<R extends YTNode, K extends YTNodeConstructor<R>[]>(...types: K): ObservedArray<InstanceType<K[number]>>;
/**
* Get the first of a specific type
*/
firstOfType<R extends YTNode, K extends YTNodeConstructor<R>[]>(...types: K): InstanceType<K[number]> | undefined;
/**
* Get the first item
*/
first: () => T;
/**
* This is similar to filter but throws if there's a type mismatch.
*/
as<R extends YTNode, K extends YTNodeConstructor<R>[]>(...types: K): ObservedArray<InstanceType<K[number]>>;
/**
* Returns the first object to match the rule.
*/
get: (rule: object, del_item?: boolean) => T | undefined;
/**
* Returns all objects that match the rule.
*/
getAll: (rule: object, del_items?: boolean) => T[];
/**
* Returns the first object to match the condition.
*/
matchCondition: (condition: (node: T) => boolean) => T | undefined;
/**
* Removes the item at the given index.
*/
remove: (index: number) => T[];
/**
* Get all items of a specific type
*/
filterType<R extends YTNode, K extends YTNodeConstructor<R>[]>(...types: K): ObservedArray<InstanceType<K[number]>>;
/**
* Get the first of a specific type
*/
firstOfType<R extends YTNode, K extends YTNodeConstructor<R>[]>(...types: K): InstanceType<K[number]> | undefined;
/**
* Get the first item
*/
first: () => T;
/**
* This is similar to filter but throws if there's a type mismatch.
*/
as<R extends YTNode, K extends YTNodeConstructor<R>[]>(...types: K): ObservedArray<InstanceType<K[number]>>;
};

/**
Expand Down

0 comments on commit c7f4222

Please sign in to comment.