inkjs
inkjs copied to clipboard
Typing changes for VariablesState and Story
Checklist
- [x] The new code additions passed the tests (
npm test
). - [x] The linter ran and found no issues (
npm run-script lint
).
Description
This makes the experience of using inkjs from TypeScript slightly better by:
-
Adding typed access to a story's VariablesState. Now, a TypeScript user can do
story.variablesState['name']
orstory.variablesState.$<string>('name')
and either get the convenience that the indexed access affords or the typed access via the generic param of$
. Also, the$
function didn't allow for fetching a value without a TypeScript error. That's fixed! -
In
Story.BindExternalFunction
, thelookaheadSafe
parameter is nowfalse
by default. According to Ink's source:Usually, you want to pass 'false', especially if you want some action to be performed in game code when this function is called
As far as I can tell from the C#,
false
should generally be the default. This makes the specs' usage ofBindExternalFunction
correct and saves TypeScript users from having to passtrue
orfalse
everytime!
Hello, thank you for all 3 PRs! I've had a quick look already and they all seem interesting, I will try my best to do a review as soon as possible… but it might be a few days :)
Next release :
- Behaviour of
variablesState
has been modified in latest. - Added default
true
tolookaheadSafe