From 9bdb95c9e34cef640534e5e5a1e2225a80442000 Mon Sep 17 00:00:00 2001 From: HelenHuang <LinHuang@pollex.com.tw> Date: 星期四, 09 六月 2022 15:48:15 +0800 Subject: [PATCH] TODO#139894 [ footer -最下方說明與保經代合作 ] 文案修改 --- PAMapp/node_modules/@types/prettier/index.d.ts | 192 ++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 178 insertions(+), 14 deletions(-) diff --git a/PAMapp/node_modules/@types/prettier/index.d.ts b/PAMapp/node_modules/@types/prettier/index.d.ts index 410eede..e6b9449 100755 --- a/PAMapp/node_modules/@types/prettier/index.d.ts +++ b/PAMapp/node_modules/@types/prettier/index.d.ts @@ -1,15 +1,21 @@ -// Type definitions for prettier 2.4 -// Project: https://github.com/prettier/prettier, https://prettier.io -// Definitions by: Ika <https://github.com/ikatyang>, -// Ifiok Jr. <https://github.com/ifiokjr>, -// Florian Imdahl <https://github.com/ffflorian>, -// Sosuke Suzuki <https://github.com/sosukesuzuki>, +// Type definitions for prettier 2.6 +// Project: https://prettier.io +// https://github.com/prettier/prettier +// Definitions by: Ika <https://github.com/ikatyang> +// Ifiok Jr. <https://github.com/ifiokjr> +// Florian Imdahl <https://github.com/ffflorian> +// Sosuke Suzuki <https://github.com/sosukesuzuki> // Christopher Quadflieg <https://github.com/Shinigami92> -// Kevin Deisz <https://github.com/kddeisz> // Georgii Dolzhykov <https://github.com/thorn0> // JounQin <https://github.com/JounQin> +// Chuah Chee Shian <https://github.com/shian15810> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.7 +// Minimum TypeScript Version: 4.2 + +// Adding export {} here to shut off automatic exporting from index.d.ts. There +// are quite a few utility types here that don't need to be shipped with the +// exported module. +export {}; // This utility is here to handle the case where you have an explicit union // between string literals and the generic string type. It would normally @@ -23,20 +29,160 @@ export type AST = any; export type Doc = doc.builders.Doc; -// https://github.com/prettier/prettier/blob/main/src/common/ast-path.js +// The type of elements that make up the given array T. +type ArrayElement<T> = T extends Array<infer E> ? E : never; +// A union of the properties of the given object that are arrays. +type ArrayProperties<T> = { [K in keyof T]: T[K] extends any[] ? K : never }[keyof T]; + +// A union of the properties of the given array T that can be used to index it. +// If the array is a tuple, then that's going to be the explicit indices of the +// array, otherwise it's going to just be number. +type IndexProperties<T extends { length: number }> = IsTuple<T> extends true + ? Exclude<Partial<T>['length'], T['length']> + : number; + +// Effectively performing T[P], except that it's telling TypeScript that it's +// safe to do this for tuples, arrays, or objects. +type IndexValue<T, P> = T extends any[] ? (P extends number ? T[P] : never) : P extends keyof T ? T[P] : never; + +// Determines if an object T is an array like string[] (in which case this +// evaluates to false) or a tuple like [string] (in which case this evaluates to +// true). +// eslint-disable-next-line @typescript-eslint/no-unused-vars +type IsTuple<T> = T extends [] ? true : T extends [infer First, ...infer Remain] ? IsTuple<Remain> : false; + +type CallProperties<T> = T extends any[] ? IndexProperties<T> : keyof T; +type IterProperties<T> = T extends any[] ? IndexProperties<T> : ArrayProperties<T>; + +type CallCallback<T, U> = (path: AstPath<T>, index: number, value: any) => U; +type EachCallback<T> = (path: AstPath<ArrayElement<T>>, index: number, value: any) => void; +type MapCallback<T, U> = (path: AstPath<ArrayElement<T>>, index: number, value: any) => U; + +// https://github.com/prettier/prettier/blob/main/src/common/ast-path.js export class AstPath<T = any> { constructor(value: T); stack: T[]; + callParent<U>(callback: (path: this) => U, count?: number): U; getName(): PropertyKey | null; getValue(): T; getNode(count?: number): T | null; getParentNode(count?: number): T | null; - call<U>(callback: (path: this) => U, ...names: PropertyKey[]): U; - callParent<U>(callback: (path: this) => U, count?: number): U; - each(callback: (path: this, index: number, value: any) => void, ...names: PropertyKey[]): void; - map<U>(callback: (path: this, index: number, value: any) => U, ...names: PropertyKey[]): U[]; match(...predicates: Array<(node: any, name: string | null, number: number | null) => boolean>): boolean; + + // For each of the tree walk functions (call, each, and map) this provides 5 + // strict type signatures, along with a fallback at the end if you end up + // calling more than 5 properties deep. This helps a lot with typing because + // for the majority of cases you're calling fewer than 5 properties, so the + // tree walk functions have a clearer understanding of what you're doing. + // + // Note that resolving these types is somewhat complicated, and it wasn't + // even supported until TypeScript 4.2 (before it would just say that the + // type instantiation was excessively deep and possibly infinite). + + call<U>(callback: CallCallback<T, U>): U; + call<U, P1 extends CallProperties<T>>(callback: CallCallback<IndexValue<T, P1>, U>, prop1: P1): U; + call<U, P1 extends keyof T, P2 extends CallProperties<T[P1]>>( + callback: CallCallback<IndexValue<IndexValue<T, P1>, P2>, U>, + prop1: P1, + prop2: P2, + ): U; + call<U, P1 extends keyof T, P2 extends CallProperties<T[P1]>, P3 extends CallProperties<IndexValue<T[P1], P2>>>( + callback: CallCallback<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, U>, + prop1: P1, + prop2: P2, + prop3: P3, + ): U; + call< + U, + P1 extends keyof T, + P2 extends CallProperties<T[P1]>, + P3 extends CallProperties<IndexValue<T[P1], P2>>, + P4 extends CallProperties<IndexValue<IndexValue<T[P1], P2>, P3>> + >( + callback: CallCallback<IndexValue<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, P4>, U>, + prop1: P1, + prop2: P2, + prop3: P3, + prop4: P4, + ): U; + call<U, P extends PropertyKey>( + callback: CallCallback<any, U>, + prop1: P, + prop2: P, + prop3: P, + prop4: P, + ...props: P[] + ): U; + + each(callback: EachCallback<T>): void; + each<P1 extends IterProperties<T>>(callback: EachCallback<IndexValue<T, P1>>, prop1: P1): void; + each<P1 extends keyof T, P2 extends IterProperties<T[P1]>>( + callback: EachCallback<IndexValue<IndexValue<T, P1>, P2>>, + prop1: P1, + prop2: P2, + ): void; + each<P1 extends keyof T, P2 extends IterProperties<T[P1]>, P3 extends IterProperties<IndexValue<T[P1], P2>>>( + callback: EachCallback<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>>, + prop1: P1, + prop2: P2, + prop3: P3, + ): void; + each< + P1 extends keyof T, + P2 extends IterProperties<T[P1]>, + P3 extends IterProperties<IndexValue<T[P1], P2>>, + P4 extends IterProperties<IndexValue<IndexValue<T[P1], P2>, P3>> + >( + callback: EachCallback<IndexValue<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, P4>>, + prop1: P1, + prop2: P2, + prop3: P3, + prop4: P4, + ): void; + each( + callback: EachCallback<any[]>, + prop1: PropertyKey, + prop2: PropertyKey, + prop3: PropertyKey, + prop4: PropertyKey, + ...props: PropertyKey[] + ): void; + + map<U>(callback: MapCallback<T, U>): U[]; + map<U, P1 extends IterProperties<T>>(callback: MapCallback<IndexValue<T, P1>, U>, prop1: P1): U[]; + map<U, P1 extends keyof T, P2 extends IterProperties<T[P1]>>( + callback: MapCallback<IndexValue<IndexValue<T, P1>, P2>, U>, + prop1: P1, + prop2: P2, + ): U[]; + map<U, P1 extends keyof T, P2 extends IterProperties<T[P1]>, P3 extends IterProperties<IndexValue<T[P1], P2>>>( + callback: MapCallback<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, U>, + prop1: P1, + prop2: P2, + prop3: P3, + ): U[]; + map< + U, + P1 extends keyof T, + P2 extends IterProperties<T[P1]>, + P3 extends IterProperties<IndexValue<T[P1], P2>>, + P4 extends IterProperties<IndexValue<IndexValue<T[P1], P2>, P3>> + >( + callback: MapCallback<IndexValue<IndexValue<IndexValue<IndexValue<T, P1>, P2>, P3>, P4>, U>, + prop1: P1, + prop2: P2, + prop3: P3, + prop4: P4, + ): U[]; + map<U>( + callback: MapCallback<any[], U>, + prop1: PropertyKey, + prop2: PropertyKey, + prop3: PropertyKey, + prop4: PropertyKey, + ...props: PropertyKey[] + ): U[]; } /** @deprecated `FastPath` was renamed to `AstPath` */ @@ -70,7 +216,19 @@ export type CustomParser = (text: string, parsers: BuiltInParsers, options: Options) => AST; +/** + * For use in `.prettierrc.js`, `.prettierrc.cjs`, `prettier.config.js` or `prettier.config.cjs`. + */ +export interface Config extends Options { + overrides?: Array<{ + files: string | string[]; + excludeFiles?: string | string[]; + options?: Options; + }>; +} + export interface Options extends Partial<RequiredOptions> {} + export interface RequiredOptions extends doc.printer.Options { /** * Print semicolons at the ends of statements. @@ -159,7 +317,7 @@ /** * Specify plugin directory paths to search for plugins if not installed in the same `node_modules` where prettier is located. */ - pluginSearchDirs: string[]; + pluginSearchDirs: string[] | false; /** * How to handle whitespaces in HTML. * @default 'css' @@ -185,6 +343,11 @@ * @default 'auto' */ embeddedLanguageFormatting: 'auto' | 'off'; + /** + * Enforce single attribute per line in HTML, Vue and JSX. + * @default false + */ + singleAttributePerLine: boolean; } export interface ParserOptions<T = any> extends RequiredOptions { @@ -229,6 +392,7 @@ massageAstNode?: ((node: any, newNode: any, parent: any) => any) | undefined; hasPrettierIgnore?: ((path: AstPath<T>) => boolean) | undefined; canAttachComment?: ((node: T) => boolean) | undefined; + isBlockComment?: ((node: T) => boolean) | undefined; willPrintOwnComments?: ((path: AstPath<T>) => boolean) | undefined; printComment?: ((commentPath: AstPath<T>, options: ParserOptions<T>) => Doc) | undefined; handleComments?: -- Gitblit v1.8.0