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

Handle relative type references #100

Closed
wants to merge 2 commits into from
Closed

Conversation

jablko
Copy link
Contributor

@jablko jablko commented Sep 1, 2020

@jablko jablko marked this pull request as ready for review September 1, 2020 23:20
@jablko
Copy link
Contributor Author

jablko commented Sep 2, 2020

If I recall correctly, this rule is intentional; of the examples you linked to, only the nested reference in slickgrid should be allowed, so probably the change should be to require as many leading ../ as the number of nested directories + 1.

From the history it looks like when types-publisher only had support for non-relative type references, only /// <reference types="packagename/x" /> were local, which makes sense, and this was applied to relative type references by analogy, but that doesn't make sense? addReference() already correctly handles non-local relative references:

if (
full.startsWith("..") &&
(baseDirectory === "" || path.normalize(joinPaths(baseDirectory, full)).startsWith(".."))
) {
throw new Error(
`${src.fileName}: ` +
'Definitions must use global references to other packages, not parent ("../xxx") references.' +
`(Based on reference '${ref.text}')`
);
}

@sandersn
Copy link
Member

Fixup PR is DefinitelyTyped/DefinitelyTyped#44382

@jakebailey
Copy link
Member

This code's going away in #788.

@jakebailey jakebailey closed this Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants