Skip to content

Instantly share code, notes, and snippets.

@ryancat
Last active October 22, 2018 06:39
Show Gist options
  • Save ryancat/50bc707614f0d5775256c04dff0a6cd4 to your computer and use it in GitHub Desktop.
Save ryancat/50bc707614f0d5775256c04dff0a6cd4 to your computer and use it in GitHub Desktop.
typescript migration demo
// typescript will give error: An import path cannot end with a '.ts' extension.
// this is just for clarification purpose!
import ModuleA from './ModuleA.ts';
import * as myLibTypes from './types.ts';
import * as myLibApi from './myLibApi.js';
const myLib = {
ModuleA,
// Need to expose types so that consumers can use them
myLibTypes,
};
Object.assign(myLib, myLibApi);
export = myLib;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment