fix: narrow OrderBookSummary.tick_size from string to TickSize - #93
Open
osr21 wants to merge 1 commit into
Open
Conversation
The CLOB API always returns a tick_size value that is one of the defined
TickSize literals ("0.1" | "0.01" | "0.005" | "0.0025" | "0.001" | "0.0001").
Typing the field as plain string forces callers to validate/cast before
passing it to functions that accept TickSize.
Change: tick_size: string → tick_size: TickSize in OrderBookSummary.
TickSize is defined in the same file so no import is needed.
Fixes: Polymarket#50
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
OrderBookSummary.tick_sizeis typed asstringbut the CLOB API always returns a value that is one of theTickSizeliterals ("0.1" | "0.01" | "0.005" | "0.0025" | "0.001" | "0.0001"). Callers must cast or validate before passingtick_sizeto anything that acceptsTickSize.Fix
Change
tick_size: string→tick_size: TickSizein theOrderBookSummaryinterface insrc/types/clob.ts.TickSizeis already defined in the same file, so no import is needed.Fixes #50
Note
Low Risk
Type-only change with no runtime behavior; may surface compile errors where callers assumed an arbitrary string.
Overview
Narrows
OrderBookSummary.tick_sizefromstringto the existingTickSizeunion insrc/types/clob.ts, matching what the CLOB order book API actually returns.Consumers of
getOrderBook/getOrderBookscan passtick_sizeintoCreateOrderOptionsand related helpers without extra casts or runtime checks.Reviewed by Cursor Bugbot for commit 12f6cb9. Bugbot is set up for automated code reviews on this repo. Configure here.