Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

bump typescript to 4.7 #176

Closed
wants to merge 14 commits into from
Closed

bump typescript to 4.7 #176

wants to merge 14 commits into from

Conversation

SergNikitin
Copy link
Collaborator

This unlocks a couple of nifty features in my IDE (in addition to better typechecking, of course :P )

Comment on lines 135 to 136
} catch (exception) {
const err = errorise(exception)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's possible to throw anything in JS, this ensures that code below that expects only Errors doesn't accidentally get something else

Copy link
Contributor

@akindyakov akindyakov left a comment

Choose a reason for hiding this comment

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

🚃

@SergNikitin SergNikitin marked this pull request as draft March 26, 2022 15:45
@SergNikitin
Copy link
Collaborator Author

I converted this to draft as I encountered much more issues than originally expected

@SergNikitin
Copy link
Collaborator Author

Forgot to push the last experiments. Still failing, but much closer to something working now. Mostly blocked on this question

@SergNikitin SergNikitin changed the title bump typescript to 4.6 bump typescript to 4.7 Jun 1, 2022
@SergNikitin
Copy link
Collaborator Author

Current progress

tsc --build and test commands work for armoury, smuggler-api, elementary and truthsayer. I have learnt much more about how JS works than I ever wanted to.

Next steps

  • make yarn truthsayer start work (currently webpack can't find any .js files built from Typescript)
  • work on archaeologist

Blockers that can be worked around for local testing

Some foundational libs that we use currently refuse to work in ESM mode which will likely be a hard blocker:

To workaround these issues locally it's possible to hot-fix respective package.json files in your own node_modules

# @emotion/react/package.json

+ "exports": {
+     ".": {
+       "import": "./dist/emotion-react.esm.js",
+       "types": "./types/index.d.ts"
+     },
+     "./jsx-runtime": {
+       "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.esm.js",
+       "types": "./types/jsx-runtime.d.ts"
+     },
+     "./jsx-dev-runtime": {
+       "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.esm.js",
+       "types": "./types/jsx-dev-runtime.d.ts"
+     }
+ }
# react/package.json

+ "exports": {
+     ".": {
+       "react-server": "./unstable-index.server.js",
+       "default": "./index.js"
+     },
+     "./index": {
+       "react-server": "./unstable-index.server.js",
+       "default": "./index.js"
+     },
+     "./build-info.json": "./build-info.json",
+     "./jsx-runtime": "./jsx-runtime.js",
+     "./jsx-dev-runtime": "./jsx-dev-runtime.js"
+ }

One less critical lib is also impacted:

@SergNikitin
Copy link
Collaborator Author

This PR attempted to not only upgrade Typescript, but also to switch to ECMAScript Modules. ECMAScript Modules came up only due to issues with Jest and since they cause an enormous amount of trouble I think this effort should be put aside until ESM ecosystem matures more.

If we want to get newer versions of Typescript sooner, we should have another go but this time specifically try to do whatever it takes to not enable ESM.

@SergNikitin
Copy link
Collaborator Author

At long last, this was finally done in #766

@SergNikitin SergNikitin deleted the bump-ts-ver-to-4.6 branch May 11, 2023 18:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants