Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update types.ts #19

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 59 additions & 66 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,87 +1,80 @@
export type Mutable<T> = {
-readonly [P in keyof T]: T[P];
};

export const enum Gender {
male = 'male',
female = 'female',
}

Check failure on line 1 in src/types.ts

View workflow job for this annotation

GitHub Actions / build

Declaration or statement expected.

export const enum RelType {
blood = 'blood',
married = 'married',
divorced = 'divorced',
adopted = 'adopted',
half = 'half',
blood = 'blood',
married = 'married',
divorced = 'divorced',
adopted = 'adopted',
half = 'half',
}

export const enum FamilyType {
root = 'root',
child = 'child',
parent = 'parent',
root = 'root',
child = 'child',
parent = 'parent',
}

export type Family = {
readonly id: number;
readonly type: FamilyType;
readonly main: boolean;
/** Parent family ID */
pid?: number;
/** Child family ID */
cid?: number;
/** Family's left coordinate */
X: number;
/** Family's top coordinate */
Y: number;
parents: readonly Unit[];
children: readonly Unit[];
readonly id: number;
readonly type: FamilyType;
readonly main: boolean;
/** Parent family ID */
pid?: number;
/** Child family ID */
cid?: number;
/** Family's left coordinate */
X: number;
/** Family's top coordinate */
Y: number;
parents: readonly Unit[];
children: readonly Unit[];
}

export type Unit = {
/** Family ID */
readonly fid: number;
/** Is child unit */
readonly child: boolean;
readonly nodes: readonly Node[];
pos: number;
/** Family ID */
readonly fid: number;
/** Is child unit */
readonly child: boolean;
readonly nodes: readonly Node[];
pos: number;
}

export type Size = Readonly<{
width: number;
height: number;
width: number;
height: number;
}>

export type Relation = Readonly<{
id: string;
type: RelType;
id: string;
type: RelType;
}>

export type Node = Readonly<{
id: string;
gender: Gender;
parents: readonly Relation[];
children: readonly Relation[];
siblings: readonly Relation[];
spouses: readonly Relation[];
placeholder?: boolean;
export type Node = T & Readonly<{

Check failure on line 52 in src/types.ts

View workflow job for this annotation

GitHub Actions / build

Exported type alias 'Node' has or is using private name 'T'.
id: string;
gender: Gender;

Check failure on line 54 in src/types.ts

View workflow job for this annotation

GitHub Actions / build

Exported type alias 'Node' has or is using private name 'Gender'.
parents: readonly Relation[];
children: readonly Relation[];
siblings: readonly Relation[];
spouses: readonly Relation[];
placeholder?: boolean;
}>

export type ExtNode = Node & Readonly<{
top: number;
left: number;
hasSubTree: boolean;
top: number;
left: number;
hasSubTree: boolean;
}>

export type Connector = readonly [x1: number, y1: number, x2: number, y2: number];

export type RelData = Readonly<{
canvas: Size;
families: readonly Family[];
nodes: readonly ExtNode[];
connectors: readonly Connector[];
canvas: Size;
families: readonly Family[];
nodes: readonly ExtNode[];
connectors: readonly Connector[];
}>

export type Options = Readonly<{
rootId: string;
placeholders?: boolean;
rootId: string;
placeholders?: boolean;
}>
Loading