Skip to content

Instantly share code, notes, and snippets.

@bartwttewaall
Last active January 4, 2022 08:46
Show Gist options
  • Save bartwttewaall/e370e0a669befc9637e37aa91fef910d to your computer and use it in GitHub Desktop.
Save bartwttewaall/e370e0a669befc9637e37aa91fef910d to your computer and use it in GitHub Desktop.
HashTable and CssStyleObject
type Dictionary<T> = { [key: string]: T };
type Nullable<T> = T | null;
// Use `&` for creating an intersection type!
type CssStyleObject = Partial<CSSStyleDeclaration> & Dictionary<Nullable<string>>;
/** Example
* used for declaring partial css style objects
**/
interface MyState {
myStyle: CssStyleObject;
}
const state = reactive<MyState>({
myStyle: {}
});
computed(() => {
state.myStyle = {
height: `${props.size}px`,
width: `${props.size}px`
};
});
export interface HashTable<T> {
[key: string]: T;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment