Skip to content

Instantly share code, notes, and snippets.

@alessioprestileo
Created April 23, 2021 13:01
Show Gist options
  • Save alessioprestileo/e684cfbbb399253513229dd7d7935716 to your computer and use it in GitHub Desktop.
Save alessioprestileo/e684cfbbb399253513229dd7d7935716 to your computer and use it in GitHub Desktop.
Attempts to construct a value of type FString
type FString = string & { __compileTimeOnly: any };
const failure1: FString = 'hello world'; // Error: Type 'string' is not assignable to type '{ __compileTimeOnly: any; }'.
const failure2: FString = { __compileTimeOnly: 'whatever' }; // Error: Type '{ __compileTimeOnly: string; }' is not assignable to type 'string'.
const success1: FString = 'hello world' as FString;
const success2: FString = { __compileTimeOnly: 'whatever' } as FString;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment