Skip to content

Instantly share code, notes, and snippets.

@a-type
Created March 22, 2026 02:19
Show Gist options
  • Select an option

  • Save a-type/dd176bb04da0585c1f85fd68dc5fbac4 to your computer and use it in GitHub Desktop.

Select an option

Save a-type/dd176bb04da0585c1f85fd68dc5fbac4 to your computer and use it in GitHub Desktop.
Solving "This is likely not portable."

Okay, I run into this a lot. At least since PNPM.

Here's at least one thing that's worked for me:

Whatever the non-portable type is that it's complaining about (something imported from another library and re-exported)...

  1. Create a named type alias for that type in the module
  2. Export that type alias
  3. Explicit cast the thing to that type alias

So

import { type Thing as LibThing, createThing } from 'a-library';

export type MyThing = LibThing;
export const myThing = createThing() as MyThing;

My understanding is you just need some concrete location for the relevant type to be referenced from that's exported from your own module.

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