mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* create-react-class: add definitions * react-dom-factories: add definitions * create-react-class: add tests, fix errors * react-dom-factories: add tests, fix lint * react: remove previously deprecated APIs * Remove deprecated usages in other definitions * redux-form: disable strictFunctionTypes Changes to react typings revealed errors in redux-form that are present in 'master'. This needs to be handled separately. * Update create-react-class, react-dom-factories author * Avoid importing create-react-class where possible * Move top-level createReactClass tests to create-react-class
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import * as angular from "angular";
|
|
import * as React from "react";
|
|
import * as PropTypes from "prop-types";
|
|
import { ReactDirective } from "ngreact";
|
|
|
|
const app = angular.module("app", ["react"]);
|
|
|
|
app.directive('helloComponent', function(reactDirective: ReactDirective) {
|
|
return reactDirective(HelloComponent);
|
|
});
|
|
|
|
app.directive('helloComponent', function(reactDirective: ReactDirective) {
|
|
return reactDirective('HelloComponent');
|
|
});
|
|
|
|
app.directive('hello', function(reactDirective: ReactDirective) {
|
|
return reactDirective(HelloComponent, ['fname', 'lname']);
|
|
});
|
|
|
|
app.directive('hello', function(reactDirective: ReactDirective) {
|
|
return reactDirective(HelloComponent, undefined, {restrict: 'C'});
|
|
});
|
|
|
|
app.directive('helloComponent', function(reactDirective: ReactDirective, $location: angular.ILocationService) {
|
|
return reactDirective(HelloComponent, undefined, {}, { $location });
|
|
});
|
|
|
|
interface HelloProps {
|
|
fname: string;
|
|
lname: string;
|
|
}
|
|
|
|
class HelloComponent extends React.Component<HelloProps> {
|
|
static propTypes = {
|
|
fname : PropTypes.string.isRequired,
|
|
lname : PropTypes.string.isRequired
|
|
}
|
|
|
|
render() {
|
|
return <span>Hello {this.props.fname} {this.props.lname}</span>;
|
|
}
|
|
}
|
|
|
|
app.value('HelloComponent', HelloComponent);
|