Skip to content

Fix types for vendored files #11

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

Merged
merged 4 commits into from
Sep 21, 2022
Merged

Fix types for vendored files #11

merged 4 commits into from
Sep 21, 2022

Conversation

popeindustries
Copy link
Owner

@popeindustries popeindustries commented Sep 19, 2022

It seems that TypeScript 4.8 isn't yet able to resolve aliased package.json#exports entries (Node/dvlp/esbuild are able to). This fix autogenerates alias files to ensure that TypeScript is able to resolve the modules correctly.

Fixes #10

@changeset-bot
Copy link

changeset-bot bot commented Sep 19, 2022

🦋 Changeset detected

Latest commit: d2b2144

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@popeindustries/lit-element Patch
@popeindustries/lit-html Patch
@popeindustries/lit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Collaborator

@knuthaug knuthaug left a comment

Choose a reason for hiding this comment

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

Seems to work well after a quick test in one repo, but haven't tested exhaustively.

@popeindustries popeindustries merged commit 986ccfb into main Sep 21, 2022
@popeindustries popeindustries deleted the fix/types branch September 21, 2022 10:33
@knuthaug
Copy link
Collaborator

I really don't understand why, but 1.0.5 (lit-html@5.0.3, lit-html-server@5.0.3) gives the exact same errors as 1.0.4, event though it worked when linking this branch. When bundling I get:

 {
      detail: undefined,
      id: '',
      location: {
        column: 14,
        file: 'node_modules/.pnpm/@popeindustries+lit@1.0.5/node_modules/@popeindustries/lit/directives/unsafe-html.js',
        length: 52,
        line: 1,
        lineText: "export * from '@popeindustries/lit-html/directives/unsafe-html.js';",
        namespace: '',
        suggestion: ''
      },
      notes: [
        {
          location: {
            column: 17,
            file: 'node_modules/.pnpm/@popeindustries+lit@1.0.5/node_modules/@popeindustries/lit-html/package.json',
            length: 16,
            line: 54,
            lineText: '      "default": "./directives/*"',
            namespace: '',
            suggestion: ''
          },
          text: 'The module "./directives/unsafe-html.js" was not found on the file system:'
        }

Which leads me to suspect that it is the wildcard export in lit-html that needs splitting into individual exports? Or is there a release of lit-html and lit-html-server planned also?

@popeindustries
Copy link
Owner Author

@knuthaug so TypeScript is happy, but Rollup (or esbuild?) isn't?

@knuthaug
Copy link
Collaborator

knuthaug commented Sep 21, 2022

no, typescript isn't happy either.

import { unsafeHTML } from '@popeindustries/lit/directives/unsafe-html.js';

gives

Module '"@popeindustries/lit/directives/unsafe-html"' has no exported member 'unsafeHTML'.ts(2305)

typescript@4.8.3

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.

Export for directives can't be resolved
2 participants