-
-
Notifications
You must be signed in to change notification settings - Fork 904
Open
Labels
featureType/scope: New or intentionally changed behaviorType/scope: New or intentionally changed behaviorin progressStatus: Someone is working on itStatus: Someone is working on it
Milestone
Description
First Check
- I added a very descriptive title here.
- This is not a security issue (those should be reported via the security advisory instead).
- This is not a Q&A. I am sure something is wrong with NiceGUI or its documentation.
- I used the GitHub search to find a similar issue and came up empty.
Example Code
from dataclasses import dataclass
from nicegui.binding import bindable_dataclass
class Demo:
value: int
@dataclass
class DemoDC:
value: int
@bindable_dataclass
class DemoNG:
value: int
Demo().value = 1
DemoDC().value = 1
DemoNG().value = 1Description
When I add this code to VS Code with Python extension, the last line does not autocomplete ".value".
Looks like the type checker cannot determine the type of the DemoNG() instance.
See also below screenshot:
NiceGUI Version
3.7.1
Python Version
3.11.14
Browser
Firefox
Operating System
Windows
Additional Context
Tested in VS Code on both Win11 and Red Hat Linux.
It works fine if I remove the return type of nicegui.binding.bindable_dataclass in this line:
Line 278 in ee3ead1
| **kwargs: Any) -> type[DataclassInstance] | IdentityFunction: |
Though I guess that return type was placed there for a reason :)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureType/scope: New or intentionally changed behaviorType/scope: New or intentionally changed behaviorin progressStatus: Someone is working on itStatus: Someone is working on it