Skip to content

cli: de-duplicate IDL JSON in TS types#1213

Closed
johnrees wants to merge 1 commit intosolana-foundation:masterfrom
johnrees:simple-types
Closed

cli: de-duplicate IDL JSON in TS types#1213
johnrees wants to merge 1 commit intosolana-foundation:masterfrom
johnrees:simple-types

Conversation

@johnrees
Copy link
Copy Markdown
Contributor

I haven't tested this locally yet (will do tomorrow if this is considered useful), I'm just getting reacquainted with IDL stuff that's been added over the past few months.

One of the things I noticed was that the IDL object is included twice in generated typescript types file. I assume the reasoning behind this was because the types were too generic?

If that's the case using as const should mean that you don't need to duplicate the JSON in the file as the type would effectively be a readonly representation of the object.

before: without as const, version is string after: with as const, version is readonly "0.1.0"
Screenshot 2021-12-31 at 12 06 00 AM Screenshot 2021-12-31 at 12 05 51 AM

@acheroncrypto acheroncrypto mentioned this pull request Feb 25, 2024
@acheroncrypto acheroncrypto added ts cli idl related to the IDL, either program or client side labels Mar 10, 2024
@acheroncrypto
Copy link
Copy Markdown
Collaborator

Superseded by #2824.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli idl related to the IDL, either program or client side ts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants