-
Notifications
You must be signed in to change notification settings - Fork 233
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
static types improvements #6256
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
4169857
chore: ts-check types.js
turadg 52aa261
chore: fix types
turadg cf27bc4
chore: parameterize offer()
turadg c46e789
chore: fix offer/invitation types
turadg ab55fb8
chore: Invitation type result first
turadg 89ee478
chore(types): never allow offer args to arg-less invitations
turadg cafb4e9
chore: ts-check most files that have typedefs
turadg 5349bf5
refactor(types): improvements
turadg 34c702b
refactor(solo): runtime validation
turadg 428b274
feat(ertp): types module
turadg 7e677cd
chore(types): maxNodeModuleJsDepth=0 and disable ambient
turadg 503219b
chore(types): maxNodeModuleJsDepth=0 and disable ambient
turadg 2057268
chore(agoric-cli): maxNodeModuleJsDepth=0 and disable ambient types
turadg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense for both line 247 and 249 to specify defaults?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. One is JSDoc telling the consumer what the default is and the other the runtime making it so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The runtime making it happen is on line 254. As I read it (I'm admittedly not the expert here) line 247 says that the AssetKind type doesn't require that its parameter be specified, and if it's omitted from the types, it'll assume
'nat'
. Line 249 says that the call to makeEmpty doesn't require a second arg, with the same default. Don't those have the same impact?If a call appears without the second arg, both typescript and javascript should use
'nat'
. If the arg is provided, both should draw the same conclusion. If there's an explicit declaration that conflicts with the code, TS should complain. Won't all the same things happen if line 247 has the default and 249 doesn't?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I misread the discussion as being about line 254 (the runtime default).
You're right, 249 shouldn't have a default. I'll fix in this in #6287