Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

interface name start with I #267

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ We'll write a `Hello.tsx`:

import * as React from 'react';

export interface Props {
export interface IProps {
name: string;
enthusiasmLevel?: number;
}

function Hello({ name, enthusiasmLevel = 1 }: Props) {
function Hello({ name, enthusiasmLevel = 1 }: IProps) {
if (enthusiasmLevel <= 0) {
throw new Error('You could be a little more enthusiastic. :D');
}
Expand Down Expand Up @@ -268,17 +268,17 @@ To do that, we're going to

import * as React from "react";

export interface Props {
name: string;
export interface IProps {
name?: string;
enthusiasmLevel?: number;
}

interface State {
interface IState {
currentEnthusiasm: number;
}

class Hello extends React.Component<Props, State> {
constructor(props: Props) {
class Hello extends React.Component<IProps, IState> {
constructor(props: IProps) {
super(props);
this.state = { currentEnthusiasm: props.enthusiasmLevel || 1 };
}
Expand Down Expand Up @@ -491,7 +491,7 @@ For this, we can create a file called `src/types/index.tsx` which will contain d
```ts
// src/types/index.tsx

export interface StoreState {
export interface IStoreState {
languageName: string;
enthusiasmLevel: number;
}
Expand Down Expand Up @@ -522,23 +522,23 @@ Next, we'll create a set of actions and functions that can create these actions
```ts
import * as constants from '../constants';

export interface IncrementEnthusiasm {
export interface IIncrementEnthusiasm {
type: constants.INCREMENT_ENTHUSIASM;
}

export interface DecrementEnthusiasm {
export interface IDecrementEnthusiasm {
type: constants.DECREMENT_ENTHUSIASM;
}

export type EnthusiasmAction = IncrementEnthusiasm | DecrementEnthusiasm;
export type EnthusiasmAction = IIncrementEnthusiasm | IDecrementEnthusiasm;

export function incrementEnthusiasm(): IncrementEnthusiasm {
export function incrementEnthusiasm(): IIncrementEnthusiasm {
return {
type: constants.INCREMENT_ENTHUSIASM
}
}

export function decrementEnthusiasm(): DecrementEnthusiasm {
export function decrementEnthusiasm(): IDecrementEnthusiasm {
return {
type: constants.DECREMENT_ENTHUSIASM
}
Expand Down Expand Up @@ -597,7 +597,7 @@ First let's update `src/components/Hello.tsx` so that it can modify state.
We'll add two optional callback properties to `Props` named `onIncrement` and `onDecrement`:

```ts
export interface Props {
export interface IProps {
name: string;
enthusiasmLevel?: number;
onIncrement?: () => void;
Expand Down