
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
builderio-type-extensions
Advanced tools
This package is meant to be a set of helpful TypeScript definitions for writing powerful well structured TypeScript codebases in Builder.io's CMS. The current library contains support for input field extraction.
This utility infers types based on Builder input field array Builder.io's Component Input Types. The BuilderFields
and GenerateItems
are used together to infer the input array into a properly structured list of properties for your component.
Here's some sample input:
const inputs = [
{
name: "name",
type: "string",
required: true,
},
{
name: "favouriteColours",
type: "list",
subFields: [
{
name: "name",
type: "string",
defaultValue: "",
},
{
name: "hex",
type: "color",
},
],
},
] as const;
type InputProps = BuilderFields<GenerateItems<typeof inputs>>;
Note The input must be cast as const or the inference will not work as expected.
The above fields would result into the following type:
type InputProps = {
name: string;
favouriteColours?: {
name?: string;
hex?: string;
}[];
};
In your framework of choice you should be able to cast input properties with the resulting type:
function MyComponent(props: InputProps) => {
console.log(props.name);
console.log(props.favouriteColors);
};
1.0.0
- Initial release1.0.1
- Fixed packaging module issues1.1.1
- Improved formatting, adding required fields, added string enumsThank you to a number of individuals such as trusktr (Joe Pea) and individuals in the SolidJS community. I'm not a TypeScript wizard in the slightest but I learned a lot from pulling these types together.
FAQs
A set of TypeScript helpers for Builder.io's SDK.
The npm package builderio-type-extensions receives a total of 5 weekly downloads. As such, builderio-type-extensions popularity was classified as not popular.
We found that builderio-type-extensions demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.