codemix / babel-plugin-typecheck

Static and runtime type checking for JavaScript in the form of a Babel plugin.
MIT License
886 stars 44 forks source link

Simple export / import isn't working #147

Closed tquetano-r7 closed 8 years ago

tquetano-r7 commented 8 years ago

Giving this a test-drive, and trying to to basic import / export, and it's not working out.

// types/TestType.js
export type TestType = {
  foo: string,
  bar: string
};

// test.js
import type {
  TestType
} from 'types/TestType';

const test: TestType = {
  foo: 'foo',
  bar: 'bar'
};

throws this error:

Uncaught TypeError: TestType is not a function

Am I missing something? This seems so rudimentary, and based on the documentation it looks like this should be working.

phpnode commented 8 years ago

It should definitely work, please paste your babelrc

tquetano-r7 commented 8 years ago

Nope, I'm an idiot, figured it out soon as you said to check the .babelrc. I did theonly declaration, and was doing the @typecheck comment declaration in the file that was importing the type, but not in the file that was exporting the type. My bad, closing.