Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

add enforceReadonlyAssignability flag for smoother transition to true readonly modifiers #13002

Copy link
Copy link
@zpdDG4gta8XKpMCd

Description

@zpdDG4gta8XKpMCd
Issue body actions

this can be seen in the nightly build as of Dec 17 (as well as at playground)

interface ReadOnlyData {
    readonly value: number;
}

interface WritableData {
    value: number;
}

function erase(data: WritableData): void {
    data.value = 0;
}

const readOnly: ReadOnlyData = { value: 1 };

erase(readOnly); // expected a type error, actual: no problem

this can't be serious, can it?
why is it called readonly?

please note there are no type assertions or any other attempts to trick the type system, it just simply doesn't work

50+ errors left uncaught

UPDATE


constructive discussion starts here: #13002 (comment)

r37r0m0d3l, lddubeau, krryan, abenhamdine, maxlk and 5 moredead-claudia, alex-kinokon, Agamnentzar, joelday and threehamsgcnew and piotrwitek

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already createdAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.