History log of /expo/packages/@expo/cli/jest.config.js (Results 1 – 2 of 2)
Revision Date Author Comments
# b31f747d 03-Jul-2023 Mark Lawlor <[email protected]>

feat: add generated types for Expo Router useSegment (#22629)

# Why

* Add type generation for Expo Router's `useSegment`
* Adds code comments and renames a few internal types.
* Refactored the

feat: add generated types for Expo Router useSegment (#22629)

# Why

* Add type generation for Expo Router's `useSegment`
* Adds code comments and renames a few internal types.
* Refactored the `useSearchParams` types
* Add default to `Href<T>`

Note that this is not a breaking change as the generated types are only
present inside the users' cache and should not be committed. Next time
the user starts the dev server they will get the new generated types.

## Questions

@EvanBacon Given the route `/(app)/note/[note]/` does useSegments return
the group?

## `useSearchParams`

This hook was a bit strange as its signature changed when you enabled
types routes.

Without: `useSearchParams<T extends Record<string, string>(): T`
With: `useSearchParams<T extends Route>(): SearchParams<T>`

This PR updates the TypedRoutes version to accept either a `Route` or a
`Record`. This `Record` is still typed checked and it must satisfy a
possible SearchParams object.

For example

```tsx
// This will only work if you have a [test] route somewhere in your app
const { test } = useSearchParams<{ test: string }>()
```

I quite like this as it allows you to cherry-pick the param that you
need.

Note that this obviously doesn't do a runtime check for it maybe be
correct, but its a start.

## Href<T>

Href<T> has a default value and by default now represents all possible
Hrefs. You can use the generic to reduce it down.

---------

Co-authored-by: evanbacon <[email protected]>

show more ...


# 8d307f52 23-Mar-2022 Evan Bacon <[email protected]>

chore: refactor `expo/cli` to `@expo/cli` package (#16717)

* chore: refactor `expo/cli` to `@expo/cli` package

* Update CODEOWNERS

* fix linking

* fix lint script

* fix build file

* f

chore: refactor `expo/cli` to `@expo/cli` package (#16717)

* chore: refactor `expo/cli` to `@expo/cli` package

* Update CODEOWNERS

* fix linking

* fix lint script

* fix build file

* fix e2e tests

* lint before build

* use mock version

show more ...