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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implement property access about non-primitive constraints of IAT #1067

Merged
merged 7 commits into from
Sep 1, 2023

Conversation

sunrabbit123
Copy link
Collaborator

@sunrabbit123 sunrabbit123 commented Aug 13, 2023

Description:

function l<T extends {}, P extends keyof T>(s: string, tp: T[P]): void {
    tp = s;
}
function m<T extends { a: number }, P extends keyof T>(s: string, tp: T[P]): void {
    tp = s;
}
function f<T extends object, P extends keyof T>(s: string, tp: T[P]): void {
    tp = s;
}

BREAKING CHANGE:

Related issue (if exists):
#1063


status

function f12<T, U extends T>(x: T, y: Partial<U>, k: keyof T) {
    x[k] = y[k];  // Error
    y[k] = x[k];  // Error
}

@sunrabbit123 sunrabbit123 marked this pull request as draft August 13, 2023 15:39
@github-actions
Copy link

github-actions bot commented Aug 13, 2023

Thank you for the PR!
Commit: a3a68b2

Files to check

These are files which is affected by the current PR, but not reflected. If there's no file below this message, please ignore this message.

You can run ./scripts/auto-unignore.sh from crates/stc_ts_file_analyzer for typescript files, and ./scripts/check.sh from crates/stc_ts_type_checker for *.stats.rust-debug files.

@sunrabbit123
Copy link
Collaborator Author

sunrabbit123 commented Aug 24, 2023

I can't help but feel like I'm approaching this the wrong way.

TypeParam can't be keyofed beforehand because when it receives an argument value, it receives a value that inherits the constraints.

But in some cases it does

Why???

@sunrabbit123 sunrabbit123 marked this pull request as ready for review August 31, 2023 14:49
@sunrabbit123 sunrabbit123 requested a review from kdy1 August 31, 2023 14:49
@sunrabbit123 sunrabbit123 marked this pull request as draft August 31, 2023 14:49
@sunrabbit123 sunrabbit123 marked this pull request as ready for review August 31, 2023 14:49
@kdy1 kdy1 changed the title Feat: Implement accessProperty about nonPrimitive constraint of indexedAccessType feat: Implement property access about non-primitive constraints of IAT Sep 1, 2023
@kdy1 kdy1 merged commit a354f07 into dudykr:main Sep 1, 2023
8 checks passed
@sunrabbit123 sunrabbit123 deleted the fix/4 branch September 1, 2023 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants