From 0e85da2a5dcbee827ef65c90d55ec36dacfd8d25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=BD=D0=B8=D0=BD=20=D0=95=D0=B3=D0=BE?= =?UTF-8?q?=D1=80?= Date: Sun, 28 Mar 2021 04:58:56 +1000 Subject: [PATCH] Improve keybind types --- package-lock.json | 4 ++-- package.json | 2 +- src/RawJSONBuilder.ts | 8 +++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2058d0b..e643d95 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rawjsonbuilder", - "version": "1.1.10", + "version": "1.1.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "rawjsonbuilder", - "version": "1.1.10", + "version": "1.1.11", "license": "MIT", "dependencies": { "minecraft-protocol-chat-parser": "^3.0.2" diff --git a/package.json b/package.json index 5829e23..644da6a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rawjsonbuilder", - "version": "1.1.10", + "version": "1.1.11", "description": "Minecraft Raw JSON text builder", "main": "./lib/RawJSONBuilder.js", "types": "./lib/interfaces.d.ts", diff --git a/src/RawJSONBuilder.ts b/src/RawJSONBuilder.ts index 33a4a05..03aed56 100644 --- a/src/RawJSONBuilder.ts +++ b/src/RawJSONBuilder.ts @@ -63,7 +63,13 @@ export class RawJSONBuilder { return this; } - setKeybind(keybind: IKeybind): this { + setKeybind(keybind: IKeybind | string): this { + if (typeof keybind === "string") { + keybind = { + keybind + }; + } + this.message = keybind; return this;