1declare namespace public_api {
2  export interface CanvasKit {
3    publicExtension(myRects: InputFlattenedRectArray): number;
4    sayHello(x: number, y: number): void;
5    publicFunction(input: string): void;
6    withObject(obj: CompoundObj): void;
7
8    readonly Extension: ExtensionConstructor;
9    readonly Something: SomethingConstructor;
10  }
11
12  export interface ExtensionConstructor {
13    new(): Extension;
14    new(name: string): Extension;
15  }
16
17  export interface SomethingConstructor {
18    new(name: string): Something;
19  }
20
21  export interface Extension extends EmbindObject<Extension> {
22    getProp(): string;
23    setProp(p: string): void;
24  }
25
26  export interface Something extends EmbindObject<Something> {
27    getName(): string;
28    setName(name: string): void;
29  }
30
31  export interface CompoundObj {
32    alpha: number;
33    beta: string;
34    gamma?: number;
35  }
36
37  export type InputFlattenedRectArray = Float32Array | number[];
38  export type TypedArray = Float32Array | Int32Array;
39
40  export interface EmbindObject<T extends EmbindObject<T>> {
41    clone(): T;
42    delete(): void;
43    deleteAfter(): void;
44    isAliasOf(other: any): boolean;
45    isDeleted(): boolean;
46  }
47}
48