-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Description
TypeScript Version:
- typescript@2.8.4 ok
- typescript@2.9.2 bug
- typescript@3.0.0-dev.20180626 bug
Search Terms:
Code
declare const AddressSymbol: unique symbol;
type AddressString = typeof AddressSymbol & string;
function printout(data: AddressString | undefined) {
console.log(data); // type of `data` is always undefined since TS 2.9
}
printout(undefined); // ok
const a = "foo" as AddressString;
printout(a); // broken since TS 2.9Expected behavior: the code compiles
Actual behavior: since TypeScript 2.9, the compilations fails with:
$ ./node_modules/typescript/bin/tsc example.ts
example.ts:11:10 - error TS2345: Argument of type 'AddressString' is not assignable to parameter of type 'undefined'.
11 printout(a); // broken in TS 2.9
~
Related Issues: #25179
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug