Skip to content

Commit

Permalink
TypeStronggh-1556 example: types
Browse files Browse the repository at this point in the history
  • Loading branch information
srmagura committed Oct 2, 2021
1 parent 8f26698 commit b405848
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
3 changes: 2 additions & 1 deletion example/src/index.ts
@@ -1,4 +1,5 @@
// Don't reorder!
// Order matters!
export * from "./functions";
export * from "./variables";
export * from "./types";
export * from "./enums";
43 changes: 43 additions & 0 deletions example/src/types.ts
@@ -0,0 +1,43 @@
/** A simple type alias defined using the `type` keyword. */
export type SimpleTypeAlias = string | number | boolean;

/** A complex generic type. */
export type ComplexGenericTypeAlias<T> =
| T
| T[]
| Promise<T>
| Promise<T[]>
| Record<string, Promise<T>>;

/**
* A simple interface. Each property has its own doc comment.
*
* TypeDoc even supports doc comments on nested type definitions, as shown by the `name` property.
*/
export interface User {
/** The user's ID. */
id: number;

/** The user's email address. */
email: string;

/** The user's name. */
name: {
/** The person's given name. */
first: string;

/** The person's family name. */
last: string;
};
}

/**
* An interface that extends [[`User`]] and adds more properties.
*
* Notice how TypeDoc automatically shows the inheritance hierarchy and where
* each property was originally defined.
*/
export interface AdminUser extends User {
administrativeArea: "sales" | "delivery" | "billing";
jobTitle: string;
}

0 comments on commit b405848

Please sign in to comment.