Created
June 29, 2017 08:54
-
-
Save jquintozamora/8a292b74aabd2f8d4a2212b5e469eb43 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
import(/* webpackChunkName: "momentjs" */ "moment") | |
.then(function (moment) { | |
// lazyModule has all of the proper types, autocomplete works, | |
// type checking works, code references work \o/ | |
var time = moment().format(); | |
console.log("TypeScript >= 2.4.0 Dynamic Import Expression:"); | |
console.log(time); | |
_this.setState({ time: time }); | |
}) | |
.catch(function (err) { | |
console.log("Failed to load moment", err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment