Skip to content

jameschen215/react-router-tutorial

Repository files navigation

What I've learned

Using JavaScript data fetch file in TypeScript

Add a whatever.d.ts file in the same folder.

export type Contact = {
	id: string;
	first: string;
	last: string;
	avatar: string;
	twitter: string;
	notes: string;
	favorite: boolean;
	createdAt: number;
};


declare module './contacts' {
	export async function getContacts(query?: string): Promise<Contact[]>;
	export async function createContact(): Promise<Contact>;
	export async function getContact(id?: string): Promise<Contact | null>;
	export async function updateContact(
		id?: string,
		updates: Partial<Omit<Contact, 'id'>>
	): Promise<Contact>;
	export async function deleteContact(id?: string): Promise<boolean>;
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published