Skip to content

feat: implement TypeScript typing#113

Open
SergeyArtsiomau wants to merge 2 commits into
React-js-OTUS:mainfrom
SergeyArtsiomau:homework1
Open

feat: implement TypeScript typing#113
SergeyArtsiomau wants to merge 2 commits into
React-js-OTUS:mainfrom
SergeyArtsiomau:homework1

Conversation

@SergeyArtsiomau

Copy link
Copy Markdown

No description provided.

Comment thread src/homeworks/ts1/1_base.ts Outdated
export const removeFirstZeros = (value: string): string => value.replace(/^(-)?[0]+(-?\d+.*)$/, '$1$2');

export const getBeautifulNumber = (
value: number | string | null | undefined,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

для чего null undefined?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пофиксил это

Comment thread src/homeworks/ts1/1_base.ts Outdated
const transformRegexp =
/(matrix\(-?\d+(\.\d+)?, -?\d+(\.\d+)?, -?\d+(\.\d+)?, -?\d+(\.\d+)?, )(-?\d+(\.\d+)?), (-?\d+(\.\d+)?)\)/;

export const getTransformFromCss = (transformCssString: string): { x: number; y: number } => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{ x: number; y: number } в отдельный тип

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пофиксил это

Comment thread src/homeworks/ts1/1_base.ts Outdated
export const shortColorRegExp = /^#[0-9a-f]{3}$/i;
export const longColorRegExp = /^#[0-9a-f]{6}$/i;

export const checkColor = (color: string): void => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если ф-ия возвращает ошибку то получается не только void

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пофиксил это

Comment thread src/homeworks/ts1/1_base.ts Outdated
return [red, green, blue];
};

export const getNumberedArray = <T>(arr: T[]): { value: T; number: number }[] =>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{ value: T; number: number } все подобное стоит выносить в отдельный тип

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пофиксил это

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants