typed-screeps icon indicating copy to clipboard operation
typed-screeps copied to clipboard

Make the memory interface merging docs more explicit.

Open ahmedcharles opened this issue 7 years ago • 4 comments

ahmedcharles avatar Apr 14 '18 01:04 ahmedcharles

It doesn't need to be in a .d.ts, just in an ambient context. This means it can be:

  1. In a non-module source file (.ts without any imports or exports) in the form declare let thing: ...
  2. In a module source file (.ts with imports or exports) in the form declare global { let thing: ... }
  3. In a declaration file (.d.ts) in the form declare let thing: ...

dmarcuse avatar Apr 14 '18 04:04 dmarcuse

Well, I'm happy as long as the docs are improved so that new users don't have to go through this same thing again.

ahmedcharles avatar Apr 14 '18 05:04 ahmedcharles

Maybe the readme should link to https://github.com/screepers/screeps-typescript-starter/blob/master/src/types.d.ts and we put an example of CreepMemory in there?

Arcath avatar Apr 18 '18 14:04 Arcath

@ahmedcharles Suggested change:

Example:

[code snip]

**Note:** This code needs to be in a file with a `.d.ts` extension and
the name cannot match any of the other base names in the same directory,
i.e. `memory.d.ts` without an adjecent `memory.ts`. See
[the declarations on the TypeScript starter kit](https://github.com/screepers/screeps-typescript-starter/blob/master/src/types.d.ts)
for example.

resir014 avatar May 22 '18 03:05 resir014