Created
October 11, 2018 07:52
-
-
Save watiko/0ff3c4335fe831464f13706ef54cdc6f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Ext { | |
export enum A { | |
One = 'one', | |
Two = 'two', | |
Three = 'three', | |
} | |
export namespace B { | |
export type Type = typeof One | typeof Two | typeof Three | |
export const One = 'one' | |
export const Two = 'two' | |
export const Three = 'three' | |
} | |
const one = 'one' | |
const two = 'two' | |
const three = 'three' | |
export const C = { | |
One: one as typeof one, | |
Two: two as typeof two, | |
Three: three as typeof three, | |
} | |
export type C = typeof C[keyof typeof C] | |
} | |
function a(p: Ext.A) { | |
return 'a' | |
} | |
a('one') | |
a(Ext.A.One) | |
function b(p: Ext.B.Type) { | |
return 'b' | |
} | |
b('one') | |
b(Ext.B.One) | |
function c(p: Ext.C) { | |
return 'c' | |
} | |
c('one') | |
c(Ext.C.One) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment