Add default type values to parse functions in js-experimental #164
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently when we generate a
ParsedXInstruction
type it has sensible default type params:But the
parseXInstruction
doesn't have default type params:This means that the
ParsedXInstruction
type returned byparseXInstruction(instruction)
returnedParsedXInstruction<string, readonly IAccountMeta[]>
This causes a problem because the definition of
ParsedSplSystemProgramInstruction
includesParsedTransferSolInstruction
without specifying type params, ie using the default of the program IDTherefore we get a type error if we try to do:
I think the best fix is to just add the default type params to the
parseXInstruction
function to match theParsedXInstruction
type, which is what this PR doesMost changes are a result of the generated test being updated, since this changes the parse function in each instruction. Non-generated changes are to src/renderers/js-experimental/fragments/instructionParseFunction.njk + https://github.com/metaplex-foundation/kinobi/compare/main...mcintyre94:cm-default-parse-types?expand=1#diff-7924ecc400cbdbf956997331e2f3f3736f6405fd3649c66d314961724d8d89ac