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

fix: correct the state types #139

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/lifecycle/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export type LifeCycleAppTypes = {
greeting: BinaryState
times: bigint
}
maps: {}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions examples/reti/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,7 @@ export type ValidatorRegistryTypes = {
numStakers: bigint
totalAlgoStaked: bigint
}
maps: {}
}
box: {
keys: {
Expand Down
2 changes: 2 additions & 0 deletions examples/state/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ export type StateAppTypes = {
int2: bigint
value: bigint
}
maps: {}
}
local: {
keys: {
Expand All @@ -319,6 +320,7 @@ export type StateAppTypes = {
localInt1: bigint
localInt2: bigint
}
maps: {}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions examples/voting/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ export type VotingRoundAppTypes = {
*/
voterCount: bigint
}
maps: {}
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/client/app-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ function* keysAndMaps(
yield `${keySafe}: ${prop.valueType === 'AVMBytes' ? 'BinaryState' : getEquivalentType(prop.valueType, 'output', { app, sanitizer })}`
}
yield DecIndentAndCloseBlock
} else {
yield 'keys: {}'
}

if (maps && Object.keys(maps).length) {
Expand All @@ -286,6 +288,8 @@ function* keysAndMaps(
yield `${keySafe}: Map<${getEquivalentType(prop.keyType, 'input', { app, sanitizer })}, ${getEquivalentType(prop.valueType, 'output', { app, sanitizer })}>`
}
yield DecIndentAndCloseBlock
} else {
yield 'maps: {}'
}
}

Expand All @@ -295,7 +299,7 @@ function* appState(
): DocumentParts {
const { hasBox, hasGlobal, hasLocal } = stateFlags

if (hasLocal || hasGlobal) {
if (hasLocal || hasGlobal || hasBox) {
yield* jsDoc('Defines the shape of the state of the application.')
yield 'state: {'
yield IncIndent
Expand Down
Loading