mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-18 06:03:22 +08:00
fix lint
This commit is contained in:
parent
9c411f4830
commit
356696772e
@ -17,7 +17,7 @@ import EventEmitter from './EventEmitter'
|
||||
import { Extension } from './Extension'
|
||||
import { NodeExtension } from './NodeExtension'
|
||||
import { MarkExtension } from './MarkExtension'
|
||||
import { Extensions, UnionToIntersection, PickValue } from './types'
|
||||
import { Extensions, UnionToIntersection } from './types'
|
||||
import * as extensions from './extensions'
|
||||
import style from './style'
|
||||
|
||||
@ -40,50 +40,7 @@ export interface CommandsSpec {
|
||||
|
||||
export interface AllExtensions {}
|
||||
|
||||
// type names = AllExtensions[keyof AllExtensions]
|
||||
// type onlyExtensions = AllExtensions[keyof AllExtensions] extends Extension ? '1' : '0'
|
||||
// type onlyExtensions = AllExtensions[keyof AllExtensions extends Extension ? '1' : '0']
|
||||
|
||||
// export type OnlyExtensions = {
|
||||
// [Item in keyof AllExtensions]: AllExtensions[Item] extends Extension
|
||||
// ? AllExtensions[Item]
|
||||
// : never
|
||||
// }
|
||||
|
||||
// type ExtractCat<A> = A extends Extension ? A : never
|
||||
|
||||
// export type OnlyExtensions = ExtractCat<Item in keyof AllExtensions>
|
||||
|
||||
// type ExtractCommands<G> = G extends Extension<any, infer S> ? S : never
|
||||
// type Test = UnionToIntersection<ExtractCommands<OnlyExtensions[keyof OnlyExtensions]>>
|
||||
|
||||
// type SubType<Base, Condition> = Pick<Base, {
|
||||
// [Key in keyof Base]: Base[Key] extends Condition ? Key : never
|
||||
// }[keyof Base]>;
|
||||
|
||||
// type OnlyExtensions = SubType<AllExtensions, Extension>
|
||||
// type ExtractCommands<G> = G extends Extension<any, infer S> ? S : never
|
||||
// type Test = ExtractCommands<OnlyExtensions[keyof OnlyExtensions]>
|
||||
|
||||
// type ExtractCommands<G> = G extends Extension<any, infer S>
|
||||
// ? never
|
||||
// : G extends NodeExtension<any, infer T>
|
||||
// ? never
|
||||
// : G extends MarkExtension<any, infer U>
|
||||
// ? U
|
||||
// : never
|
||||
|
||||
// export type Bla = {
|
||||
// [Item in keyof AllExtensions]: AllExtensions[Item] extends Extension<any, infer S>
|
||||
// ? S
|
||||
// : AllExtensions[Item] extends NodeExtension<any, infer T>
|
||||
// ? T
|
||||
// : AllExtensions[Item] extends MarkExtension<any, infer U>
|
||||
// ? U
|
||||
// : never
|
||||
// }
|
||||
|
||||
export type Bla = {
|
||||
export type UnfilteredCommands = {
|
||||
[Item in keyof AllExtensions]: AllExtensions[Item] extends Extension<any, infer ExtensionCommands>
|
||||
? ExtensionCommands
|
||||
: AllExtensions[Item] extends NodeExtension<any, infer NodeExtensionCommands>
|
||||
@ -95,7 +52,7 @@ export type Bla = {
|
||||
|
||||
type ValuesOf<T> = T[keyof T];
|
||||
type KeysWithTypeOf<T, Type> = ({[P in keyof T]: T[P] extends Type ? P : never })[keyof T]
|
||||
type AllCommands = UnionToIntersection<ValuesOf<Pick<Bla, KeysWithTypeOf<Bla, {}>>>>
|
||||
type AllCommands = UnionToIntersection<ValuesOf<Pick<UnfilteredCommands, KeysWithTypeOf<UnfilteredCommands, {}>>>>
|
||||
|
||||
export type SingleCommands = {
|
||||
[Item in keyof AllCommands]: AllCommands[Item] extends (...args: any[]) => any
|
||||
|
Loading…
Reference in New Issue
Block a user