Skip to content

Conversation

@remcohaszing
Copy link

Given the following tsconfig.json:

{
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true
  }
}

The following will currently causes an import error:

import { IconName } from '@fortawesome/fontawesome-common-types';

class MyClass {
  @MyDecorator
  icon: IconName;
}

This is because in some situations TypeScript doesn’t know that IconName is a
only exists as a type. It will generate an import, which can’t be resolved.

Simply adding an empty JavaScript file, will make the environment able to import
the package, even though the import value of IconName will be undefined.

I understand that:

  • I'm submitting this PR for reference only. It shows an example of what I'd like to see changed but
    I understand that it will not be merged and I will not be listed as a contributor on this project.

Given the following `tsconfig.json`:

```json
{
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true
  }
}
```

The following will currently causes an import error:

```ts
import { IconName } from '@fortawesome/fontawesome-common-types';

class MyClass {
  @mydecorator
  icon: IconName;
}
```

This is because in some situations TypeScript doesn’t know that `IconName` is a
only exists as a type. It will generate an import, which can’t be resolved.

Simply adding an empty JavaScript file, will make the environment able to import
the package, even though the import value of `IconName` will be `undefined`.
@tagliala
Copy link
Member

Hi!

Thanks for being part of the Font Awesome Community and thanks for this PR.

@robmadole @mlwilkerson could you please take a look?

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