Skip to content

Commit

Permalink
configuring typscript
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielZlotin committed Jan 15, 2018
1 parent ee675c5 commit 3ee6634
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 32 deletions.
3 changes: 2 additions & 1 deletion lib/src/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const LayoutTreeParser = require('./commands/LayoutTreeParser');
const LayoutTreeCrawler = require('./commands/LayoutTreeCrawler');
const PrivateEventsListener = require('./events/PrivateEventsListener');
const PublicEventsRegistry = require('./events/PublicEventsRegistry');
const Element = require('./adapters/Element');

import { Element } from './adapters/Element';

/** @constructor */
class Navigation {
Expand Down
20 changes: 0 additions & 20 deletions lib/src/adapters/Element.js

This file was deleted.

28 changes: 28 additions & 0 deletions lib/src/adapters/Element.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import * as React from 'react';
import * as PropTypes from 'prop-types';
import { requireNativeComponent } from 'react-native';

interface ElementProps {
elementId: any;
resizeMode: any;
}

let RNNElement: React.ComponentClass;

export class Element extends React.Component<ElementProps, object> {
static propTypes = {
elementId: PropTypes.string.isRequired,
resizeMode: PropTypes.string
}
static defaultProps = {
resizeMode: ''
}

render() {
return (
<RNNElement {...this.props} />
);
}
}

RNNElement = requireNativeComponent('RNNElement', Element);
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,15 @@
},
"dependencies": {
"lodash": "4.x.x",
"prop-types": "15.x.x"
"prop-types": "15.x.x",
"tslib": "1.x.x"
},
"devDependencies": {
"detox": "6.x.x",
"eslint-config-xo": "0.18.x",
"eslint-config-xo-react": "0.13.x",
"eslint-plugin-react": "7.x.x",
"jest": "22.x.x",
"jsdoc": "3.x.x",
"jsdoc-to-markdown": "3.x.x",
"mocha": "4.x.x",
"react": "16.0.0-beta.5",
"react-native": "0.49.x",
Expand All @@ -72,9 +71,10 @@
"typescript": "2.x.x",
"@types/react": "16.0.0",
"@types/react-native": "0.49.x",
"@types/jest": "22.x.x",
"@types/lodash": "4.x.x",
"@types/prop-types": "15.x.x",
"@types/react-test-renderer": "16.0.0"
"@types/react-test-renderer": "16.0.0",
"@types/jest": "22.x.x"
},
"babel": {
"env": {
Expand Down
22 changes: 22 additions & 0 deletions tsconfig-strict.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "http://json.schemastore.org/tsconfig",
"compilerOptions": {
"allowSyntheticDefaultImports": false,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"alwaysStrict": true,
"diagnostics": true,
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"noEmitOnError": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"pretty": true,
"strictFunctionTypes": false,
"strictNullChecks": true
}
}
11 changes: 5 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
{
"extends": "./tsconfig-strict",
"compilerOptions": {
"outDir": "./lib/dist",
"allowJs": true,
"target": "esnext",
"module": "commonjs",
"jsx": "preserve",
"noEmitOnError": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"alwaysStrict": true,
"strictNullChecks": true,
"jsx": "react-native",
"types": [
"lodash",
"react",
"react-native",
"prop-types",
"react-test-renderer",
"jest"
]
},
Expand Down

0 comments on commit 3ee6634

Please sign in to comment.