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

international-types

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

international-types - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

2

dist/index.d.ts

@@ -26,3 +26,3 @@ export type LocaleValue = string | number | boolean | null | undefined | Date;

}[keyof T] : '';
type FollowPath<T, P> = P extends `${infer U}.${infer R}` ? U extends keyof T ? FollowPath<T[U], R> : never : P extends keyof T ? T[P] : never;
type FollowPath<T, P> = P extends `${infer U}.${infer R}` ? U extends keyof T ? FollowPath<T[U], R> : P extends keyof T ? T[P] : never : P extends keyof T ? T[P] : never;
export type FlattenLocale<Locale extends Record<string, unknown>> = {

@@ -29,0 +29,0 @@ [K in Leaves<Locale>]: FollowPath<Locale, K>;

{
"name": "international-types",
"version": "0.8.0",
"version": "0.8.1",
"description": "Type-safe internationalization (i18n) utility types",

@@ -23,3 +23,4 @@ "types": "dist/index.d.ts",

},
"homepage": "https://github.com/QuiiBz/next-international#readme",
"homepage": "https://next-international.vercel.app",
"license": "MIT",
"scripts": {

@@ -26,0 +27,0 @@ "build": "tsc --declaration --emitDeclarationOnly --outDir dist index.ts"

@@ -61,3 +61,3 @@ <p align="center">

function scopedT<Scope extends Scopes<Locale>>(scope: Scope) {
function t<Key extends LocaleKeys<Locale, Scope>>(key: Key) {
return function t<Key extends LocaleKeys<Locale, Scope>>(key: Key) {
// ...

@@ -78,3 +78,3 @@ }

```ts
import type { LocaleKeys, LocaleValue } from 'international-types'
import type { LocaleKeys, BaseLocale, Scopes, ScopedValue, CreateParams, ParamsObject } from 'international-types'

@@ -86,9 +86,13 @@ type Locale = {

function t<
Key extends LocaleKeys<Locale, undefined>,
Value extends LocaleValue = ScopedValue<Locale, undefined, Key>,
>(key: Key, param: ParamsObject<Value>) {
// ...
function scopedT<Locale extends BaseLocale, Scope extends Scopes<Locale> | undefined>(scope?: Scope) {
return function t<Key extends LocaleKeys<Locale, Scope>, Value extends ScopedValue<Locale, Scope, Key>>(
key: Key,
...params: CreateParams<ParamsObject<Value>, Locale, Scope, Key, Value>
) {
// ...
}
}
const t = scopedT<Locale, undefined>();
t('param', {

@@ -95,0 +99,0 @@ value: ''

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