Skip to content

Commit aabddae

Browse files
committed
refactor(core): type createIdentityTagger's frameworkName as FrameworkName
The enum was decorative for the framework packages: they passed a member into a plain `string` parameter, so nothing stopped a package inventing its own value for the attribute the backend keys off. Typing it closes that. Verified the constraint bites: passing 'Vue' now fails with "Type '"Vue"' is not assignable to type 'FrameworkName'. Did you mean '"vue"'?"
1 parent 90f55f6 commit aabddae

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

packages/core/src/util/createIdentityTagger.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { FrameworkName } from '../framework';
12
import type { Framework, SdkInfo } from '../types';
23

34
/** Minimal surface the tagger needs; the browser Flare and any subclass satisfy it structurally. */
@@ -10,7 +11,12 @@ export interface SdkTaggable {
1011
* Builds a per-package SDK/framework identity tagger. Holds its own WeakSet guards so each Flare
1112
* instance (singleton or injected renderer) is tagged at most once, on each of the two axes.
1213
*/
13-
export function createIdentityTagger(config: { sdkName: string; sdkVersion: string; frameworkName: string }): {
14+
/**
15+
* `frameworkName` is typed as `FrameworkName`, not `string`: this is the wire vocabulary the backend
16+
* keys off, so a first-party package cannot invent a value here. A host app that genuinely needs its
17+
* own name calls `setFramework` directly.
18+
*/
19+
export function createIdentityTagger(config: { sdkName: string; sdkVersion: string; frameworkName: FrameworkName }): {
1420
registerSdkIdentity(flare: SdkTaggable): void;
1521
tagFramework(flare: SdkTaggable, frameworkVersion?: string): void;
1622
} {

0 commit comments

Comments
 (0)