Skip to content

Commit

Permalink
types: do not make properties of the block optional (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
zardoy authored Sep 8, 2024
1 parent 31a446e commit b380715
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions typings/index-template.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ export interface LoginPacket {
isFlat?: boolean
}

type RequireOnly<T, K extends keyof T> = Partial<T> & Required<Pick<T, K>>
type MakeRequired<T, K extends keyof T> = T & Required<Pick<T, K>>

type IndexedBlock = RequireOnly<Block, 'minStateId' | 'maxStateId' | 'defaultState'>
type IndexedBlock = MakeRequired<Block, 'minStateId' | 'maxStateId' | 'defaultState'>

export interface IndexedData {
isOlderThan(version: string): boolean
Expand Down
1 change: 1 addition & 0 deletions typings/test-typings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ console.log(getMcData('bedrock_0.14').version)

console.log(getMcData('pc_1.9').blocksByName['dirt'])
console.log(getMcData('pc_1.9').blocksByName['dirt'].minStateId.toExponential)
console.log(getMcData('pc_1.9').blocksByName['dirt'].name.includes)

console.log(getMcData('pc_1.9').protocol.toClient)

Expand Down

0 comments on commit b380715

Please sign in to comment.