Skip to content

Commit

Permalink
Remove intrinsic JSX elements mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
yurynix committed Mar 13, 2022
1 parent 97d3d73 commit 825e1ef
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src_types/common/reactVelo.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,12 @@ type ReactVeloOutputElementsMap = {

type VeloTypeNames = Extract<keyof TypeNameToSdkType, string>;

// That's "hardcoded" Typescript convention for types for "regular" jsx elements, i.e. what goes as string to React.createElment("string")
declare namespace JSX {
interface Element {}
interface IntrinsicAttributes {}
interface ElementAttributesProperty { props: {}; }
interface ElementChildrenAttribute { children: {}; }

// https://www.typescriptlang.org/docs/handbook/jsx.html#type-checking
// An intrinsic element always begins with a lowercase letter, and a value-based element always begins with an uppercase letter.
type IntrinsicElementsMap = {
[key in VeloTypeNames as Uncapitalize<key>]: TypeNameToSdkType[key] extends $w.Repeater ? ReactVeloRepeaterType : ReactifiedVeloType<TypeNameToSdkType[key]>
}

interface IntrinsicElements extends IntrinsicElementsMap {}
type ReactVeloOutputTypesMap = {
[key in VeloTypeNames as Uncapitalize<key>]: TypeNameToSdkType[key] extends $w.Repeater ? ReactVeloRepeaterType : ReactifiedVeloType<TypeNameToSdkType[key]>
}

declare module '@wix/react-velo' {
export function render(rootElement: JSX.Element, $w: Function): void;
export const W: ReactVeloOutputElementsMap;
export const V: ReactVeloOutputTypesMap;
}

0 comments on commit 825e1ef

Please sign in to comment.