Skip to content

Introduce mapped types expressions as in typescript #9035

@artsiommiksiuk

Description

@artsiommiksiuk

Clear and concise description of the problem

Instead of writing decorators for omiting or requiring fields, there should be easier and more native construct in the language to achieve this.
E.g. I want to make all fields Nullable, or conditionally Nullable, or construct variations of models based on subset of fields in my model, so I'm forced to write custom decorator for that, instead of just expressing this in the language.
This would also simplify lot's of specific types utils development and introspection. Some very limited and primitive subset of what TypeScript can do atm with mapped types would suffice, like simple mapping, adding/removing optionality. This makes models parsing also easier in a sense that it eliminates additional decorators from an AST and forces work with more native language constructs.

Checklist

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    compiler:coreIssues for @typespec/compilerdesign:neededA design request has been raised that needs a proposaltriaged:core

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions