Skip to content

Commit 64a3159

Browse files
committed
fix(types): align ParsePageRef TypedDict shape with its docstring
The docstring promises pageIndex/width/height are always populated and only pageNumber may be absent, but the class was declared `total=False`, which contradicts that and forces type-strict callers to guard every subscript access on guaranteed-present fields. Switch to the default (`total=True`) shape with pageNumber explicitly `NotRequired`, matching the precedent set by ParseBounds in the same module. No runtime impact — the wire already populates these fields.
1 parent 265c9c1 commit 64a3159

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/nutrient_dws/types/parse.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from typing import Literal
1414

15-
from typing_extensions import TypedDict
15+
from typing_extensions import NotRequired, TypedDict
1616

1717
from nutrient_dws.types.extraction_credits import ExtractionCredits
1818

@@ -75,7 +75,7 @@ class ParseBounds(TypedDict):
7575
height: float
7676

7777

78-
class ParsePageRef(TypedDict, total=False):
78+
class ParsePageRef(TypedDict):
7979
"""Reference to the page an element was extracted from.
8080
8181
`pageIndex` and dimensions are always populated; `pageNumber` carries the
@@ -84,9 +84,9 @@ class ParsePageRef(TypedDict, total=False):
8484
"""
8585

8686
pageIndex: int
87-
pageNumber: str
8887
width: float
8988
height: float
89+
pageNumber: NotRequired[str]
9090

9191

9292
class ParseWord(TypedDict, total=False):

0 commit comments

Comments
 (0)