Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PURE annotation to generated typedef #240

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

skeggse
Copy link
Contributor

@skeggse skeggse commented Oct 14, 2019

Marking this statement as pure provides a workaround for #239 via live code inclusion/treeshaking and the disabling of function annotations. For example, a rollup configuration object like this will fully prune usage of flow-aws-lambda with annotate: false configured:

import babel from 'rollup-plugin-babel';

export default {
  input: './index.js',
  output: {
    file: './dist/index.js',
    format: 'cjs',
  },
  external: ['flow-aws-lambda'],
  treeshake: {
    pureExternalModules: true,
  },
  plugins: [
    babel({
      plugins: [['flow-runtime', { annotate: false }]],
      presets: ['@babel/preset-flow'],
    }),
  ],
};

Marking this statement as pure provides a workaround for the runtime
types being unused via live code inclusion/treeshaking and the
disabling of function annotations.
@skeggse
Copy link
Contributor Author

skeggse commented Nov 5, 2019

@gajus does this seem reasonable (not a comprehensive solution but not problematic)?

@gajus
Copy link
Owner

gajus commented Nov 5, 2019

This solution seems fine. However, can you please add a test case (even though there are others that are failing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants