Skip to content

Commit

Permalink
fix: generate POSIX paths in typesOverrides imports (#533)
Browse files Browse the repository at this point in the history
* fix: generate POSIX paths in typesOverrides imports
  • Loading branch information
lucas-gregoire authored Jul 18, 2023
1 parent 50f0ccb commit 6c20fcb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 0 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"useWorkspaces": true,
"version": "2.2.1"
}
5 changes: 5 additions & 0 deletions packages/cli/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
Type,
ImportedType,
} from '@pgtyped/query';
import os from 'os';
import path from 'path';

const String: Type = { name: 'string' };
Expand Down Expand Up @@ -160,6 +161,10 @@ export function declareImport(

if (from.startsWith('.')) {
from = path.relative(path.dirname(decsFileName), imports[0].from);
if (os.platform() === "win32") {
// make sure we use posix separators in TS import declarations (see #533)
from = from.split(path.sep).join(path.posix.sep);
}

if (!from.startsWith('.')) {
from = './' + from;
Expand Down

0 comments on commit 6c20fcb

Please sign in to comment.