嵌套对象中的泛型键和typescript自动完成

嵌套对象中的泛型键和typescript自动完成,typescript,generics,visual-studio-code,autocomplete,intellisense,Typescript,Generics,Visual Studio Code,Autocomplete,Intellisense,我有密码: type User = { name:string; profile:Profile } type Profile = { isActive:boolean; } type CustomType<T> = { userWithProfile: keyof T | any } const customType:CustomType<User> = { userWithProfile:"" } 类型用户={ 名称:字符串; 简介:简介 }

我有密码:

type User = {
  name:string;
  profile:Profile
}

type Profile =  {
  isActive:boolean;
}

type CustomType<T> = {
  userWithProfile: keyof T | any
}

const customType:CustomType<User> = { userWithProfile:"" }
类型用户={
名称:字符串;
简介:简介
}
类型配置文件={
isActive:布尔型;
}
类型CustomType={
userWithProfile:keyof T | any
}
常量customType:customType={userWithProfile:“”
在本例中,intellisense不处理userWithProfile属性。如果我从定义中删除| any,intellisense工作,但只在第一个对象(用户)中工作

这里有什么解决方法吗?如何在嵌套对象中设置keyt

我正在使用最新的vscode(1.38.1)和typescript 3.6.2


谢谢

您希望
userWithProfile
成为什么样的用户<代码>名称| profile | isActive?“profile.isActive”,这是一个示例,在实际用例中,我尝试使用嵌套对象定义GridColumn