Created
July 29, 2017 16:26
-
-
Save MichaelFedora/c3b521845a671d3ef9a7399cd97b2514 to your computer and use it in GitHub Desktop.
dynamic import test
This file contains hidden or 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
(async () => { | |
let foo = (i: number): [number, Promise<any>] => { | |
switch(i) { | |
case 0: return [4, import('./test')]; | |
default: return [0, Promise.resolve(null)]; | |
} | |
} | |
const res = foo(0); | |
console.log(res[0], await res[1]); | |
// should output `4 { default: { greeting: 'Hello World!' } }` | |
})(); |
This file contains hidden or 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
export default { greeting: 'Hello World!' }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment