source: frontend/node_modules/ts-interface-checker/dist/util.d.ts

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[9af201e]1/**
2 * Error thrown by validation. Besides an informative message, it includes the path to the
3 * property which triggered the failure.
4 */
5export declare class VError extends Error {
6 path: string;
7 constructor(path: string, message: string);
8}
9/**
10 * IContext is used during validation to collect error messages. There is a "noop" fast
11 * implementation that does not pay attention to messages, and a full implementation that does.
12 */
13export interface IContext {
14 fail(relPath: string | number | null, message: string | null, score: number): false;
15 unionResolver(): IUnionResolver;
16 resolveUnion(ur: IUnionResolver): void;
17}
18/**
19 * This helper class is used to collect error messages reported while validating unions.
20 */
21export interface IUnionResolver {
22 createContext(): IContext;
23}
24/**
25 * IErrorDetail describes errors as returned by the validate() and validateStrict() methods.
26 */
27export interface IErrorDetail {
28 path: string;
29 message: string;
30 nested?: IErrorDetail[];
31}
32/**
33 * Fast implementation of IContext used for first-pass validation. If that fails, we can validate
34 * using DetailContext to collect error messages. That's faster for the common case when messages
35 * normally pass validation.
36 */
37export declare class NoopContext implements IContext, IUnionResolver {
38 fail(relPath: string | number | null, message: string | null, score: number): false;
39 unionResolver(): IUnionResolver;
40 createContext(): IContext;
41 resolveUnion(ur: IUnionResolver): void;
42}
43/**
44 * Complete implementation of IContext that collects meaningfull errors.
45 */
46export declare class DetailContext implements IContext {
47 private _propNames;
48 private _messages;
49 private _score;
50 fail(relPath: string | number | null, message: string | null, score: number): false;
51 unionResolver(): IUnionResolver;
52 resolveUnion(unionResolver: IUnionResolver): void;
53 getError(path: string): VError;
54 getErrorDetail(path: string): IErrorDetail | null;
55}
Note: See TracBrowser for help on using the repository browser.