glennreyes/graphpack

TypeScript support

schickling opened this issue · 2 comments

graphpack looks awesome. Would be great if it would work out-of-the-box with TypeScript! 💪

I think it is possible just to add babel typescript preset, and everything should work

I have done this through webpack by following steps.

  • Installed ts-loader and typescript
  • Created tsconfig.json and paste below code.
{
	"compilerOptions": {
		"target": "esnext",
		"moduleResolution": "node",
		"allowJs": true,
		"noEmit": false,
		"strict": true,
		"isolatedModules": true,
		"esModuleInterop": true
	},
	"include": [
		"src"
	]
}
  • Created graphpack.config.js and pasted below code over there
config.module.rules.push({
    test: /\.tsx?$/,
    loader: 'ts-loader',
});
config.resolve = {
    extensions: ['.ts', '.tsx', '.js'],
};

Also, I configured it through Babel. Here are the steps https://github.com/rjoydip/graphpack-ts-support#through-babel