proptypes icon indicating copy to clipboard operation
proptypes copied to clipboard

proptypes changes impacted inferno-compat

Open AlgoTrader opened this issue 8 years ago • 2 comments

inferno-compat expects proptypes to export proptypes.default. Can you please export both directly and using default property?

> require('proptypes').default
undefined

> require('proptypes')
{ array: { [Function: bound checkType] isRequired: [Function: bound checkType] },
  bool: { [Function: bound checkType] isRequired: [Function: bound checkType] },
  func: { [Function: bound checkType] isRequired: [Function: bound checkType] },
  number: { [Function: bound checkType] isRequired: [Function: bound checkType] },
  object: { [Function: bound checkType] isRequired: [Function: bound checkType] },
  string: { [Function: bound checkType] isRequired: [Function: bound checkType] },
  symbol: { [Function: bound checkType] isRequired: [Function: bound checkType] },
  any: { [Function: bound checkType] isRequired: [Function: bound checkType] },
  arrayOf: [Function: createArrayOfTypeChecker],
  element: { [Function: bound checkType] isRequired: [Function: bound checkType] },
  instanceOf: [Function: createInstanceTypeChecker],
  node: { [Function: bound checkType] isRequired: [Function: bound checkType] },
  objectOf: [Function: createObjectOfTypeChecker],
  oneOf: [Function: createEnumTypeChecker],
  oneOfType: [Function: createUnionTypeChecker],
  shape: [Function: createShapeTypeChecker] }

AlgoTrader avatar Mar 25 '17 11:03 AlgoTrader

This is a CommonJS module though - default is not something you should ever expect to be supported in a CommonJS module.

Isn't there a mode for TypeScript that automatically handles this?

Alternatively, I'd be happy to add a modules entrypoint that points to src/index.js. It seems like that would solve the issue you're seeing.

developit avatar Mar 25 '17 18:03 developit

Now it’s the opposite:

> require('proptypes')
{ __esModule: true,
  default:
   { array: { [Function: bound checkType] isRequired: [Function: bound checkType] },
     bool: { [Function: bound checkType] isRequired: [Function: bound checkType] },
     func: { [Function: bound checkType] isRequired: [Function: bound checkType] },
     number: { [Function: bound checkType] isRequired: [Function: bound checkType] },
     object: { [Function: bound checkType] isRequired: [Function: bound checkType] },
     string: { [Function: bound checkType] isRequired: [Function: bound checkType] },
     symbol: { [Function: bound checkType] isRequired: [Function: bound checkType] },
     any: { [Function: bound checkType] isRequired: [Function: bound checkType] },
     arrayOf: [Function: createArrayOfTypeChecker],
     element: { [Function: bound checkType] isRequired: [Function: bound checkType] },
     instanceOf: [Function: createInstanceTypeChecker],
     node: { [Function: bound checkType] isRequired: [Function: bound checkType] },
     objectOf: [Function: createObjectOfTypeChecker],
     oneOf: [Function: createEnumTypeChecker],
     oneOfType: [Function: createUnionTypeChecker],
     shape: [Function: createShapeTypeChecker] } }

sapegin avatar Jul 26 '17 09:07 sapegin