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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Unable to import type Date' in Input transform #1977

Open
1 of 2 tasks
hisham opened this issue Nov 24, 2023 · 0 comments
Open
1 of 2 tasks

'Unable to import type Date' in Input transform #1977

hisham opened this issue Nov 24, 2023 · 0 comments
Labels

Comments

@hisham
Copy link

hisham commented Nov 24, 2023

馃悶 bug report

Is this a regression?

No

Description

I'm implementing an Input transform that converts a string to Date, but the angular vscode extension is not accepting type of 'string | Date' for the input value.

The error I get is: Unable to import type Date. The symbol is not exported from /Users/<username>/.vscode/extensions/angular.ng-template-17.0.2/node_modules/typescript/lib/lib.es5.d.ts.(-993004) lib.es5.d.ts(22, 3): The type is declared here.

Bug Type

What does this bug affect

  • Angular Language Service VSCode extension
  • Angular Language Service server

Reproduction

function dateAttribute(value: string | Date): Date {
  return typeof value === 'string' ? new Date(value) : value;
}


@Component({
  selector: 'foo-bar',
  standalone: true,
  imports: [CommonModule],
  templateUrl: './foo-bar.component.html',
  styleUrls: ['./foo-bar.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush,
})

  @Input({
    transform: dateAttribute,
  })
  pausedAt: Date;

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

CleanShot 2023-11-24 at 15 27 18@2x

If applicable, add screenshots to help explain your problem.

Example Screenshot

馃實 Your Environment

Angular Version:




16.1.1

Extension Version:




17.0.2

VSCode Version:




1.84.2

Operating System:




Mac Sonoma 14.1.1
@hisham hisham added the bug label Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant