Skip to content

Erroneous specifiers in declaration files. #26295

Closed

Description

@TejasQ

TypeScript Version: 3.0.1

Search Terms: import, eac

Code

// A *self-contained* demonstration of the problem follows...
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.
import styled from "react-emotion"

const Form = styled('div')({ color: "red" })

export default Form

Expected behavior:
When run with --declaration, the output I expected was:

import * as React from "react";
export declare const Form: import("create-emotion-styled/types/react").StyledOtherComponent<{}, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, any>;
export default Form;

Actual behavior:
When run with --declaration, the generated .d.ts file contains:

/// <reference path="../../node_modules/create-emotion/types/index.d.ts" />
/// <reference types="react" />
export declare const Form: import("create-emotion-styled/types/react").StyledOtherComponent<{}, import("eac").DetailedHTMLProps<import("eac").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, any>;
export default Form;

What's really strange is import("eac"). Where in the world is this coming from? 🤔

Playground Link:
I can't add a playground link because it depends on import.

Related Issues: emotion-js/emotion#788

Activity

  1. weswigham commented on Aug 8, 2018

    @weswigham
    Member

    If I had to guess: "eac" is the middle 3 characters of "react" and we're trimming the leading and trailing characters expecting them to be quotations (ambient modules are supposed to always be quoted), but they're not. 😄

  2. added
    BugA bug in TypeScript
    and removed
    Needs InvestigationThis issue needs a team member to investigate its status.
    on Aug 8, 2018
  3. michael8090 commented on Aug 30, 2018

    @michael8090

    awesome!

  4. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions