mirror of
https://github.com/Vendicated/Vencord.git
synced 2024-09-20 06:30:35 +00:00
refactor: misc. changes
This commit is contained in:
parent
1310f664d8
commit
cde937ab0c
9 changed files with 37 additions and 27 deletions
|
@ -64,7 +64,7 @@
|
|||
"eslint-plugin-react": "^7.35.0",
|
||||
"eslint-plugin-simple-header": "^1.1.1",
|
||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||
"eslint-plugin-unused-imports": "^4.1.2",
|
||||
"eslint-plugin-unused-imports": "^4.1.3",
|
||||
"highlight.js": "11.8.0",
|
||||
"html-minifier-terser": "^7.2.0",
|
||||
"moment": "2.22.2",
|
||||
|
|
|
@ -121,7 +121,6 @@ export default tseslint.config(
|
|||
"@typescript-eslint/no-unsafe-function-type": "error",
|
||||
"@typescript-eslint/no-unused-expressions": "error",
|
||||
"@typescript-eslint/no-useless-empty-export": "error",
|
||||
"@typescript-eslint/no-wrapper-object-types": "error",
|
||||
"@typescript-eslint/non-nullable-type-assertion-style": "error",
|
||||
"@typescript-eslint/prefer-as-const": "error",
|
||||
"@typescript-eslint/prefer-find": "error",
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
"eslint-plugin-simple-header": "^1.1.1",
|
||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||
"eslint-plugin-unicorn": "^55.0.0",
|
||||
"eslint-plugin-unused-imports": "^4.1.2",
|
||||
"eslint-plugin-unused-imports": "^4.1.3",
|
||||
"puppeteer-core": "^23.0.2",
|
||||
"semver": "^7.6.3",
|
||||
"tsx": "^4.17.0",
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import type { StringProperties } from "../internal";
|
||||
|
||||
// Original name: Record
|
||||
// Renamed to avoid name conflicts with TypeScripts's Record utility type.
|
||||
export declare abstract class ImmutableRecord<
|
||||
|
@ -11,7 +13,7 @@ export declare abstract class ImmutableRecord<
|
|||
> {
|
||||
constructor(properties: OwnProperties);
|
||||
|
||||
merge(collection: Partial<Omit<OwnProperties, symbol>>): this;
|
||||
merge(collection: Partial<StringProperties<OwnProperties>> & Pick<Object, "hasOwnProperty">): this;
|
||||
set<Key extends keyof OwnProperties>(key: Key, value: OwnProperties[Key]): this;
|
||||
toJS(): OwnProperties;
|
||||
update<Key extends keyof OwnProperties>(
|
||||
|
|
|
@ -105,7 +105,7 @@ export declare abstract class ChannelRecordProperties {
|
|||
lastMessageId: string | Nullish;
|
||||
lastPinTimestamp: string | Nullish;
|
||||
/** @todo */
|
||||
linkedLobby?: any;
|
||||
linkedLobby?: { application_id?: string | null; } & Record<string, any> | Nullish;
|
||||
member?: ThreadMember | undefined;
|
||||
memberCount?: number | undefined;
|
||||
memberIdsPreview?: string[] | undefined;
|
||||
|
|
|
@ -8,7 +8,7 @@ import type MessageFormat from "intl-messageformat";
|
|||
import type { ReactElement, ReactNode } from "react";
|
||||
import type { State } from "simple-markdown";
|
||||
|
||||
import type { IsAny, IsStringLiteral, Stringable, UnionToIntersection } from "../../internal";
|
||||
import type { IsAny, IsDomainFinite, Stringable, StringProperties, UnionToIntersection } from "../../internal";
|
||||
|
||||
export declare class FormattedMessage<
|
||||
Args extends GenericArgs = GenericArgs,
|
||||
|
@ -55,9 +55,9 @@ export declare class FormattedMessage<
|
|||
message: string;
|
||||
}
|
||||
|
||||
type GenericArgs = RecordArgs | TupleArgs | string;
|
||||
type RecordArgs = Record<string, GenericValue>;
|
||||
type TupleArgs = readonly [stringableArgs: string, hookArgs: string];
|
||||
type GenericArgs = RecordArgs | TupleArgs | string | number;
|
||||
type RecordArgs = Record<string | number, GenericValue>;
|
||||
type TupleArgs = readonly [stringableArgs: string | number, hookArgs: string | number];
|
||||
|
||||
type GenericValue = Stringable | HookValue;
|
||||
type HookValue = (result: ReactNode, key: State["key"]) => ReactNode;
|
||||
|
@ -69,16 +69,16 @@ type FormatArgs<Args extends GenericArgs>
|
|||
? []
|
||||
: keyof MessageValues<Args> extends never
|
||||
? []
|
||||
: false extends IsStringLiteral<keyof MessageValues<Args> & string>
|
||||
? [values: never]
|
||||
: [values: MessageValues<Args>];
|
||||
: unknown extends IsDomainFinite<keyof MessageValues<Args>>
|
||||
? [values: MessageValues<Args>]
|
||||
: [values: never];
|
||||
|
||||
type MessageValues<Args extends GenericArgs> = UnionToIntersection<
|
||||
Args extends string
|
||||
Args extends string | number
|
||||
? Record<Args, Stringable>
|
||||
: Args extends TupleArgs
|
||||
? Record<Args[0], Stringable> & Record<Args[1], HookValue>
|
||||
: Required<Pick<Args, keyof Args & string>>
|
||||
: Required<StringProperties<Args>>
|
||||
>;
|
||||
|
||||
/** @todo Add types for every type of ASTNode. */
|
||||
|
|
|
@ -8,6 +8,7 @@ import type { FormattedMessage } from "./FormattedMessage";
|
|||
|
||||
type GenericMessages<Key extends PropertyKey = PropertyKey> = Record<Key, string | FormattedMessage>;
|
||||
|
||||
// Original name: ProxyProvider
|
||||
export declare class Provider<Messages extends GenericMessages<never> = GenericMessages> {
|
||||
constructor(getParsedMessages: ProviderParsedMessagesGetter<Messages>);
|
||||
|
||||
|
|
|
@ -19,12 +19,16 @@ export type GenericConstructor = new (...args: any[]) => unknown;
|
|||
export type IsAny<T> = 0 extends 1 & T ? unknown : never;
|
||||
|
||||
/** @internal */
|
||||
export type IsStringLiteral<T extends string>
|
||||
= T extends unknown
|
||||
? {} extends Record<T, unknown>
|
||||
? false
|
||||
: true
|
||||
: never;
|
||||
export type IsDomainFinite<T extends PropertyKey>
|
||||
= unknown extends (
|
||||
T extends unknown
|
||||
? {} extends Record<T, unknown>
|
||||
? unknown
|
||||
: never
|
||||
: never
|
||||
)
|
||||
? never
|
||||
: unknown;
|
||||
|
||||
/** @internal */
|
||||
export type Nullish = null | undefined;
|
||||
|
@ -74,6 +78,10 @@ export type Stringable
|
|||
| ({ toString: () => StringablePrimitive; } | { valueOf: () => StringablePrimitive; })
|
||||
& { [Symbol.toPrimitive]?: Nullish; };
|
||||
|
||||
/** @internal */
|
||||
export type StringProperties<T>
|
||||
= { [Key in keyof T as Exclude<Key, symbol>]: T[Key]; };
|
||||
|
||||
/** @internal */
|
||||
export type UnionToIntersection<Union> = (
|
||||
Union extends unknown
|
||||
|
|
|
@ -122,8 +122,8 @@ importers:
|
|||
specifier: ^12.1.1
|
||||
version: 12.1.1(eslint@9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
|
||||
eslint-plugin-unused-imports:
|
||||
specifier: ^4.1.2
|
||||
version: 4.1.2(@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
|
||||
specifier: ^4.1.3
|
||||
version: 4.1.3(@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
|
||||
highlight.js:
|
||||
specifier: 11.8.0
|
||||
version: 11.8.0
|
||||
|
@ -222,8 +222,8 @@ importers:
|
|||
specifier: ^55.0.0
|
||||
version: 55.0.0(eslint@9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
|
||||
eslint-plugin-unused-imports:
|
||||
specifier: ^4.1.2
|
||||
version: 4.1.2(@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
|
||||
specifier: ^4.1.3
|
||||
version: 4.1.3(@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))
|
||||
puppeteer-core:
|
||||
specifier: ^23.0.2
|
||||
version: 23.0.2
|
||||
|
@ -1238,8 +1238,8 @@ packages:
|
|||
peerDependencies:
|
||||
eslint: '>=8.56.0'
|
||||
|
||||
eslint-plugin-unused-imports@4.1.2:
|
||||
resolution: {integrity: sha512-A/Ypb0DQlDEzIbcoAv87NpLLcG3iwlE0gBEpS9Ud/62v2v3CoO15lZ/WfGyo2Wq7YraWJ2aE0TeHgJcpor6KQQ==}
|
||||
eslint-plugin-unused-imports@4.1.3:
|
||||
resolution: {integrity: sha512-lqrNZIZjFMUr7P06eoKtQLwyVRibvG7N+LtfKtObYGizAAGrcqLkc3tDx+iAik2z7q0j/XI3ihjupIqxhFabFA==}
|
||||
peerDependencies:
|
||||
'@typescript-eslint/eslint-plugin': ^8.0.0-0 || ^7.0.0 || ^6.0.0 || ^5.0.0
|
||||
eslint: ^9.0.0 || ^8.0.0
|
||||
|
@ -3440,7 +3440,7 @@ snapshots:
|
|||
semver: 7.6.3
|
||||
strip-indent: 3.0.0
|
||||
|
||||
eslint-plugin-unused-imports@4.1.2(@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)):
|
||||
eslint-plugin-unused-imports@4.1.3(@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi))(typescript@5.5.4))(eslint@9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)):
|
||||
dependencies:
|
||||
eslint: 9.9.0(patch_hash=wy5a2dwvtxac2ygzwebqqjurgi)
|
||||
optionalDependencies:
|
||||
|
|
Loading…
Reference in a new issue