documentation, some basic testing

This commit is contained in:
2024-04-01 18:01:17 -05:00
parent a09a7d7337
commit 2e7f4833a7
11 changed files with 186 additions and 11 deletions

View File

@@ -1,10 +1,32 @@
import React from 'react';
/**
* Given an JSX element type `TElement`, returns a subset of its props
* specified in the union `TProps`.
*/
export type PickElementProps<
TElement extends keyof React.JSX.IntrinsicElements,
TProps extends keyof React.ComponentProps<TElement>
> = Pick<React.ComponentProps<TElement>, TProps>;
/**
* Given an JSX element type `TElement`, returns its full set of props,
* excluding members of the union `TProps`.
*/
export type ExcludeElementProps<
TElement extends keyof React.JSX.IntrinsicElements,
TProps extends keyof React.ComponentProps<TElement>
> = Exclude<keyof React.ComponentProps<TElement>, TProps>;
export type ElementProps<TElement extends keyof React.JSX.IntrinsicElements> = React.ComponentProps<TElement>;
/**
* Mounts a virtual <a> tag and virtually clicks it, intiating a download
* on the client's device.
*
* @param url the URL location of the desired resource
* @param filename the name to assign to the download once completed
*/
export function clickVirtualDownloadLink(
url: string,
filename: string,