Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@expo/config-types
Advanced tools
Types for the Expo config object app.config.ts
The @expo/config-types package provides TypeScript definitions for Expo config (`app.json` / `app.config.js`). It allows developers to have type checking and auto-completion when working with Expo configuration files, ensuring that the configuration adheres to the expected structure and types defined by Expo.
Type checking for app.json
This code sample demonstrates how to define an Expo app configuration with type checking. It ensures that the configuration object adheres to the structure and types expected by Expo, providing auto-completion and preventing common mistakes.
import { ExpoConfig } from '@expo/config-types';
const config: ExpoConfig = {
name: 'My Expo App',
slug: 'my-expo-app',
version: '1.0.0',
orientation: 'portrait',
icon: './path/to/icon.png',
splash: {
image: './path/to/splash.png',
resizeMode: 'contain',
backgroundColor: '#ffffff'
},
updates: {
fallbackToCacheTimeout: 0
},
assetBundlePatterns: ['**/*'],
ios: {
supportsTablet: true
},
android: {
adaptiveIcon: {
foregroundImage: './path/to/foreground.png',
backgroundColor: '#FFFFFF'
}
}
};
While not directly related to Expo configuration, @types/react-native provides TypeScript definitions for React Native components and APIs. It serves a similar purpose in the context of React Native development by offering type checking and auto-completion, enhancing developer experience and code reliability.
typescript-json-schema is a tool that generates JSON schemas from TypeScript types. It can be used to validate JSON data structures against TypeScript interfaces. In comparison, @expo/config-types specifically provides TypeScript definitions for Expo configuration, whereas typescript-json-schema is a more general tool for generating JSON schemas from any TypeScript types.
@expo/config-types
Types for the Expo config object app.config.ts
.
import { ExpoConfig } from '@expo/config-types';
export default (): ExpoConfig => {
return {
name: 'My App',
slug: 'my-app',
};
};
This package is 100% generated using the versioned JSON schemas from the Expo server.
yarn generate
- uses the major version from the package.json
.yarn generate --path ../../../universe/server/www/xdl-schemas/UNVERSIONED-schema.json
- uses the latest version from your local directory.yarn generate 39
- uses the given version.yarn generate unversioned
- uses the latest version.FAQs
Types for the Expo config object app.config.ts
We found that @expo/config-types demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 27 open source maintainers 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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.