Open JounQin opened 2 years ago
I can't find a way to get whether an identifier's type(ts.Type
) is from lib.
for example:
function foo(value: StoreValue) {
}
Hmm... Interesting, how does TypeScript itself implement skipLibCheck
? 🤣
Typescript's skipLibCheck
will ignore type error from lib
files, type-coverage already do this.
for example, it will not report:
node_modules/antd/lib/form/interface.d.ts:1:1 StoreValue
Your case is more like:
import { Select } from 'antd'
const a: typeof Select = 1 // even though skipLibCheck is set, typescript will still report the error.
Maybe best solution is improve the lib's types.
@plantain-00 I'm not using like that.
https://github.com/rx-ts/synckit/blob/main/src/index.ts#L6
src/index.ts:6:3: workerData
src/index.ts:113:41: message
src/index.ts:137:8: workerData
522 / 525 99.42%
Besides, the ignoreAsAssertion
seems not working at https://github.com/rx-ts/synckit/blob/main/src/index.ts#L113
src/index.ts:113:41: message
comes from !.message
, it's ignoreNonNullAssertion
src/index.ts:113:41: message
comes from!.message
, it'signoreNonNullAssertion
Ah, OK, thanks. So it would be better to show the detail reason.
src/index.ts:113:41: message
comes from!.message
, it'signoreNonNullAssertion
@plantain-00 Hmmm... Actually, I've already enabled ignoreNonNullAssertion
at https://github.com/rx-ts/synckit/blob/main/package.json#L111
the message
is any, not ignoreNonNullAssertion
and ignoreAsAssertion
@plantain-00
I was expecting ignoreAsAssertion
would ignore any as T
.
From ast's perspective, ignoreAsAssertion
checks TypeAssertionExpression
, any
checks type of Identifier
and ThisKeyword
, It's important for them to keep single responsibility principle
.
Is there any chance to add a new option to ignore such usage? A lot of many any
could be imported from 3rd-party packages or JSON.parse
.
Sure, PR is welcome. Like I commented before, I can't find a way to get whether an identifier's type(ts.Type) is from lib.
Version(if relevant): 1.0.0
Environment(if relevant):
Code(if relevant):
Expected:
Actual: