/*! * Copyright 2021 WPPConnect Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ export type InferArgs = T extends (...t: [...infer Arg]) => any ? Arg : never; export type InferReturn = T extends (...t: [...infer Arg]) => infer Res ? Res : never; export type FunctionPropertyNames = { [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]; export type FunctionProperties = Pick>; export type NonFunctionPropertyNames = { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]; export type NonFunctionProperties = Pick>; export type IfEquals = (() => T extends X ? 1 : 2) extends () => T extends Y ? 1 : 2 ? A : B; export type WritablePropertiesNames = { [P in keyof T]-?: IfEquals<{ [Q in P]: T[P]; }, { -readonly [Q in P]: T[P]; }, P>; }[keyof T]; export type WritableProperties = Pick>; export type ReadonlyPropertiesNames = { [P in keyof T]-?: IfEquals<{ [Q in P]: T[P]; }, { -readonly [Q in P]: T[P]; }, never, P>; }[keyof T]; export type ReadonlyProperties = Pick>;