Skip to content
This repository was archived by the owner on Jun 11, 2020. It is now read-only.

Conversation

@jablko
Copy link
Contributor

@jablko jablko commented Apr 28, 2020

types-publisher always resolves non-relative imports relative to the current older-version directory, e.g. import { createRenderer } from 'react-test-renderer/shallow'; -> types/react-test-renderer/v15/shallow/index.d.ts. This implies a "react-test-renderer/*": ["react-test-renderer/v15/*"] path mapping, or the compiler will look in the latest-package directory instead (types/react-test-renderer/shallow/index.d.ts).

This PR ensures that the path mapping is there. The error is roughly cribbed from

if (directoryVersion !== undefined && !(paths && packageName in paths)) {
const mapping = JSON.stringify([`${packageName}/v${formatTypingVersion(directoryVersion)}`]);
throw new Error(
`${packageName}: Older version ${formatTypingVersion(directoryVersion)} must have a "paths" entry of "${packageName}": ${mapping}`,
);
}

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

Same comment as your other fixes. Can you add a test for this, and port it to microsoft/DefinitelyTyped-tools?

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.

2 participants