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

Typescript autocomplete broken with latest typescript version (4.4.2) #759

Closed
dhushyanth-s opened this issue Sep 4, 2021 · 6 comments
Closed
Assignees
Labels
Projects

Comments

@dhushyanth-s
Copy link

Bug report

The autocomplete is broken for the styled function with typescript versions ^4.4.2 which is the latest stable version.

To Reproduce

  1. Create a new react app with typescript
npx create-react-app --template typescript
  1. Add stitches to dependencies
npm i @stitches/react
  1. Import stitches with
import { styled } from '@stitches/react'
  1. Try invoking autocomplete for css attributes.

Expected behavior

All css attributes should be shown in autocomplete menu

Screenshots

with TS compiler version 4.4.2
image

with TS version 4.3.5 (from stitches repo package.json file)
image

System information

  • OS: macOS Big Sur 11.4 on M1 Macbook Pro
  • Version of Stitches: 1.0.0
  • Version of Node.js: v16.5.0

Additional context

  • VSCode version: 1.60.0
@dhushyanth-s dhushyanth-s changed the title Typescript autocomplete broken with lateste typescript version (4.4.2) Typescript autocomplete broken with latest typescript version (4.4.2) Sep 5, 2021
@peduarte peduarte added the typescript TypeScript related label Sep 6, 2021
@peduarte
Copy link
Contributor

peduarte commented Sep 6, 2021

Hi!

I've just followed your steps and was unable to reproduce:
CleanShot 2021-09-06 at 13 18 39@2x

The only difference is that I'm not on an M1 Mac, on Intel.

Thanks

@dhushyanth-s
Copy link
Author

As you can see on the bottom right of the VSCode window, VSCode is using typescript version 4.3.5 which is working as expected please test with latest stable version 4.4.2 or later.

You can change IDE typescript versions by just clicking on the version number in the status bar of the window.

@peduarte
Copy link
Contributor

peduarte commented Sep 6, 2021

@dhushyanth-s ah, yep, you're right. Thank you for the heads up!

I am able to replicate this issue now.

/cc @jonathantneal @hadihallak

@cpakken
Copy link

cpakken commented Sep 8, 2021

Typescript 4.4 added control flow analysis, maybe this change is causing the issue?
https://devblogs.microsoft.com/typescript/announcing-typescript-4-4/#cfa-aliased-conditions.

Also even in Typescript 4.4.2, the autocomplete works when defining utils inside createStitches:
image

Hope this is useful for the bugfix

@peduarte
Copy link
Contributor

peduarte commented Sep 9, 2021

Hi! This has been released to Stitches v1.1.0

yarn add @stitches/react@latest
# or
npm install @stitches/react@latest

@peduarte peduarte closed this as completed Sep 9, 2021
@dhushyanth-s
Copy link
Author

Wow that was quick!

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

No branches or pull requests

4 participants