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

Extra key of TypedDict #1645

Closed
STofone opened this issue Mar 1, 2024 · 2 comments
Closed

Extra key of TypedDict #1645

STofone opened this issue Mar 1, 2024 · 2 comments
Labels
topic: feature Discussions about new features for Python's type annotations

Comments

@STofone
Copy link

STofone commented Mar 1, 2024

I am using pyside6 webview as gui(use typescript). It makes me feel like the Python is very backwards when i receive data from typescript. Any type in ts use flexibile key can not be support by TypedDict and have to use raw dict.
I think it also happened when using django.
The last time i get this feeling is when i use java springboot to receive data from frontend and have to use Map.
As a dynamically typed language, python lose its flexibility.
relative issue
discuss from discuss.python.org

type JSONContent = {
  type?: string
  attrs?: Record<string, any>
  content?: JSONContent[]
  marks?: {
    type: string
    attrs?: Record<string, any>
    [key: string]: any
  }[]
  text?: string
  [key: string]: any
}
@STofone STofone added the topic: feature Discussions about new features for Python's type annotations label Mar 1, 2024
@PIG208
Copy link

PIG208 commented Mar 1, 2024

You might be interested in PEP-728, which is partially inspired by TypeScript's Index Signatures.

@STofone
Copy link
Author

STofone commented Mar 2, 2024

You might be interested in PEP-728, which is partially inspired by TypeScript's Index Signatures.

Thanks, this is exactly what i want.

@STofone STofone closed this as completed Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: feature Discussions about new features for Python's type annotations
Projects
None yet
Development

No branches or pull requests

2 participants