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

api-extractor & build issue: Internal Error: The "MenuTrigger" symbol has a ts.SyntaxKind.Identifier declaration which is not (yet?) supported by API Extractor #19360

Open
Hotell opened this issue Aug 11, 2021 · 5 comments · Fixed by #25575
Labels
Area: Build System Resolution: Soft Close Soft closing inactive issues over a certain period Status: Fixed Fixed in some PR

Comments

@Hotell
Copy link
Contributor

Hotell commented Aug 11, 2021

Describe the issue:

While migrating react-components suite to new DX (#19040), an interesting error appeared both on local and CI:

Error: Internal Error: The "MenuTrigger" symbol has a ts.SyntaxKind.Identifier declaration which is not (yet?) supported by API Extractor

2021-08-11 at 10 19

Actual behavior:

Expected behavior:

api-extractor task should succeed


Troubleshooting

I was able to find 2 similar kind of issue on api-extractor repo:

Although none of those were exact match to this issue, so I dig deeper.

After reverse engineering api-extractor source I was able to find the issue:

The issue surfaced only now, because react-components re-exports multiple packages from N packages, which is not happening per narrowed package scope.

To better understand lets check following visualization of how build task is being executed (in simplified manner):

2021-08-11 at 10 42

the build was failing while running api-extractor task, with aforementioned error Error: Internal Error: The "MenuTrigger" symbol has a ts.SyntaxKind.Identifier declaration which is not (yet?) supported by API Extractor...

Why is that happening ?

IF take a look at MenuTrigger implementation

export const MenuTrigger: React.FC<MenuTriggerProps> = props => {
  const state = useMenuTrigger(props);

  return renderMenuTrigger(state);
};

MenuTrigger.displayName = 'MenuTrigger';

There is nothing suspicious right? If we remove MenuTrigger.displayName = 'MenuTrigger'; the error will go away. Most of other component is using forwardRef so probably that's where the problem lies ?

NOPE

The problem is ts.SyntaxKind.Identifier which means, parser has issues with const. Which brings us to -> wait why is api-extractor parsing implementation files instead of declaration types ?

Note: based on api-extractor docs, it stops parsing external packages completely

After many hours :D , I finally found the culprit:

  • our new DX is leveraging TS path aliases, so thats what is happening when executing API-extractor.
  • lets check the workflow that showcases the issue:

2021-08-11 at 11 08

How to fix this ?

  • just-scripts scope:
    • we'll need to provide similar processing like we do for ts task execution ( which is aware if package is using new DX thus turns off path aliases )
  • local:build scope:
    • we'll need to provide similar logic to just-scripts for api-extractor.local.json overrides for react-components initially, later on for all vNext packages
@ecraig12345
Copy link
Member

Thanks for digging into this! Should we open an API Extractor issue as well?

@msft-fluent-ui-bot msft-fluent-ui-bot added the Resolution: Soft Close Soft closing inactive issues over a certain period label Feb 8, 2022
@msft-fluent-ui-bot
Copy link
Collaborator

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@ecraig12345 ecraig12345 reopened this Feb 8, 2022
@ecraig12345 ecraig12345 removed the Resolution: Soft Close Soft closing inactive issues over a certain period label Feb 8, 2022
@micahgodbolt
Copy link
Member

I inadvertently removed this shim in #22144 and the build passed without issue. Is it possible this shim is no longer needed?

@Hotell
Copy link
Contributor Author

Hotell commented Apr 27, 2022

I inadvertently removed this shim in #22144 and the build passed without issue. Is it possible this shim is no longer needed?

you didn't remove it. it's about local build execution which works differently than on CI because we use path aliases build:local npm script

@msft-fluent-ui-bot msft-fluent-ui-bot added the Resolution: Soft Close Soft closing inactive issues over a certain period label Oct 24, 2022
@msft-fluent-ui-bot
Copy link
Collaborator

Because this issue has not had activity for over 180 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

@msft-fluent-ui-bot msft-fluent-ui-bot added Status: Fixed Fixed in some PR and removed Status: In PR labels Nov 16, 2022
@microsoft microsoft locked as resolved and limited conversation to collaborators Dec 17, 2022
@Hotell Hotell removed the Resolution: Soft Close Soft closing inactive issues over a certain period label Jul 20, 2023
@Hotell Hotell reopened this Jul 20, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the Resolution: Soft Close Soft closing inactive issues over a certain period label Jan 16, 2024
@Hotell Hotell reopened this Jan 17, 2024
@Hotell Hotell removed the Resolution: Soft Close Soft closing inactive issues over a certain period label Jan 17, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Resolution: Soft Close Soft closing inactive issues over a certain period label Jul 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: Build System Resolution: Soft Close Soft closing inactive issues over a certain period Status: Fixed Fixed in some PR
Projects
None yet
5 participants