From 19df13460134f7e73b4efdcdde6594a5b2aaec82 Mon Sep 17 00:00:00 2001 From: Varpusparvi Date: Tue, 21 Feb 2023 11:38:58 +0100 Subject: [PATCH 1/4] Improve type --- __tests__/injectIntl.tsx | 9 ++++----- src/injectIntl.tsx | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/__tests__/injectIntl.tsx b/__tests__/injectIntl.tsx index c67f706..89302de 100644 --- a/__tests__/injectIntl.tsx +++ b/__tests__/injectIntl.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import * as Utils from '../helper/test_utils'; - -import { injectIntl } from '../src'; +import { injectIntl, ReactIntlPhraseProps } from '../src'; const key = 'key.id'; const locale = 'en'; @@ -14,7 +13,7 @@ describe('injectIntl', () => { let ComponentUnderTest; beforeEach(() => { - function Component({ translate }) { + function Component({ translate }: ReactIntlPhraseProps) { const translation = translate(key); return (
{translation}
); @@ -53,8 +52,8 @@ describe('injectIntl', () => { let ComponentUnderTest; beforeEach(() => { - function Component({ formatMessage }) { - const message = formatMessage({ id: key }); + function Component({ formatMessage }: ReactIntlPhraseProps) { + const message = formatMessage({ id: key }, {name: 'Eric'}); return (
{message}
); } diff --git a/src/injectIntl.tsx b/src/injectIntl.tsx index ee87fa5..66833fd 100644 --- a/src/injectIntl.tsx +++ b/src/injectIntl.tsx @@ -1,10 +1,10 @@ import * as React from 'react'; -import { injectIntl as injectIntlReact } from 'react-intl'; +import { injectIntl as injectIntlReact, IntlFormatters } from 'react-intl'; import { escapeId, isPhraseEnabled } from './functions'; export type ReactIntlPhraseProps = { translate: (_: string)=> string; - formatMessage: (_: {id?: string}) => string; + formatMessage: IntlFormatters['formatMessage'], }; export function injectIntl(WrappedComponent: React.ComponentType, options?: Parameters[1]): ReturnType & React.FC { From 94ce94c7b2b94d5f254d65e70b5796e2b5b5637f Mon Sep 17 00:00:00 2001 From: Varpusparvi Date: Tue, 21 Feb 2023 11:41:22 +0100 Subject: [PATCH 2/4] Upgrade workflow steps --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8b5d121..0a7f2cc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,9 +4,9 @@ jobs: build: runs-on: ubuntu-18.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Use Node.js 12.8 - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: 12.8 - name: Install dependencies From da9f2a8d0a7b206e89888dfb52e2f778861c7d42 Mon Sep 17 00:00:00 2001 From: Varpusparvi Date: Tue, 21 Feb 2023 11:42:20 +0100 Subject: [PATCH 3/4] Use newer versions --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0a7f2cc..d228d45 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,13 +2,13 @@ name: Test on: [push] jobs: build: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Use Node.js 12.8 + - name: Use Node.js 16 uses: actions/setup-node@v3 with: - node-version: 12.8 + node-version: 16 - name: Install dependencies run: npm install - name: Test From 36c16853e7671268e3c25c572ca519fd3bd88091 Mon Sep 17 00:00:00 2001 From: Varpusparvi Date: Tue, 21 Feb 2023 11:51:20 +0100 Subject: [PATCH 4/4] Bump && adjust steps --- .github/workflows/main.yml | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d228d45..f742ea8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: with: node-version: 16 - name: Install dependencies - run: npm install + run: yarn install - name: Test run: | - npm test -- --configuration=ci + yarn test diff --git a/package.json b/package.json index ff98452..edf3030 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-intl-phraseapp", - "version": "3.1.0", + "version": "3.1.1", "description": "The In-Context-Editor for react using react-intl", "main": "dist/react-intl-phraseapp.js", "typings": "./dist/index.d.ts",