as方式推断类型<>指定类型 as方式推断类型let anystr:any = "hello world"let strLength: number = (anystr as string).lengthconsole.log('len ',strLength) <>指定类型let strLen: number = (<string>anystr).lengthconsole.log('len2',strLen);