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

PoC of nested record definitions #7241

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

zth
Copy link
Collaborator

@zth zth commented Jan 10, 2025

type uploadOptions = {
  file: {
    path: string,
    filename: string,
    metadata?: {description?: string, tags?: array<string>},
  },
  processing?: {
    resize?: {width: int, height: int},
    compress?: {level: int, format: string},
  },
  security?: {
    encryption?: {algorithm: string, key: string},
    accessControl?: {public: bool, expiration?: int},
  },
}

let uploadOptions = {
  file: {
    path: "/path/to/file.png",
    filename: "file.png",
    metadata: {description: "Sample file", tags: ["image", "upload"]},
  },
  processing: {
    resize: {width: 1920, height: 1080},
    compress: {level: 7, format: "jpg"},
  },
  security: {
    encryption: {algorithm: "AES-256", key: "secure-key"},
    accessControl: {public: false, expiration: 3600},
  },
}

Things missing:

  • Support for type params
  • Support for @as for renaming the generated type (do we want it?) Make the definition explicit if it should be reused.
  • First class representation in the AST
  • Support in the outcome printer so hovers etc include the full nested type. Unclear how to do this
  • Make sure locs are good and that the editor experience is good

@zth zth force-pushed the nested-record-definitions branch from 10634fe to 2f8d81b Compare January 11, 2025 20:00
@zth zth added this to the v12 milestone Jan 11, 2025
@zth zth self-assigned this Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

1 participant