Skip to content

TypeScript compilation error: Object is possibly 'undefined' in nativewind-utils/tailwind-plugin/index.ts #2898

Open
@benoit-ctrl

Description

@benoit-ctrl

Description

TypeScript compilation error for project using the lib

CodeSandbox/Snack link

https://example.org

Steps to reproduce

Hi Gluestack team,

I'm encountering a TypeScript error when building my project due to a potential undefined access in your package:

../../node_modules/@gluestack-ui/nativewind-utils/tailwind-plugin/index.ts(58,16): error TS2532: Object is possibly 'undefined'.
../../node_modules/@gluestack-ui/nativewind-utils/tailwind-plugin/index.ts(58,43): error TS2532: Object is possibly 'undefined'.

The file tailwind-plugin/index.ts contains code that doesn't properly guard against possible undefined values and this file is a .ts file published directly in node_modules, so Typescript compiler option skipLibCheck does not apply. I got the error locally and in a fresh CI compile try.

This issues will block compilation for any project using strict mode or similar settings, Idon't know how to fix it without making a custom local patch-package in my projet.

gluestack-ui Version

"@gluestack-ui/nativewind-utils": "^1.0.26"

Platform

  • Expo
  • React Native CLI
  • Next
  • Web
  • Android
  • iOS

Other Platform

No response

Additional Information

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions