Last active
January 4, 2022 08:46
-
-
Save bartwttewaall/e370e0a669befc9637e37aa91fef910d to your computer and use it in GitHub Desktop.
HashTable and CssStyleObject
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` | |
}; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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