Skip to content

Commit

Permalink
fix(hex): fix typing issue for createHexPrototype()
Browse files Browse the repository at this point in the history
  • Loading branch information
flauwekeul committed Apr 22, 2021
1 parent 39f96c6 commit d6e24b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions playground/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ interface CustomHex extends Hex {

const hexPrototype = createHexPrototype<CustomHex>({
dimensions: 30,
orientation: Orientation.POINTY,
custom: 'custom', // fixme: adding `orientation: 'flat'` makes this an error, adding `orientation: Orientation.FLAT` doesn't
orientation: 'pointy',
custom: 'custom',
origin: 'topLeft',
})
// const hex = createHex(hexPrototype, { q: 4, r: 3 })
Expand Down
4 changes: 3 additions & 1 deletion src/hex/functions/createHexPrototype.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export const defaultHexSettings: HexSettings = {
offset: -1,
}

export const createHexPrototype = <T extends Hex>(options?: Partial<T | HexPrototypeOptions>): T => {
export const createHexPrototype = <T extends Hex>(
options?: Partial<Omit<T, 'dimensions' | 'orientation' | 'origin' | 'offset'> | HexPrototypeOptions>,
): T => {
// pseudo private property
const s = new WeakMap()

Expand Down

0 comments on commit d6e24b4

Please sign in to comment.