Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

forgo

Package Overview
Dependencies
Maintainers
2
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

forgo - npm Package Compare versions

Comparing version 4.1.2 to 4.1.3

8

dist/index.d.ts

@@ -14,3 +14,3 @@ export type ForgoRef<T> = {

} & ForgoElementBaseProps;
export type ForgoLegacyComponentCtor<TProps extends object> = (props: TProps & ForgoElementBaseProps) => ForgoLegacyComponent<TProps>;
export type ForgoSimpleComponentCtor<TProps extends object> = (props: TProps & ForgoElementBaseProps) => ForgoLegacyComponent<TProps>;
export type ForgoNewComponentCtor<TProps extends object> = (props: TProps & ForgoElementBaseProps) => Component<TProps>;

@@ -49,3 +49,3 @@ export type ForgoElementArg = {

key?: any;
ctor: ForgoNewComponentCtor<TProps> | ForgoLegacyComponentCtor<TProps>;
ctor: ForgoNewComponentCtor<TProps> | ForgoSimpleComponentCtor<TProps>;
component: Component<TProps>;

@@ -195,4 +195,4 @@ props: TProps;

key?: any;
}>(type: string | ForgoNewComponentCtor<TProps> | ForgoLegacyComponentCtor<TProps>, props: TProps, ...args: any[]): {
type: string | ForgoNewComponentCtor<TProps> | ForgoLegacyComponentCtor<TProps>;
}>(type: string | ForgoNewComponentCtor<TProps> | ForgoSimpleComponentCtor<TProps>, props: TProps, ...args: any[]): {
type: string | ForgoNewComponentCtor<TProps> | ForgoSimpleComponentCtor<TProps>;
props: TProps;

@@ -199,0 +199,0 @@ key: any;

{
"name": "forgo",
"version": "4.1.2",
"version": "4.1.3",
"main": "./dist/forgo.min.js",

@@ -5,0 +5,0 @@ "type": "module",

@@ -152,6 +152,5 @@ # forgo

import * as forgo from "forgo";
import type { ForgoNewComponentCtor } from "forgo";
// The constructor generic type accepts the shape of your component's props
const HelloWorld: ForgoNewComponentCtor<{ name: string }> = () => {
const HelloWorld = () => {
return new forgo.Component({

@@ -173,32 +172,27 @@ render({ name }) {

import * as forgo from "forgo";
import type { ForgoNewComponentCtor, Component } from "forgo";
// Props have to be assigned to the initial props for TSX to recognize the generic
type ListProps<T extends string | number> = {
data: T[],
render: (item: T) => Component
}
data: T[];
};
const List = <T extends string | number> = (
initial: ListProps<T>
): Component<ListProps<T>> => new forgo.Component<ListProps<T>>({
render(props) {
return (
<ul>
{props.data.map(item => props.render(item))}
</ul>
}
});
const List = <T extends string | number>(initial: ListProps<T>) =>
new forgo.Component<ListProps<T>>({
render(props) {
return (
<ul>
{props.data.map((item) => (
<li>{item}</li>
))}
</ul>
);
},
});
const App: ForgoNewComponentCtor = () => new forgo.Component({
render(props) {
return (
<List
data={[1, '2', 3]}
// item: number | string
render={item => <li>{item}</li>}
/>
)
}
})
const App = () =>
new forgo.Component({
render(props) {
return <List data={[1, "2", 3]} />;
},
});
```

@@ -210,3 +204,2 @@

import * as forgo from "forgo";
import type { ForgoNewComponentCtor } from "forgo";

@@ -216,3 +209,3 @@ interface HelloWorldProps {

}
const HelloWorld: ForgoNewComponentCtor<HelloWorldProps> = () => {
const HelloWorld = () => {
const component = new forgo.Component<HelloWorldProps>({

@@ -219,0 +212,0 @@ render({ name }) {

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc