@smg-automotive/i18n-pkg
Advanced tools
Comparing version 1.4.0 to 1.4.1-fix-translation-function-typing-6b20dea34d8f757e9556c1fd741a60589c9b2c3a.1
@@ -10,4 +10,7 @@ import React, { Dispatch, SetStateAction } from 'react'; | ||
}; | ||
type TranslateFunction = (key: string, params?: Params) => string; | ||
type Dictionary = Record<string, any>; | ||
type TranslateFunction = <T = string>(key: string, params?: Params) => T; | ||
type DictionaryItem = string | string[] | Dictionary | Dictionary[]; | ||
export type Dictionary = { | ||
[key: string]: DictionaryItem; | ||
}; | ||
type OnMissing = (error: Error) => void; | ||
@@ -14,0 +17,0 @@ export interface ContextProps { |
@@ -1,6 +0,2 @@ | ||
import { Language } from './components/context'; | ||
type DictionaryEntry = Dictionary | string; | ||
export interface Dictionary { | ||
[key: string]: DictionaryEntry; | ||
} | ||
import { Dictionary, Language } from './components/context'; | ||
export declare const isDictionary: (value: unknown) => value is Dictionary; | ||
@@ -7,0 +3,0 @@ export interface Options { |
@@ -52,3 +52,3 @@ 'use strict'; | ||
var I18nContext = react.createContext({ | ||
t: function (key) { return i18n.t(key); }, | ||
t: (function (key) { return i18n.t(key); }), | ||
language: defaultLanguage, | ||
@@ -74,3 +74,3 @@ displayTranslationKeys: false, | ||
}; | ||
var t = function (key, params) { | ||
var t = (function (key, params) { | ||
var isPlural = (params === null || params === void 0 ? void 0 : params.count) !== undefined; | ||
@@ -92,3 +92,3 @@ var translation = isPlural | ||
return translation; | ||
}; | ||
}); | ||
var _b = react.useState(false), displayTranslationKeys = _b[0], setDisplayTranslationKeys = _b[1]; | ||
@@ -95,0 +95,0 @@ var i18nWrapper = { |
@@ -10,4 +10,7 @@ import React, { Dispatch, SetStateAction } from 'react'; | ||
}; | ||
type TranslateFunction = (key: string, params?: Params) => string; | ||
type Dictionary = Record<string, any>; | ||
type TranslateFunction = <T = string>(key: string, params?: Params) => T; | ||
type DictionaryItem = string | string[] | Dictionary | Dictionary[]; | ||
export type Dictionary = { | ||
[key: string]: DictionaryItem; | ||
}; | ||
type OnMissing = (error: Error) => void; | ||
@@ -14,0 +17,0 @@ export interface ContextProps { |
@@ -1,6 +0,2 @@ | ||
import { Language } from './components/context'; | ||
type DictionaryEntry = Dictionary | string; | ||
export interface Dictionary { | ||
[key: string]: DictionaryEntry; | ||
} | ||
import { Dictionary, Language } from './components/context'; | ||
export declare const isDictionary: (value: unknown) => value is Dictionary; | ||
@@ -7,0 +3,0 @@ export interface Options { |
@@ -50,3 +50,3 @@ import { __assign } from 'tslib'; | ||
var I18nContext = createContext({ | ||
t: function (key) { return i18n.t(key); }, | ||
t: (function (key) { return i18n.t(key); }), | ||
language: defaultLanguage, | ||
@@ -72,3 +72,3 @@ displayTranslationKeys: false, | ||
}; | ||
var t = function (key, params) { | ||
var t = (function (key, params) { | ||
var isPlural = (params === null || params === void 0 ? void 0 : params.count) !== undefined; | ||
@@ -90,3 +90,3 @@ var translation = isPlural | ||
return translation; | ||
}; | ||
}); | ||
var _b = useState(false), displayTranslationKeys = _b[0], setDisplayTranslationKeys = _b[1]; | ||
@@ -93,0 +93,0 @@ var i18nWrapper = { |
@@ -10,4 +10,7 @@ import React, { Dispatch, SetStateAction } from 'react'; | ||
}; | ||
type TranslateFunction = (key: string, params?: Params) => string; | ||
type Dictionary = Record<string, any>; | ||
type TranslateFunction = <T = string>(key: string, params?: Params) => T; | ||
type DictionaryItem = string | string[] | Dictionary | Dictionary[]; | ||
export type Dictionary = { | ||
[key: string]: DictionaryItem; | ||
}; | ||
type OnMissing = (error: Error) => void; | ||
@@ -14,0 +17,0 @@ export interface ContextProps { |
@@ -1,6 +0,2 @@ | ||
import { Language } from './components/context'; | ||
type DictionaryEntry = Dictionary | string; | ||
export interface Dictionary { | ||
[key: string]: DictionaryEntry; | ||
} | ||
import { Dictionary, Language } from './components/context'; | ||
export declare const isDictionary: (value: unknown) => value is Dictionary; | ||
@@ -7,0 +3,0 @@ export interface Options { |
@@ -13,4 +13,7 @@ import React, { Dispatch, SetStateAction } from 'react'; | ||
}; | ||
type TranslateFunction = (key: string, params?: Params) => string; | ||
type Dictionary$1 = Record<string, any>; | ||
type TranslateFunction = <T = string>(key: string, params?: Params) => T; | ||
type DictionaryItem = string | string[] | Dictionary | Dictionary[]; | ||
type Dictionary = { | ||
[key: string]: DictionaryItem; | ||
}; | ||
type OnMissing = (error: Error) => void; | ||
@@ -25,3 +28,3 @@ interface ContextProps { | ||
language: Language; | ||
lngDict: Dictionary$1; | ||
lngDict: Dictionary; | ||
onMissingTranslation: OnMissing; | ||
@@ -34,6 +37,2 @@ } | ||
type DictionaryEntry = Dictionary | string; | ||
interface Dictionary { | ||
[key: string]: DictionaryEntry; | ||
} | ||
interface Options { | ||
@@ -40,0 +39,0 @@ language: Language; |
{ | ||
"name": "@smg-automotive/i18n-pkg", | ||
"version": "1.4.0", | ||
"version": "1.4.1-fix-translation-function-typing-6b20dea34d8f757e9556c1fd741a60589c9b2c3a.1", | ||
"description": "A boilerplate package setup", | ||
@@ -34,3 +34,3 @@ "main": "dist/cjs/index.js", | ||
"@rollup/plugin-typescript": "11.0.0", | ||
"@smg-automotive/eslint-config": "3.0.5", | ||
"@smg-automotive/eslint-config": "3.0.6", | ||
"@testing-library/jest-dom": "5.16.5", | ||
@@ -43,6 +43,6 @@ "@testing-library/react": "14.0.0", | ||
"rimraf": "4.1.2", | ||
"rollup": "3.17.2", | ||
"rollup": "3.17.3", | ||
"rollup-plugin-dts": "5.2.0", | ||
"rollup-plugin-peer-deps-external": "2.2.4", | ||
"semantic-release": "20.1.0", | ||
"semantic-release": "20.1.1", | ||
"ts-jest": "29.0.5", | ||
@@ -49,0 +49,0 @@ "ts-node": "10.9.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
56135
716
2