Skip to content

Commit

Permalink
feat: nested translation + fix undefined kind + add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
paibamboo committed Nov 14, 2019
1 parent e394491 commit 9fcae1b
Show file tree
Hide file tree
Showing 13 changed files with 4,066 additions and 41 deletions.
12 changes: 12 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
"@babel/env",
["@babel/typescript", {"allowNamespaces": true}]
],
"plugins": [
["@babel/plugin-proposal-decorators", {"legacy": true}],
"@babel/plugin-transform-runtime",
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread"
]
}
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ before_script: greenkeeper-lockfile-update

script:
- npm run build
- npm run test

after_script: greenkeeper-lockfile-upload

Expand Down
15 changes: 15 additions & 0 deletions mocks/Extend.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as React from "react";
import {SimpleTranslation} from "./Simple";

interface ExtendTranslation extends SimpleTranslation {
d: string;
e: string;
}

interface IProps {
something: string;
somethingElse: number;
translation: ExtendTranslation;
}

export class Extend extends React.Component<IProps> {}
15 changes: 15 additions & 0 deletions mocks/Infer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as React from "react";

interface Customer {
age: number;
firstName: string;
lastName: string;
}

interface IProps {
something: string;
somethingElse: number;
translation: Record<keyof Customer, string>;
}

export class Infer extends React.Component<IProps> {}
36 changes: 36 additions & 0 deletions mocks/Nested.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import * as React from "react";

export interface Nested {
translation: {
a: string;
b: string;
}
}

export interface DoubleNested {
something: {
translation: {
c: string;
d: string;
}
}
}

export interface TripNested {
something: {
somethingElse: {
translation: {
e: string;
f: string;
}
}
}
}

interface IProps {
nested: Nested;
doubleNested: DoubleNested;
tripleNested: TripNested;
}

export class Nested extends React.Component<IProps> {}
3 changes: 3 additions & 0 deletions mocks/NoProps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import * as React from "react";

export class NoProps extends React.Component {}
15 changes: 15 additions & 0 deletions mocks/Simple.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as React from "react";

export interface SimpleTranslation {
a: string;
b: string;
c: string;
}

interface IProps {
something: string;
somethingElse: number;
translation: SimpleTranslation;
}

export class Simple extends React.Component<IProps> {}
Loading

0 comments on commit 9fcae1b

Please sign in to comment.