https://github.com/sohanemon/one2dos
https://github.com/sohanemon/one2dos
chakra-ui firebase firestore nextjs react typescript
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/sohanemon/one2dos
- Owner: sohanemon
- Created: 2022-12-27T03:07:36.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-30T13:27:13.000Z (over 3 years ago)
- Last Synced: 2025-09-26T03:51:29.457Z (8 months ago)
- Topics: chakra-ui, firebase, firestore, nextjs, react, typescript
- Language: TypeScript
- Homepage: https://2dos.vercel.app
- Size: 525 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
## Type.d.ts
Create `type.d.ts` and put all type definition there to get awesome typing suggestion without importing or exporting any type
example
```js
type auth = {
user: User | null,
googleLogin?: Function,
};
```
## Firebase User Type For Typescript
```js
type User = {
uid: string,
email: string,
emailVerified: boolean,
displayName: string,
isAnonymous: boolean,
photoURL: string,
providerData: [
{
providerId: string,
uid: string,
displayName: string,
email: string,
phoneNumber: null,
photoURL: string,
}
],
stsTokenManager: {
refreshToken: string,
accessToken: string,
expirationTime: number,
},
createdAt: string,
lastLoginAt: string,
apiKey: string,
appName: string,
};
```
## ! in Typescript
`!` is used as non-null assertion and definite assignment assertion
```js
let s = e!.name; // Assert that e is non-null and access name
```
```js
let x!: number; // Assert that x is defined
console.log(x + x); // No error!
```
## Using `as` in Typescript
```js
setPriority((e.target as HTMLElement).innerText)
}
>
Low
```
Where it is
```js
(e.target as HTMLElement).innerText
// is equal to
let x = e.target as HTMLElement
x.innerText
```
it asserts the `target` as a `HTMLElement` type
## Awesome refetching way! No SWR, React Query
```js
const [seed, setSeed] = useState(1);
const reset = () => {
setSeed(Math.random());
}
Reset
```