Skip to content

Move the "optional" attribute from TypeReference to Parameter #296

Closed

Description

@RomainMuller

The specification models the optional attribute of parameters on their TypeReference instead of directly on the parameter. This creates a confusion between nullable and optional.

The specification needs to be modified so optional parameters carry an optional attribute, while TypeReferences carry a nullable attribute.

Related: #230 #284 #295

Activity

  1. rix0rrr commented on Dec 28, 2018

    @rix0rrr
    Contributor

    So I wanted a function like such:

    method(anchor: Construct | undefined, realParameter: string, optionalParameter?: string) {
    }

    Because that method order made most sense (and yet we didn't necessarily have the first argument always available), but this was rejected.

    I've had to reorder arguments, which is not a BIG deal but it was suboptimal to my mind.

  2. eladb commented on Dec 30, 2018

    @eladb
    Contributor

    @rix0rrr I think is a different issue than where we model optionality of parameters. This is basically about nullibility of parameters, which is currently not supported by jsii (and should in my mind). Care to raise a separate issue?

  3. rix0rrr commented on Dec 31, 2018

    @rix0rrr
    Contributor

    Isn't adding type nullability something that we need to tackle as part of solving this ticket anyway?

  4. eladb commented on Dec 31, 2018

    @eladb
    Contributor

    it’s a related topic but not the same. This issue is basically just a modeling improvement (move the “optional” indication from the type reference to the parameter/property specification). Nullability is a different attribute of type references which is not the same as optionality.

    If at all, nullability should be part of the type-reference while optionality should be part of the consuming specification.

  5. added
    feature-request
    and removed on Jan 3, 2019
  6. self-assigned this
    on Apr 4, 2019
  7. added a commit that references this issue on Apr 4, 2019
    a772323
  8. added
    effort/large
    on Apr 8, 2019
  9. added a commit that references this issue on Apr 10, 2019
    21e485a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

effort/largefeature-requestp1

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions