Skip to content

TypeScript: don't use outfile with tsc - it does not support modules #27

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

Merged
merged 1 commit into from
Mar 3, 2022

Conversation

kdojeteri
Copy link
Contributor

@kdojeteri kdojeteri commented Dec 21, 2021

Installing @harnessio/ff-nodejs-server-sdk and importing it in a typescript project results in a typescript error[1]. The is caused by this package being built with tsc --outfile which is not supposed to be used with module files and should only be used for libraries which expose global variables.

To reproduce the error, check out kdojeteri/harness-ff-typescript-error.

This pull request removes the --outfile ./dist/index.d.ts parameter and replaces it with --outdir ./dist, which fixes the error.

[1]

$ tsc --noEmit
index.ts:1:32 - error TS2306: File '/Users/figure/Desktop/test/node_modules/@harnessio/ff-nodejs-server-sdk/dist/index.d.ts' is not a module.

1 import { Client, Logger } from '@harnessio/ff-nodejs-server-sdk'
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 1 error.
error Command failed with exit code 2.

@kdojeteri kdojeteri changed the title don't use outfile - it does not support modules TypeScript: don't use outfile with tsc - it does not support modules Dec 21, 2021
@enver-bisevac enver-bisevac merged commit 36b28cb into harness:main Mar 3, 2022
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.

2 participants