microsoft / microsoft/fluentui

[Bug]: Interfaces for FabricConfig are misaligned throughout Fluent.

Open
#25,228 17 comments 0 reactions 1 assignee View on GitHub

@khmakoto is already working on this.

Since Feb 2, 2023.

Fluent UI react (v8) From Shield Partner Ask Priority 2: Normal Resolution: Soft Close
Dominant language
TypeScript
Stars
20.3k
Forks
2.9k
Avg merge
2d 9h
Merged PRs (30d)
46

Description

Library

React / v8 (@fluentui/react)

System Info
System:
    OS: Windows 10 10.0.22000
    CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
    Memory: 8.75 GB / 31.94 GB
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (106.0.1370.34)
    Internet Explorer: 11.0.22000.120

NOTE: I'm on Win11 Pro not 10
Are you reporting Accessibility issue?

no

Reproduction

N/A - compiler error

Bug Description

Interfaces and uses of FabricConfig are not lined up properly. If a consumer imports font-icons-mdl2 they'll get the global defined within that file and this cannot be overridden (TS feature request: https://github.com/microsoft/TypeScript/issues/36146).

Actual Behavior

If font-icons-mdl2 is imported, the window.FabricConfig interface is set globally. Unfortunately, this then doesn't align with the expected interface that Stylesheet.ts uses. As a result teams downstream doing more complex things or attempting to pull this config are stuck just @ts-ignore'ing their own globals to get around the problem.

Global from Fluent:

https://github.com/microsoft/fluentui/blob/6112cd720c2a15635eae7175f22ec53510dd511c/packages/font-icons-mdl2/src/index.ts#L31-L57

Uses in Stylesheet and thus what consuming teams would need if they want to grab a config and align:

https://github.com/microsoft/fluentui/blob/a40470aff64a92bae7bb560bfd69192405001b9e/packages/merge-styles/src/Stylesheet.ts#L97-L103

Results in this error:
TS2717: Subsequent property declarations must have the same type. Property 'FabricConfig' must be of type '{ fontBaseUrl?: string | undefined; iconBaseUrl?: string | undefined; } | undefined', but here has type '{ mergeStyles?: IStyleSheetConfig | undefined; } | undefined'.

Expected Behavior

FabricConfig uses IFabricConfig and all places within FluentUI React are aligned.

Logs

No response

Requested priority

Normal

Products/sites affected

MADS

Are you willing to submit a PR to fix?

yes

Validations
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.