From 6947c439a58a4004872ab68c41ff261b5eaec242 Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Sat, 23 Dec 2017 13:53:14 +0700 Subject: [PATCH] [docs] Unable to extend type interfaces (e.g. Game, Memory) --- docs/troubleshooting.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 828548b..90880b5 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -11,3 +11,12 @@ If you're getting the following error: ``` Make sure you have [screepsmod-auth](https://github.com/ScreepsMods/screepsmod-auth) installed on your private server, and you've set a password on the account in your private server as well. + +## Unable to extend type interfaces (e.g. `Game`, `Memory`) + +Make sure you declare any extensions to the type interfaces as an [*ambient declaration*](https://stackoverflow.com/a/40916055). You can either: + +* put them inside a `*.d.ts` file, or +* in an existing `.ts` file (with at least one `import` or `export`), you can use `declare global { interface CreepMemory { ... } }` to accomplish the same effect. + +**For more info:** https://github.com/screepers/typed-screeps/issues/27