- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.1k
Closed
Labels
By DesignDeprecated - use "Working as Intended" or "Design Limitation" insteadDeprecated - use "Working as Intended" or "Design Limitation" instead
Description
// tag types: https://github.com/Microsoft/TypeScript/issues/4895
const enum Tag {} // <-- tag (hopefully nominal) type to indicate some assertion taken place over a string value
function foo(
    values: (string & Tag)[],
    callback: (one: string & Tag) => number // <-- only strings that have satisfied the assertion are welcome here
) {
    return undefined;
}
function bar(one: string): number { // <-- function that doesn't require its parameter to be marked
    return undefined
}
foo([], bar); // <-- no problem... why is bar an ok argument? didn't we ask for a function that requires a string & enum?
// are enums not nominal? why is it ok to ignore it here?Metadata
Metadata
Assignees
Labels
By DesignDeprecated - use "Working as Intended" or "Design Limitation" insteadDeprecated - use "Working as Intended" or "Design Limitation" instead