Skip to content

The export type of namespace presents the wrong typing alert  #37408

Description

@LenChang

TypeScript Version: 3.7.2

Search Terms:
namespace, typing

Code

type Nullable<T> = T | null

export namespace ProfileFields {
   type name = string;
   type WHYYY = string | null;
   type id = string | null;
  // export type WHYYY = Nullable<string>;
  // export type id = Nullable<string>;
}

export interface Profile {
  name: ProfileFields.name;
  WHYYY: ProfileFields.WHYYY;
  id: ProfileFields.id;
}

export type General = Pick<Profile, 'WHYYY' | 'name' | 'id'>

Expected behavior:

type General = {
WHYYY: ProfileFields.WHHYY
name: ProfileFields.name
id: ProfileFields.id
}

Actual behavior:

type General = {
WHYYY: ProfileFields.WHHYY
name: ProfileFields.name
id: ProfileFields.WHHYY
}

Playground Link: Provided

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions