Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

42 add typescript #104

Merged
merged 18 commits into from
Mar 18, 2024
Merged

42 add typescript #104

merged 18 commits into from
Mar 18, 2024

Conversation

ivanbkovacevic
Copy link
Collaborator

Added TS to the project.

Maybe tsconfig.json some other settings to be put.

Modelselect.tsx causing some little problems

@itmilos
Copy link
Member

itmilos commented Apr 13, 2023

@ivanbkovacevicIt may require some time for me to go through this thoroughly. In the future for similar tasks, we should consider breaking it down into smaller parts.

@ivanbkovacevic
Copy link
Collaborator Author

@ivanbkovacevicIt may require some time for me to go through this thoroughly. In the future for similar tasks, we should consider breaking it down into smaller parts.

@itmilos yes yes.... Offcourse

@itmilos itmilos linked an issue Apr 13, 2023 that may be closed by this pull request
@vercel
Copy link

vercel bot commented Apr 14, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
uplatnica ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 14, 2023 5:52pm
uplatnica-x ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 14, 2023 5:52pm

@ivanbkovacevic
Copy link
Collaborator Author

@itmilos I extracted types to constant but now Im getting conflicts in some files that was not there yesterday.
App constantly changes .ts import to .js imports

Help needed

width: number;
label: string;
value: string | number;
whenChanged: (e:any) => void;
Copy link
Member

@itmilos itmilos Apr 14, 2023

Choose a reason for hiding this comment

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

whenChanged: (e: React.ChangeEvent<HTMLInputElement>) => void;
}

@@ -1,16 +1,33 @@
import React from 'react';
import { deviceBrakepoints } from '../config/device-brakepoints'
import Label from './Label.jsx'
Copy link
Member

Choose a reason for hiding this comment

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

remove .jsx

@@ -1,14 +1,22 @@
import ErrorMessage from './ErrorMessage.jsx'
Copy link
Member

Choose a reason for hiding this comment

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

remove .jsx

@@ -1,14 +1,22 @@
import ErrorMessage from './ErrorMessage.jsx'
import React from 'react'
import ErrorMessage from './ErrorMessage.js'
Copy link
Member

Choose a reason for hiding this comment

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

remove .js

import S from 'styled-components'
import { useState } from 'react'
import { InputsProps } from './SplittedInput.js';
Copy link
Member

Choose a reason for hiding this comment

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

remove.js

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@itmilos I do not know why is that happening. The app is constantly injecting .jsx imports

@ivanbkovacevic ivanbkovacevic added the bug Something isn't working label Apr 14, 2023
const handleUseTemplate = (template) => {
const pullTemplates = localStorage.getItem('templates');
const templates = pullTemplates !== null ? JSON.parse(pullTemplates) : [];
console.log(templates);
Copy link
Member

Choose a reason for hiding this comment

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

remove

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@itmilos I have made the recommended changes.
Please test the branch before merging into master. It is a big change and also configuration changes

Copy link
Member

@itmilos itmilos left a comment

Choose a reason for hiding this comment

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

are we using in Payslip:1067
const accountNumber = params.get('account-number')
const amount = params.get('amount')

helpText: string;
label: string;
value: string | number;
whenChanged: (e:any) => void;
Copy link
Member

Choose a reason for hiding this comment

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

whenChanged: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;

@@ -959,38 +990,39 @@ function Payslip() {
const [state, dispatch] = useReducer(reducer, initialState, init)
Copy link
Member

Choose a reason for hiding this comment

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

const [state, dispatch] = useReducer<React.Reducer<ReducerState, ReducerAction>>(reducer, initialState, init)


const appendZeros = value => {
const appendZeros = (value: any) => {
Copy link
Member

Choose a reason for hiding this comment

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

const appendZeros = (value: string)

not sure please double check

let newValue = value
while (newValue.length < 13) newValue = '0' + newValue
dispatch({ type: ACTIONS.ACCOUNT_NUMBER_CHANGE, payload: newValue })
}
const onFixBankNumberChange = event => {
const onFixBankNumberChange = (event: { target: { value: string } }) => {
Copy link
Member

Choose a reason for hiding this comment

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

const onFixBankNumberChange = (event: React.ChangeEvent) => {
if (/^[1-9]{0,1}[0-9]{0,2}$/.test(event.target.value))
dispatch({ type: ACTIONS.BANK_NUMBER_CHANGE, payload: event.target.value })
}
const onAccountNumberChange = (event: React.ChangeEvent) => {
if (/^[0-9]{0,13}$/.test(event.target.value)) {
dispatch({ type: ACTIONS.ACCOUNT_NUMBER_CHANGE, payload: event.target.value })
}
}
const onControlNumberChange = (event: React.ChangeEvent) => {
if (/^[1-9]{0,1}[0-9]{0,1}$/.test(event.target.value))
dispatch({ type: ACTIONS.CONTROL_NUMBER_CHANGE, payload: event.target.value })
}

const onSetModelCodeChange = event => dispatch({ type: ACTIONS.MODEL_CODE, payload: event })
const onPaymentNumberChange = event => dispatch({ type: ACTIONS.PAYMENT_NUMBER, payload: event.target.value })
const onSetModelCodeChange = (event: { value: string; label: string }) => dispatch({ type: ACTIONS.MODEL_CODE, payload: event })
const onPaymentNumberChange = (event: { target: { value: any } }) => dispatch({ type: ACTIONS.PAYMENT_NUMBER, payload: event.target.value })
Copy link
Member

Choose a reason for hiding this comment

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

const onPaymentNumberChange = (event: React.ChangeEvent)

const resetValues = () => dispatch({ type: ACTIONS.RESET_VALUES })

const storeTemplate = (templateName) => {
const templates = JSON.parse(localStorage.getItem('templates')) ?? [];
const storeTemplate = (templateName: any) => {
Copy link
Member

Choose a reason for hiding this comment

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

const storeTemplate = (templateName: string)

@itmilos itmilos closed this Mar 18, 2024
@itmilos itmilos deleted the 42-add-typescript branch March 18, 2024 11:11
@itmilos itmilos restored the 42-add-typescript branch March 18, 2024 11:20
@itmilos itmilos reopened this Mar 18, 2024
# Conflicts:
#	package-lock.json
#	package.json
#	src/components/BankCard.tsx
#	src/pages/Payslip.tsx
@itmilos itmilos merged commit 961aab0 into master Mar 18, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add TypeScirpt
2 participants