Skip to content

Instantly share code, notes, and snippets.

@iAmWillShepherd
Created July 29, 2021 20:06
Show Gist options
  • Save iAmWillShepherd/cf0a99a15dbe8361b5b120d791ed6aa2 to your computer and use it in GitHub Desktop.
Save iAmWillShepherd/cf0a99a15dbe8361b5b120d791ed6aa2 to your computer and use it in GitHub Desktop.
Use the Omit utility type to create a new type with specific properties removed。
interface BaseType {
a: string
b: number
c: number[]
}
// Keys 'a' and 'b' will be removed
type SubsetType = Omit<BaseType, 'a' | 'b'>
const subset: SubsetType = {
c: [1, 2, 3]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment