<!-- BUGS: Please use this template. --> <!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/typescript --> <!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md --> **TypeScript Version:** 2.1.0-dev.20160918 **Code** ``` ts export function returnAnyString(): string { return ""; } export function acceptsOnlyFoo(value: "foo"): void { // ... } const value = returnAnyString(); if(value === "foo") acceptsOnlyFoo(value); // error TS2345: Argument of type 'string' is not assignable to parameter of type '"foo"'. ``` **Expected behavior:** The `===` to narrow type `string` to a string literal type when checking for equality with a string literal. I would expect the above example to be the same as the following example which **does** work... ``` ts export function returnAnyString(): string { return ""; } export function acceptsOnlyFoo(value: "foo"): void { // ... } function isFoo(s: string): s is "foo" { return s === "foo"; } const value = returnAnyString(); if(isFoo(value)) acceptsOnlyFoo(value); ``` **Actual behavior:** The type is still `string`.