Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Tag based Id typing (soft) #144

Merged
merged 2 commits into from
Nov 20, 2019
Merged

Conversation

pyrodogg
Copy link
Member

@pyrodogg pyrodogg commented Nov 15, 2019

Brief Description

  • Change Id<T> to use Tag based implementation.
    • Allows implicit casting of Id<T> to string.
    • Requires explicit casting of string to Id<T>.
    • These are opposite of existing implementation.
  • Game.getObjectById() returns unknown type if string id provided
    without alternative method for designating type of returned object (ex.
    Game.getObjectById<Creep>(stringId))
  • Use of Game.getObjectById(id: string) is deprecated
  • Update README with breaking changes

Related to #92 and #93
Alternative to #145

Checklists

  • Test passed
  • Coding style (indentation, etc)
  • Edits have been made to src/ files not index.d.ts
  • Run npm run dtslint to update index.d.ts

- Change `Id<T>` to use `Tag` based implementation.
  - Allows implicit casting of `Id<T>` to `string`.
  - Requires explicit casting of `string` to `Id<T>`.
  - These are opposite of existing implementation.
- `Game.getObjectById()` returns `unknown` type if `string` id provided
without alternative method for designating type of returned object (ex.
`Game.getObjectById<Creep>(stringId)`)
@pyrodogg pyrodogg changed the title Implement Tag based Id typing Implement Tag based Id typing (soft) Nov 16, 2019
- Split definition of `Game.getObjectById()` to mark use of string ids
as deprecated
- Update README
@pyrodogg pyrodogg merged commit d4fbf98 into screepers:master Nov 20, 2019
@pyrodogg pyrodogg deleted the id-tag branch November 21, 2019 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant